Skip to content
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

Spring v1.6.0 broken on ruby 2.1.6 #457

Closed
hsume2 opened this issue Dec 16, 2015 · 10 comments
Closed

Spring v1.6.0 broken on ruby 2.1.6 #457

hsume2 opened this issue Dec 16, 2015 · 10 comments

Comments

@hsume2
Copy link

hsume2 commented Dec 16, 2015

I'm getting this backtrace when running spring -v.

/opt/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/spring-1.6.0/lib/spring/client.rb:6:in `require': cannot load such file -- spring/client/help (LoadError)
    from /opt/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/spring-1.6.0/lib/spring/client.rb:6:in `<top (required)>'
    from /opt/.rbenv/versions/2.1.6/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /opt/.rbenv/versions/2.1.6/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /opt/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/gems/spring-1.6.0/bin/spring:48:in `<top (required)>'
    from /opt/.rbenv/versions/2.1.6/bin/spring:23:in `load'
    from /opt/.rbenv/versions/2.1.6/bin/spring:23:in `<main>'

I believe this was caused by this line. I'll see if I can figure out what the proper fix is.

@sonalkr132
Copy link
Contributor

hey. Can you help me recreate this?

I did following:

$ rvm install 2.1.6
$ gem install spring -v 1.6.0
$ gem install bundler
$ spring -v
Spring version 1.6.0

Did you get error just on spring -v? I don't think there is any specific test for spring -v but these lines come close.

@sonalkr132
Copy link
Contributor

I added following to acceptance test:

test "show version" do
   assert_success "bin/spring -v", stdout: 'Spring version 1.6.0'
end

And following are passing travis builds of ruby 2.1.6:
rails 4.0
rails 4.1
rails 4.2

@sonalkr132
Copy link
Contributor

Okay. I finally reproduced it. If you are inside a folder which has Gemfile (for example a rails app) and you don't have gem spring in the Gemfile then you get mentioned issues.
This is because of following line in spring/commands.rb:

  require "bundler/setup"

Bundler setup overrides the $LOAD_PATH with gems in Gemfile and if spring is not there, one would get

`require': cannot load such file -- spring/client/help

It can be fixed if require "spring" is added after require "bundler/setup. There has to be a better solution than this. May be one where this confict of $LOAD_PATH doesn't occur in first place.

@hsume2
Copy link
Author

hsume2 commented Dec 17, 2015

Hey @sonalkr132 thanks for looking into this. It's hard to imagine a quick fix for this. A more involved fix would require using require_relative or something so we're not dependent on the $LOAD_PATH.

@RTJ
Copy link

RTJ commented Dec 18, 2015

Hello,
I has same problem, for me worked this:

bin/spring stop
bin/spring binstub --remove --all
bundle install && update

it works fine on my iMac, but i removed it from nitrous.io. on nitrous.io its not working ( ruby 2.2.1 and rails 4.2.5 )

sonalkr132 added a commit to sonalkr132/spring that referenced this issue Dec 19, 2015
@jbodah
Copy link

jbodah commented Dec 22, 2015

👍 6fc09c0 fixes the issue for me as well

@jonleighton
Copy link
Member

I don't think 6fc09c0 is the best way to fix this, see my comment on #455

jonleighton added a commit that referenced this issue Jan 8, 2016
Rather than from the Spring client process. See
https://github.com/rails/spring/pull/455/files#r48411471

Within the app process, we'll have access to the spring config, to see
whether Spring.quiet has been set.

This means we can remove the spring/commands require from the client
side, which should never have been added and caused problems (#456, #457).

I'm getting rid of the feature which omits this message when run
manually (i.e. `spring rails runner ...` rather than `bin/rails runner
...`) because:

1. It makes the implementation more complicated
2. YAGNI
@jonleighton
Copy link
Member

I think v1.6.2 (just released) solves this. Please reopen if not.

@hsume2
Copy link
Author

hsume2 commented Jan 8, 2016

Thanks!

@grosser
Copy link
Collaborator

grosser commented Jan 9, 2016

❤️ thx for fixing this nastiness :)

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

No branches or pull requests

6 participants