I have a Ruby application (non-Rails) which I deploy with capistrano. I can ssh into my server, cd
into the /current
directory and start it with the command
ruby tweet_tracker.rb start
However, if I cd up a level and run
ruby current/tweet_tracker.rb start
I get the error:
/home/deploy/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- tweetstream (LoadError)
from /home/deploy/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/deploy/dev/tweet_tracker/current/tweet_tracker.rb:4:in `<main>'
Now this is obviously because I'm running the command using different ruby versions in each directory.
I have a .ruby-version
file in the application which specifies ruby-1.9.3-p392
. My capistrano deploy script specifies set :rvm_ruby_string, '1.9.3-p392'
and when it runs bundle install
as part of the deploy process, it installs the gems for 193-p392.
Problem is, when I try to start the application from outside the application directory, it uses the default Ruby (set by RVM to be a lesser version of 193).
How do I ensure that the application uses the Ruby version specified by it's .ruby-version
when run?
I'd rather not change RVM's default Ruby version since there are other applications running on the system.