我正在将带有Capistrano的Rails 3.2.2,Ruby 1.9.3应用程序部署到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中的生产组中:
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和我的Capfile中的load 'deploy/assets'
调用有关:
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
(在app目录内),我会得到同样的错误。
那我该怎么办?
答案 0 :(得分:1)
ruby-debug
已过时。在ruby> = 1.9中,你应该使用优秀的debugger
gem
请参阅:https://github.com/cldwalker/debugger和http://railscasts.com/episodes/54-debugging-ruby-revised