Capistrano + RVM + Rake task

2019-09-05 04:28发布

问题:

I have a project which

  1. uses rvm ruby 1.9.2 (set in .rvmrc in project dir).
  2. deploying with capistrano.
  3. has a rake task I want to run remotely from my local machine by capistrano.

I've created a .sh file to run my task:

cd /var/www/pluslook/current
/home/kirill/.rvm/scripts/rvm use 1.9.2@pluslook
/home/kirill/.rvm/gems/ruby-1.9.2-p180@pluslook/bin/rake parse:feed RAILS_ENV="production" --trace

But when I'm trying to run this task i have an error:

Using /home/kirill/.rvm/gems/ruby-1.9.2-p180 with gemset pluslook
Could not find linecache19-0.5.12 in any of the sources
Run `bundle install` to install missing gems.

I've installed all my gems in project's current directory so it looks like rake task is running from another directory. When I'm trying to run task from capistrano, It shows me the same error.

Thank you and sorry for my English:)

回答1:

  1. do you have 'require "bundler/capistrano"' in config/deploy.rb
  2. did you run "bundle install" before commit latest code changes?