Capistrano部署的问题:迁移

时间:2011-03-16 13:30:05

标签: ruby-on-rails capistrano

尝试部署时出现以下错误:使用Capistrano迁移:

[err :: 127.0.0.1 ] /home/synapse/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:388:in `bin_path': can't find gem rake ([">= 0"]) with executable rake (Gem::GemNotFoundException)

之前我得到了rake not found'错误但是在我将“set:rake”添加到deploy.rb之后它就消失了。 Ruby是通过RVM安装的,当然安装了rake gem。

1 个答案:

答案 0 :(得分:4)

对于capistrano,您需要为rvm

添加扩展名
set :rvm_ruby, "ruby-1.9.2-p180"
set :rvm_gem_home, "#{fetch(:base_dir)}/.rvm/gems/#{fetch(:rvm_ruby)}"
set :rvm_ruby_path, "#{fetch(:base_dir)}/.rvm/rubies/#{fetch(:rvm_ruby)}"
set :default_environment, {
  'RUBY_VERSION' => fetch(:rvm_ruby),
  'GEM_HOME' => "#{fetch(:rvm_gem_home)}:#{fetch(:rvm_gem_home)}@global",
  'BUNDLE_PATH' => fetch(:rvm_gem_home),
  'PATH' => "#{fetch(:rvm_gem_home)}/bin:#{fetch(:rvm_gem_home)}@global/bin:#{fetch(:rvm_ruby_path)}/bin:/home/rails/.rvm/bin:$PATH;",
}