Skip to content

Ensure bundler is required when used #627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 23, 2021

Conversation

elia
Copy link
Contributor

@elia elia commented Oct 6, 2020

Spring.gemfile is using bundler, the require is needed in certain cases in which Bundler is not already loaded.

Specifically when spring is loaded via Spring::ApplicationManager the #start_child method wraps the call inside Bundler.with_original_env restoring a RUBYOPT env variable without the bundler require. That, in turn, causes errors like:

/Users/elia/.asdf/installs/ruby/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/configuration.rb:10:in `gemfile': uninitialized constant #<Class:Spring>::Bundler (NameError)

Fixes #624

Spring.gemfile is using bundler, the require is needed in certain
cases in which Bundler is not already loaded.

Specifically when spring is loaded via Spring::ApplicationManager
the #start_child method wraps the call inside Bundler.with_original_env
restoring a RUBYOPT env variable without the bundler require. That in
turn causes errors like:

/Users/elia/.asdf/installs/ruby/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/configuration.rb:10:in `gemfile': uninitialized constant #<Class:Spring>::Bundler (NameError)
@elia elia force-pushed the missing-bundler-require branch from f222215 to 9f7d072 Compare February 23, 2021 22:23
@deivid-rodriguez
Copy link
Contributor

Sometimes spring can cause double load warnings when requiring default gems, like here: #616. Perhaps best to move the require right before using Bundler, so that it's lazy?

@rafaelfranca rafaelfranca merged commit d49dc58 into rails:master Nov 23, 2021
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.

Support for gems.rb is causing a NameError for the Bundler constant in generators
3 participants