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

chruby: unknown Ruby: ruby-2.2.0 #315

Closed
dt1973 opened this issue Jan 21, 2015 · 7 comments
Closed

chruby: unknown Ruby: ruby-2.2.0 #315

dt1973 opened this issue Jan 21, 2015 · 7 comments

Comments

@dt1973
Copy link

dt1973 commented Jan 21, 2015

Why won't ruby-2.2.0 in .ruby-version work, whereas chruby ruby-2.2.0 will?

% whoami
whoareyou
% sudo su myapp
% cd /home/www/myapp/
% whoami
chruby: unknown Ruby: ruby-2.2.0
myapp
% cat .ruby-version
ruby-2.2.0
% which ruby
/usr/local/bin/ruby
% chruby ruby-2.2.0
% which ruby
/home/www/myapp/.rubies/ruby-2.2.0/bin/ruby 

Full transcript of deployment:

https://gist.github.com/dt1973/7b99dfb75bd26e1e5ed7

@postmodern
Copy link
Owner

Is /home/www/myapp/ the $HOME and did you check echo ${RUBIES[@]}? Also, it is far simpler to not use chruby in production, but instead install ruby via brightbox or into /usr/local via ruby-install.

@dt1973
Copy link
Author

dt1973 commented Jan 28, 2015

Yup:

% env
HOME=/home/www/myapp
% echo ${RUBIES[@]}
/home/www/myapp/.rubies/ruby-2.2.0

Basically I'm using chruby because installing Ruby locally seems to be the only way I can use my Rails app without Bundler, Rake etc. complaining about the lack of /usr/local permissions.

@postmodern
Copy link
Owner

@dt1973 that is what bundle install --deployment is for. It will install all gems into $app/vendor/gems/.

Double check your shell configuration. I'm guessing you're loading chruby only for interactive shells, but not for uninteractive shells.

@dt1973
Copy link
Author

dt1973 commented Jan 29, 2015

I was under the impression that bundle install --deployment was to be avoided due to the whole:

You are trying to install in deployment mode after changing your Gemfile. Run bundle install elsewhere and add the updated Gemfile.lock to version control.

thing. Came across http://stackoverflow.com/questions/6785626/unable-to-update-gems-on-production-server with no real solution, just a quick fix:

bundle install --no-deployment && bundle update && bundle install --deployment

@postmodern
Copy link
Owner

--deployment is designed for production and when you have a committed Gemfile.lock. It also does not require sudo access, which is a must for production.

@dt1973
Copy link
Author

dt1973 commented Feb 5, 2015

Cool, fair enough. Thanks man!

Close it if you wish.

@postmodern
Copy link
Owner

Closing for now, but I suspect there might be whitespace in .ruby-version. Try running hexdump -C .ruby-version.

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

2 participants