Skip to content

Use env shebangs for RubyGems installs#4126

Draft
joshheinrichs-shopify wants to merge 1 commit into
Shopify:mainfrom
joshheinrichs-shopify:env-shebang
Draft

Use env shebangs for RubyGems installs#4126
joshheinrichs-shopify wants to merge 1 commit into
Shopify:mainfrom
joshheinrichs-shopify:env-shebang

Conversation

@joshheinrichs-shopify
Copy link
Copy Markdown

Motivation

RubyGems bin wrappers hardcode the Ruby used at install time. With
Nix-style Ruby installs, that path can later be garbage-collected or
replaced, leaving wrappers like ruby-lsp and bundle pointing at a stale
store path.

Implementation

Ruby LSP already activates the project Ruby environment before installing
or launching the server, so install the bootstrap ruby-lsp gem and any
missing Bundler versions with RubyGems' env-shebang option. This lets
generated wrappers resolve ruby from the activated PATH instead.

Bundler project binstubs already use env shebangs by default; this makes
the RubyGems bin wrappers Ruby LSP relies on behave similarly.

Automated Tests

Yes.

Manual Tests

In a clean project, ruby-lsp and bundler should have #!/usr/bin/env ruby as the shebang.

RubyGems bin wrappers hardcode the Ruby used at install time. With
Nix-style Ruby installs, that path can later be garbage-collected or
replaced, leaving wrappers like ruby-lsp and bundle pointing at a stale
store path.

Ruby LSP already activates the project Ruby environment before installing
or launching the server, so install the bootstrap ruby-lsp gem and any
missing Bundler versions with RubyGems' env-shebang option. This lets
generated wrappers resolve ruby from the activated PATH instead.

Bundler project binstubs already use env shebangs by default; this makes
the RubyGems bin wrappers Ruby LSP relies on behave similarly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant