ianhattendorf / autocomplete-ruby

Provides intelligent code completion for Ruby in the Atom editor. Requires RSense.
MIT License
51 stars 9 forks source link

Fix default rsense path #14

Closed danielbayley closed 7 years ago

danielbayley commented 7 years ago

Use GEM_HOME if it exists.

Signed-off-by: Daniel Bayley daniel.bayley@me.com

ianhattendorf commented 7 years ago

Thank you for the PR, this should help with #12.

I'm wondering if it might be a good idea to use the output from gem environment gemhome (or gem environment gempath, but then we'd have to parse and append /bin to each path) as well? On my machine, I get /usr/lib/ruby/gems/2.3.0 for gemdir and /home/ian/.gem/ruby/2.3.0:/usr/lib/ruby/gems/2.3.0 for gempath. Rsense for me is in /home/ian/.gem/ruby/2.3.0.

Either way, could you add something to the readme telling users to ensure either their GEM_HOME is set correctly (is this done by tools like rvm?) or that they've set their correct path in the settings?

danielbayley commented 7 years ago

This PR doesn't touch the previous behaviour if the user hasn't explicitly set GEM_HOME (in which case that is where gems will be installed anyway). Using gem env home might be the best option though now you mention it…

I think tools like rvm do set GEM_HOME as far as I know, but I don't use them.

I'm not sure about needing to document this (especially if using gem env home) as it should just work.

Default macOS/X Ruby env is:

> gem env home
/Library/Ruby/Gems/2.0.0
> gem env path
~/.gem/ruby/2.0.0:/Library/Ruby/Gems/2.0.0:/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0

Although personally, I set GEM_HOME to /usr/local/lib/ruby to avoid problems with sudo and avoid dumping yet more crap in my HOME folder…

There are also PATH and which rsense approaches just to make it even more complex…

ianhattendorf commented 7 years ago

OK sounds good, I'll go ahead and merge this now and release later today.