title: Switching ruby version to run a command on server
body: <p>I have a Ruby application (non-Rails) which I deploy with capistrano. I can ssh into my server, <code>cd</code> into the <code>/current</code> directory and start it with the command</p>
  
  <pre><code>ruby tweet_tracker.rb start
  </code></pre>
  
  <p>However, if I cd up a level and run</p>
  
  <pre><code>ruby current/tweet_tracker.rb start
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>/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 `&lt;main&gt;'
  </code></pre>
  
  <p>Now this is obviously because I'm running the command using different ruby versions in each directory.</p>
  
  <p>I have a <code>.ruby-version</code> file in the application which specifies <code>ruby-1.9.3-p392</code>. My capistrano deploy script specifies <code>set :rvm_ruby_string, '1.9.3-p392'</code> and when it runs <code>bundle install</code> as part of the deploy process, it installs the gems for 193-p392.</p>
  
  <p>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).</p>
  
  <p>How do I ensure that the application uses the Ruby version specified by it's <code>.ruby-version</code> when run?</p>
  
  <p>I'd rather not change RVM's default Ruby version since there are other applications running on the system.</p>