Capistrano未定义局部变量或方法和参数错误

时间:2015-09-02 14:28:52

标签: ruby-on-rails capistrano rubber

尝试运行cap deploy:check我收到此错误:

(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host #<SSHKit::Host:0x007fc04888dcf8>: undefined local variable or method `rubber_env' for #<SSHKit::Backend::Netssh:0x007fc04888d050>

NameError: undefined local variable or method `rubber_env' for #<SSHKit::Backend::Netssh:0x007fc04888d050>

(See full trace by running task with --trace)

Capfile

gemfile = File.expand_path(File.join(__FILE__, '..', 'Gemfile'))
if File.exist?(gemfile) && ENV['BUNDLE_GEMFILE'].nil?
  puts "Respawning with 'bundle exec'"
  exec("bundle", "exec", "cap", *ARGV)
end

load 'deploy' if respond_to?(:namespace) # cap2 differentiator

env = ENV['RUBBER_ENV'] ||= (ENV['RAILS_ENV'] || 'production')
root = File.dirname(__FILE__)

# this tries first as a rails plugin then as a gem
$:.unshift "#{root}/vendor/plugins/rubber/lib/"
require 'rubber'

Rubber::initialize(root, env)
require 'capistrano'

require 'capistrano-passenger'
require 'bundler'
require 'rails'

Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy.rb'

我认为我通过将set :rubber_env放在deploy.rb中解决了问题,但现在我收到此错误

cap aborted!
ArgumentError: wrong number of arguments (1 for 2)
/Users/user1/app1/Capfile:24:in `load'
/Users/user1/app1/Capfile:24:in `<top (required)>'

0 个答案:

没有答案