Rails 3.2.2、Ruby 1.9.3 アプリを Capistrano と共に Linux サーバーにデプロイしています。を実行するcap deploy
と、次のエラーが表示されます。
* executing `deploy:assets:precompile'
* executing "cd /var/www/production/releases/20120418090209 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
servers: ["example.com"]
[example.com] executing command
[example.com] sh -c 'cd /var/www/production/releases/20120418090209 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile'
** [out :: example.com] rake aborted!
** [out :: example.com] cannot load such file -- ruby-debug
** [out :: example.com]
** [out :: example.com] (See full trace by running task with --trace)
command finished in 8962ms
*** [deploy:update_code] rolling back
* executing "rm -rf /var/www/production/releases/20120418090209; true"
servers: ["example.com"]
[example.com] executing command
[example.com] sh -c 'rm -rf /var/www/production/releases/20120418090209; true'
command finished in 176ms
failed: "sh -c 'cd /var/www/production/releases/20120418090209 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile'" on example.com
それは、ruby-debug
宝石が見つからなかったと言います。しかし、ruby-debug は私の Gemfile の production グループ内にありません:
group :development, :test do
gem "steak"
gem "linecache19", :git => "git://github.com/mark-moseley/linecache", :require => "ruby-debug"
gem "ruby-debug-base19x", "~> 0.11.30.pre4"
gem "ruby-debug19"
gem "rails_best_practices"
gem "ruby_parser"
gem "reek"
gem "flog"
gem "jslint_on_rails", :git => "git://github.com/psionides/jslint_on_rails"
gem "jasmine-rails"
end
rake assets:precompile
コマンドの後にエラーがスローされる原因は、 Capistrano とload 'deploy/assets'
Capfile 内の呼び出しに関係があると思います。
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['config/deploy/recipes/*.rb','vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks
# Uncomment if you are using Rails' asset pipeline
load 'deploy/assets'
この行を削除すると、すべて正常にデプロイされますが、(もちろん) アセットは本番環境では見つかりません。bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile
また、サーバー上 (アプリ ディレクトリ内) で直接実行すると、同じエラーが発生します。
それで、私は何をすべきですか?