Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

How to make it work with RVM #98

Closed
andyentity opened this issue Jan 18, 2016 · 10 comments
Closed

How to make it work with RVM #98

andyentity opened this issue Jan 18, 2016 · 10 comments
Labels

Comments

@andyentity
Copy link

I provided the full correct path to rubocop in the configuration and now I am getting the following error:

Error: /usr/bin/env: ruby_executable_hooks: No such file or directory

This is probably because I am using RVM. If I want to use ruby in the shell,
source ~/.rvm/scripts/rvm has to be evaluated first. The script is setting all the environment variables and stuff that are needed for the shell to find everything.

How can I tell linter-rubocop (or Atom) to do this?

@Arcanemagus
Copy link
Member

You will need to create a rvm wrapper script and set that to the executable path in Atom.

@andyentity
Copy link
Author

Thanks! However, now I'm getting the following error:

Error: invalid option: --cache
/home/andy/.rvm/gems/ruby-2.2.1/gems/rubocop-0.31.0/lib/rubocop/options.rb:68:in `parse'
/home/andy/.rvm/gems/ruby-2.2.1/gems/rubocop-0.31.0/lib/rubocop/cli.rb:21:in `run'
/home/andy/.rvm/gems/ruby-2.2.1/gems/rubocop-0.31.0/bin/rubocop:13:in `block in <top (required)>'
/home/andy/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/benchmark.rb:303:in `realtime'
/home/andy/.rvm/gems/ruby-2.2.1/gems/rubocop-0.31.0/bin/rubocop:12:in `<top (required)>'
/home/andy/.rvm/gems/ruby-2.2.1/bin/rubocop:23:in `load'
/home/andy/.rvm/gems/ruby-2.2.1/bin/rubocop:23:in `<main>'
/home/andy/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
/home/andy/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'
    at /home/andy/.atom/packages/linter-rubocop/index.coffee:30:15

The wrapper script itself is working fine, I can use rubocop without source-ing in my bash.

@whoward
Copy link

whoward commented Jan 20, 2016

@andyentity you may have a better time installing it to your system ruby, it should be on your PATH so you shouldn't need to do any configuration and you won't have to remember the syntax for regenerating the wrapper script every time you update rubocop

@Arcanemagus what do you think about doing something like injecting the project folder path into the configuration variable and then using binstubs? Example:
#{projectDirectory}/bin/rubocop or #{projectDirectory}/bin/bundle exec rubocop

I'm asking mostly because I tend to have multiple projects that run with multiple versions of rubocop (some of which are out of my direct control) and this might be a smarter way to tackle this problem. Is that a crazy idea?

@caseywebdev
Copy link
Contributor

@andyentity You'll need to upgrade rubocop. The version you're using isn't supported.

@Arcanemagus
Copy link
Member

@whoward Are you talking about something like what linter-pylint does?

@whoward
Copy link

whoward commented Jan 20, 2016

@Arcanemagus i don't use that one but from the docs yeah the %p option sounds like the idea i'm talking about

@andyentity
Copy link
Author

The wrapper script is competely sufficient for my needs.
Upgrading to the lastest rubocop version did the trick. Everything is working! Thanks a lot.

@Arcanemagus
Copy link
Member

@whoward If you could file an issue to track implementing that, that would be great 😉.

@andyentity glad to hear it 😄. (Marked invalid as this was a configuration issue, not a bug in linter-rubocop.)

@whoward
Copy link

whoward commented Jan 22, 2016

@Arcanemagus no problem - see #100

@kdiogenes
Copy link

Using 000-project-shell-env you don't need to specify a path. You can just use linter-rubocop defaults.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants