capistrano support: rake variable not updated to use bundle exec #894

Closed
gabetax opened this Issue Dec 7, 2010 · 2 comments

2 participants

@gabetax

Following the capistrano documentation on http://gembundler.com/deploying.html, the "rake" command is not updated to be called via bundle exec. The result is that commands using rake, such as deploy:migrate, can encounter loading conflicts:

$ cap deploy:migrate
  * executing `deploy:migrate'
  * executing "ls -x /webapps/rails/projects.example.com/releases"
    servers: ["samplehost.example.com"]
    [samplehost.example.com] executing command
    command finished
latest => /webapps/rails/projects.example.com/releases/20101207190334
  * executing "cd /webapps/rails/projects.example.com/releases/20101207190334; rake RAILS_ENV=production  db:migrate"
    servers: ["samplehost.example.com"]
    [samplehost.example.com] executing command
*** [err :: samplehost.example.com] rake aborted!
*** [err :: samplehost.example.com] You have already activated rake 0.8.4, but your Gemfile requires rake 0.8.7. Consider using bundle exec.
*** [err :: samplehost.example.com] /webapps/rails/projects.example.com/releases/20101207190334/Rakefile:4
*** [err :: samplehost.example.com] (See full trace by running task with --trace)
 ** [out :: samplehost.example.com] (in /webapps/rails/projects.example.com/releases/20101207190334)
    command finished
failed: "sh -c 'cd /webapps/rails/projects.example.com/releases/20101207190334; rake RAILS_ENV=production  db:migrate'" on samplehost.example.com

(on this specific example, I'm deploying a Rails 2.3.10 app; I haven't tested a Rails 3 app)

An easy solution is to override the default rake variable in the config/deploy.rb file:
set :rake, 'bundle exec rake'

I think the documentation on http://gembundler.com/deploying.html should be updated to reflect this, or the bundler/capistrano.rb file should make some effort to over-ride this itself.

@indirect
Bundler member

Yeah, that seems like a good idea. Thanks!

@indirect
Bundler member

tell capistrano to run "bundle exec rake"

closed by e0ec73b

@leobessa leobessa pushed a commit that referenced this issue Apr 18, 2011
@indirect indirect tell capistrano to run "bundle exec rake"
closes #894
e0ec73b
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment