2

通过 capistrano 部署 Rails 应用程序时,出现以下错误:

[example.com] executing command
 ** [out :: example.com] /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find bundler (>= 0) amongst [] (Gem::LoadError)
 ** [out :: example.com] from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
 ** [out :: example.com] from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
 ** [out :: example.com] from /usr/local/bin/bundle:22:in `<main>'
    command finished in 181ms

我已将 ruby​​ 安装到 /usr/local,我没有使用 RVM 之类的东西。这是我的 deploy.rb:

 require 'bundler/capistrano'
load 'deploy/assets'

set :default_environment, {
  'PATH' => "/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:$PATH",
  "RUBY_VERSION" => "ruby 1.9.3",
  "GEM_HOME" => "/usr/local/lib/ruby/gems/1.9.1/gems",
  "GEM_PATH" => "/usr/local/lib/ruby/gems/1.9.1/gems",
  "BUNDLE_PATH" => "/usr/local/lib/ruby/gems/1.9.1/gems"
}

set :application, "appname"
set :repository, "git@github.com/something.git"
set :user, "thebestuserever"
set :scm_username, "somegithubaccount"
set :use_sudo, true
set :branch, "master"
ssh_options[:forward_agent] = true
default_run_options[:pty] = true

set :scm, :git
set :deploy_to, "/application/path"

role :web, "example.com"
role :app, "example.com"
role :db, "example.com", :primary => true

namespace :deploy do
  desc "Restarting mod_rails with restart.txt"
  task :restart, :roles => :app, :except => { :no_release => true } do
      run "touch #{current_path}/tmp/restart.txt"
  end

  [:start, :stop].each do |t|
      desc "#{t} task is a no-op with mod_rails"
      task t, :roles => :domain do ; end
  end
end

task :after_update_code do  
  run "ln -nfs #{deploy_to}/shared/config/database.yml #{release_path}/config/database.yml"
  run "cd #{release_path}; rake assets:precompile RAILS_ENV=production "
  run "cd #{release_path}; ./script/delayed_job restart"
end

我确定我只是在这里遗漏了一些简单的东西。但我似乎无法找到它。

4

1 回答 1

3

我删除了set :default_environment通话。我在一个较旧的脚本中使用了它,我认为它主要用于 RVM 而不是系统安装。摆脱它修复了它。所以我猜这条路不知何故搞砸了。

于 2013-01-24T20:47:00.427 回答