title: capistrano with chruby looks for bundler in wrong ruby
body: <p>I am trying to get a deploy working with capistrano 3 on a new server and ruby version managed by chruby.</p>
  
  <p>All the tests specified in <a href="http://capistranorb.com/documentation/getting-started/cold-start/" rel="nofollow">the capistrano docs</a> work fine.</p>
  
  <p>When I try to do a deploy it appears to be trying to find bundler in the system ruby rather than the chruby version that is specified in the deploy.rb with</p>
  
  <pre><code>set :chruby_ruby, 'ruby-2.1.2'
  </code></pre>
  
  <p>I have installed ruby 2.1.2 with ruby-install on the server and if I log in as the deploy user it apears to be using the correct ruby</p>
  
  <pre><code>deploy@server:~$ ruby -v
  ruby 2.1.2p95 (2014-05-08 revision 45877) [i686-linux]
  </code></pre>
  
  <p>The error from the deploy is</p>
  
  <pre><code>INFO[8ec8ed42] Running /usr/local/bin/chruby-exec ruby-2.1.2 -- bundle install --binstubs /var/www/oentry/shared/bin --path /var/www/oentry/shared/bundle --without development test --deployment --quiet on 103.6.213.27
  DEBUG[8ec8ed42] Command: cd /var/www/oentry/releases/20140810095255 &amp;&amp; /usr/local/bin/chruby-exec ruby-2.1.2 -- bundle install --binstubs /var/www/oentry/shared/bin --path /var/www/oentry/shared/bundle --without development test --deployment --quiet
  DEBUG[8ec8ed42]     chruby: unknown Ruby: ruby-1.9.3-p392
  DEBUG[8ec8ed42]     /usr/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find bundler (&gt;= 0) amongst [] (Gem::LoadError
  DEBUG[8ec8ed42]     )
  DEBUG[8ec8ed42]         from /usr/lib/ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
  DEBUG[8ec8ed42]         from /usr/lib/ruby/1.9.1/rubygems.rb:1231:in `gem'
  DEBUG[8ec8ed42]         from /usr/local/bin/bundle:22:in `&lt;main&gt;'
  cap aborted!
  </code></pre>
  
  <p>deploy.rb (everything below this is default)</p>
  
  <pre><code>lock '3.2.1'
  
  set :application, 'oentry'
  set :repo_url, 'git@1nnn.nnn.nnn.nnn:/opt/git/oentry.git'
  set :chruby_ruby, 'ruby-2.1.2'
  </code></pre>
  
  <p>production.rb (everything below is default)</p>
  
  <pre><code>role :app, %w{deploy@nnn.nn.nnn.nnn}
  role :web, %w{deploy@nnn.nn.nnn.nnn}
  role :db,  %w{deploy@nnn.nn.nnn.nnn}
  </code></pre>
  
  <p>capfile</p>
  
  <pre><code># Load DSL and Setup Up Stages
  require 'capistrano/setup'
  
  # Includes default deployment tasks
  require 'capistrano/deploy'
  
  # Includes tasks from other gems included in your Gemfile
  #
  # For documentation on these, see for example:
  #
  #   https://github.com/capistrano/rvm
  #   https://github.com/capistrano/rbenv
  #   https://github.com/capistrano/chruby
  #   https://github.com/capistrano/bundler
  #   https://github.com/capistrano/rails
  #
  # require 'capistrano/rvm'
  # require 'capistrano/rbenv'
  require 'capistrano/chruby'
  require 'capistrano/bundler'
  require 'capistrano/rails/assets'
  require 'capistrano/rails/migrations'
  
  # Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
  Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
  </code></pre>
  
  <p>UPDATE.</p>
  
  <p>doing a gem install bundler on the server in the 2.1.2 environment seems to make it work but I still get the following disconcerting message in the output</p>
  
  <pre><code>DEBUG[1b6631e7]     chruby: unknown Ruby: ruby-1.9.3-p392
  </code></pre>