SublimeLinter: wrong GEM_HOME, wrong version

I’m using rvm with my default ruby being 2.2.4. For my project I’m using 2.3.0.

Obviously SublimeLinter should fetch $GEM_HOME from my project’s root (ruby 2.3.0), not from my home folder (ruby 2.2.4). Unfortunately this doesn’t happen. See the log:

SublimeLinter: computed PATH using /bin/bash:
/Users/Enno/.rvm/gems/ruby-2.3.0/bin
/Users/Enno/.rvm/gems/ruby-2.2.4/bin
/Users/Enno/.rvm/gems/ruby-2.2.4@global/bin
/Users/Enno/.rvm/rubies/ruby-2.2.4/bin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/Users/Enno/.rvm/bin

SublimeLinter: ENV['GEM_HOME'] = '/Users/Enno/.rvm/gems/ruby-2.2.4' 
SublimeLinter: rubocop version query: /Users/Enno/.rvm/bin/rvm-auto-ruby -S rubocop --version 
SublimeLinter: rubocop version: 2.2.4 
SublimeLinter: rubocop: (>= 0.34.0) satisfied by 2.2.4 
SublimeLinter: rubocop activated: ['/Users/Enno/.rvm/bin/rvm-auto-ruby'] 
Emmet: No need to update PyV8
SublimeLinter: rubocop: boot.rb ['ruby', '-S', 'rubocop', '--format', 'emacs', '--stdin', '/Users/Enno/Sites/pictrs/master/pictrs/config/boot.rb'] 
SublimeLinter: rubocop output:
/Users/Enno/.rvm/rubies/ruby-2.2.4/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'rubocop' (>= 0.a) among 28 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/Enno/.gem/ruby/2.2.0:/Users/Enno/.rvm/rubies/ruby-2.2.4/lib/ruby/gems/2.2.0:/Users/Enno/.rvm/gems/ruby-2.2.4', execute `gem env` for more information
    from /Users/Enno/.rvm/rubies/ruby-2.2.4/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec'
    from /Users/Enno/.rvm/rubies/ruby-2.2.4/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
    from /Users/Enno/.rvm/gems/ruby-2.3.0/bin/rubocop:22:in `<main>' 

SublimeLinter manages to augment the path correctly (/Users/Enno/.rvm/gems/ruby-2.3.0/bin is at the top), but fails to fetch the correct $GEM_HOME (/Users/Enno/.rvm/gems/ruby-2.2.4 instead of /Users/Enno/.rvm/gems/ruby-2.3.0).

This leads to the version query delivering weird results (2.2.4 instead of 0.39.0). Also dependencies can’t be resolved correctly. SublimeLinter finds the correct binary due to the correct path, but will look for dependencies in the wrong $GEM_HOME.

Any chance of fixing this behavior?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 21 (6 by maintainers)

Most upvoted comments

Thanks, seems clear enough. I think we may need to apply some serious scrubbing to the base ruby linter…

We have been making many changes to SublimeLinter, some of which also should have fixed this particular problem. It would be really nice if you could try the beta and let us know if that fixes the problem for you.

Any news on that? Can someone acknowledge this officially please?

UPDATE:

I fixed my issue and of course right after posting that. The issue was that although I added a bunch of bin paths to the SublimeLinter.sublime-settings, I didn’t add the specific one that the Sublime was reading off of. After using the which command, outlined in the link below, and adding that specific path, it works.

http://sublimelinter.readthedocs.io/en/latest/troubleshooting.html#finding-a-linter-executable