Skip to content

Support for gems.rb is causing a NameError for the Bundler constant in generators #624

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

Closed
elia opened this issue Aug 26, 2020 · 2 comments · Fixed by #627
Closed

Support for gems.rb is causing a NameError for the Bundler constant in generators #624

elia opened this issue Aug 26, 2020 · 2 comments · Fixed by #627

Comments

@elia
Copy link
Contributor

elia commented Aug 26, 2020

The use of Bundler in #588 is causing:

foo-app:master $ cd /tmp/foo-app/; spring stop; trash tmp/cache/boot*; bin/rails g -h                                                                                                 /t/foo-app
Spring stopped.
fish: No matches for wildcard 'tmp/cache/boot*'. See `help expand`.
cd /tmp/foo-app/; spring stop; trash tmp/cache/boot*; bin/rails g -h
                                       ^
/Users/elia/.asdf/installs/ruby/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/configuration.rb:8:in `gemfile': uninitialized constant #<Class:Spring>::Bundler (NameError)
	from /Users/elia/.asdf/installs/ruby/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/configuration.rb:47:in `find_project_root'
	from /Users/elia/.asdf/installs/ruby/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/configuration.rb:41:in `project_root_path'
	from /Users/elia/.asdf/installs/ruby/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/configuration.rb:32:in `application_root_path'
	from /Users/elia/.asdf/installs/ruby/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/application.rb:288:in `loaded_application_features'
	from /Users/elia/.asdf/installs/ruby/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/application.rb:119:in `ensure in preload'
	from /Users/elia/.asdf/installs/ruby/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/application.rb:126:in `preload'
	from /Users/elia/.asdf/installs/ruby/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/application.rb:157:in `serve'
	from /Users/elia/.asdf/installs/ruby/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/application.rb:145:in `block in run'
	from /Users/elia/.asdf/installs/ruby/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/application.rb:139:in `loop'
	from /Users/elia/.asdf/installs/ruby/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/application.rb:139:in `run'
	from /Users/elia/.asdf/installs/ruby/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/application/boot.rb:19:in `<top (required)>'
	from /Users/elia/.asdf/installs/ruby/2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:72:in `require'
	from /Users/elia/.asdf/installs/ruby/2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:72:in `require'
	from -e:1:in `<main>'

The app comes from a vanilla rails new plus solidus added to the gemfile (I was testing a generator).
I think it just needs to require Bundler where it's used. Locally I solved by downgrading to v2.1.0.

@Sixeight
Copy link
Contributor

Forked process doesn't know Bundler. Then ProcessTitleUpdater on boot.rb failed to update process title because app.app_name uses Bundler.default_gemfile through Spring.gemfile .

Spring is running:

57589 spring server | sample | started 29 secs ago
57590 ruby -I /Users/tomohiro/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib -e require 'spring/application/boot'

I except

Spring is running:

55038 spring server | sample | started 8 secs ago
55040 spring app    | sample | started 8 secs ago | development mode

@alexbel
Copy link

alexbel commented Jul 6, 2021

Looks like the PR is not going to be merged any time soon.
Workaround: add require 'bundler' in ~/.spring.rb

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 a pull request may close this issue.

3 participants