运行capistrano rails/assets时找不到sshkit



我正在尝试使用capistrano rails/assets来预编译我的资产,除了执行rake assets:precompile外,所有步骤都很顺利。

这是日志:

DEBUG [e7f96ad0] Command: /usr/bin/env ln -nfs /var/www/shop/shared/config/database.yml /var/www/shop/releases/20131206120246/config/database.yml
 INFO [e7f96ad0] Finished in 0.100 seconds with exit status 0 (successful).
 INFO Now edit the config files in /var/www/shop/shared.
DEBUG [80dae756] Running /usr/bin/env if test ! -d /var/www/shop/releases/20131206120246; then echo "Directory does not exist '/var/www/shop/releases/20131206120246'" 1>&2; false; fi on 127.0.0.1
DEBUG [80dae756] Command: if test ! -d /var/www/shop/releases/20131206120246; then echo "Directory does not exist '/var/www/shop/releases/20131206120246'" 1>&2; false; fi
DEBUG [80dae756] Finished in 0.205 seconds with exit status 0 (successful).
 INFO [07ed0947] Running /usr/bin/env rake assets:precompile on 127.0.0.1
DEBUG [07ed0947] Command: cd /var/www/shop/releases/20131206120246 && ( RAILS_ENV=development /usr/bin/env rake assets:precompile )
DEBUG [07ed0947]    rake aborted!
DEBUG [07ed0947]    Could not find sshkit-1.2.0 in any of the sources
DEBUG [07ed0947]    /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler/spec_set.rb:92:in `block in materialize'
DEBUG [07ed0947]    /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler/spec_set.rb:85:in `map!'
DEBUG [07ed0947]    /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler/spec_set.rb:85:in `materialize'
DEBUG [07ed0947]    /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler/definition.rb:114:in `specs'
DEBUG [07ed0947]    /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler/definition.rb:159:in `specs_for'
DEBUG [07ed0947]    /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler/definition.rb:148:in `requested_specs'
DEBUG [07ed0947]    /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler/environment.rb:18:in `requested_specs'
DEBUG [07ed0947]    /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:13:in `setup'
DEBUG [07ed0947]    /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler.rb:120:in `setup'
DEBUG [07ed0947]    /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler/setup.rb:17:in `<top (required)>'
DEBUG [07ed0947]    /var/www/shop/releases/20131206120246/config/boot.rb:6:in `<top (required)>'
DEBUG [07ed0947]    /var/www/shop/releases/20131206120246/config/application.rb:1:in `<top (required)>'
DEBUG [07ed0947]    /var/www/shop/releases/20131206120246/Rakefile:5:in `<top (required)>'
DEBUG [07ed0947]    /usr/local/rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `eval'
DEBUG [07ed0947]    /usr/local/rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `<main>'
DEBUG [07ed0947]    (See full trace by running task with --trace)
cap aborted!
rake stdout: Nothing written
rake stderr: Nothing written
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.2.0/lib/sshkit/command.rb:94:in `exit_status='
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.2.0/lib/sshkit/backends/netssh.rb:138:in `block (4 levels) in _execute'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:551:in `call'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:551:in `do_request'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:561:in `channel_request'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:205:in `process'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:269:in `wait'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.2.0/lib/sshkit/backends/netssh.rb:160:in `block (2 levels) in _execute'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:514:in `call'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:205:in `process'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.2.0/lib/sshkit/backends/netssh.rb:162:in `block in _execute'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.2.0/lib/sshkit/backends/netssh.rb:119:in `tap'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.2.0/lib/sshkit/backends/netssh.rb:119:in `_execute'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.2.0/lib/sshkit/backends/netssh.rb:66:in `execute'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/capistrano-rails-1.1.0/lib/capistrano/tasks/assets.rake:63:in `block (6 levels) in <top (required)>'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.2.0/lib/sshkit/backends/abstract.rb:89:in `with'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/capistrano-rails-1.1.0/lib/capistrano/tasks/assets.rake:62:in `block (5 levels) in <top (required)>'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.2.0/lib/sshkit/backends/abstract.rb:81:in `within'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/capistrano-rails-1.1.0/lib/capistrano/tasks/assets.rake:61:in `block (4 levels) in <top (required)>'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.2.0/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.2.0/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/user/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.2.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => deploy:assets:precompile

如果我在服务器上运行相同的命令,我不会遇到任何问题:

vagrant@shop-berkshelf:/var/www/shop/current$ rake assets:precompile
/usr/local/rvm/rubies/ruby-2.0.0-p353/bin/ruby /usr/local/rvm/gems/ruby-2.0.0-p353/bin/rake assets:precompile:all RAILS_ENV=development RAILS_GROUPS=assets
vagrant@shop-berkshelf:/var/www/shop/current$

这是我的Capfile:

require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }

我的Gemfile包含:

gem 'capistrano'
gem 'capistrano-rails'

知道这里出了什么问题吗?

感谢

Bundler在运行资产之前没有执行,因此SSHKIT在盒子上不可用。

我添加到Gemfile:

gem 'capistrano-bundler'

以及到我未注释的Capfile:

require 'capistrano/bundler'

现在这个问题已经解决了。

谢谢。

最新更新