capistrano 部署 - 基本命令失败

Posted

技术标签:

【中文标题】capistrano 部署 - 基本命令失败【英文标题】:capistrano deployment - basic commands fail 【发布时间】:2012-11-25 17:31:22 【问题描述】:

我正在尝试关注this guide 在 ubuntu (12.10) 上设置一个带有 nginx、unicorn 和 capistrano 的 rails 堆栈。我决定使用 RVM 进行 ruby​​ 安装。

到目前为止我安装了什么:

所有依赖库(imagemagick、git、mysql-server 等) nginx (1.2.1) rvm (1.17) 和 ruby​​ (1.9.2) 宝石:rails (3.1.6)、unicorn (4.4.0)、capistrano (2.13.5)、...

在本地,我进入

$ capify .

有效(在顶部提到的部署指南中,在第 8 页)

但我被困在下一部分“cap deploy:setup”(在指南上,第 12 页):

$ cap deploy:setup
/Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/gems/capistrano-2.13.5/lib/capistrano/configuration/variables.rb:26:in `set': you must specify exactly one of either a value or a block (ArgumentError)
  from ./config/deploy.rb:4:in `load'
  from /Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/gems/capistrano-2.13.5/lib/capistrano/configuration/loading.rb:93:in `instance_eval'
  from /Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/gems/capistrano-2.13.5/lib/capistrano/configuration/loading.rb:93:in `load'
  from /Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/gems/capistrano-2.13.5/lib/capistrano/configuration/loading.rb:172:in `load_from_file'
  from /Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/gems/capistrano-2.13.5/lib/capistrano/configuration/loading.rb:89:in `load'
  from /Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/gems/capistrano-2.13.5/lib/capistrano/configuration/loading.rb:86:in `block in load'
  from /Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/gems/capistrano-2.13.5/lib/capistrano/configuration/loading.rb:86:in `each'
  from /Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/gems/capistrano-2.13.5/lib/capistrano/configuration/loading.rb:86:in `load'
  from Capfile:4:in `load'
  from /Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/gems/capistrano-2.13.5/lib/capistrano/configuration/loading.rb:93:in `instance_eval'
  from /Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/gems/capistrano-2.13.5/lib/capistrano/configuration/loading.rb:93:in `load'
  from /Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/gems/capistrano-2.13.5/lib/capistrano/configuration/loading.rb:172:in `load_from_file'
  from /Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/gems/capistrano-2.13.5/lib/capistrano/configuration/loading.rb:89:in `load'
  from /Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/gems/capistrano-2.13.5/lib/capistrano/configuration/loading.rb:86:in `block in load'
  from /Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/gems/capistrano-2.13.5/lib/capistrano/configuration/loading.rb:86:in `each'
  from /Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/gems/capistrano-2.13.5/lib/capistrano/configuration/loading.rb:86:in `load'
  from /Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/gems/capistrano-2.13.5/lib/capistrano/cli/execute.rb:65:in `block in load_recipes'
  from /Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/gems/capistrano-2.13.5/lib/capistrano/cli/execute.rb:65:in `each'
  from /Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/gems/capistrano-2.13.5/lib/capistrano/cli/execute.rb:65:in `load_recipes'
  from /Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/gems/capistrano-2.13.5/lib/capistrano/cli/execute.rb:31:in `execute!'
  from /Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/gems/capistrano-2.13.5/lib/capistrano/cli/execute.rb:14:in `execute'
  from /Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/gems/capistrano-2.13.5/bin/cap:4:in `<top (required)>'
  from /Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/bin/cap:19:in `load'
  from /Users/chuck/.rvm/gems/ruby-1.9.2-p290@shop/bin/cap:19:in `<main>'

而且它似乎并不依赖于 deploy:setup。

我随机尝试了一些其他 capistrano 命令,但总是收到相同的错误消息“您必须准确指定值或块之一 (ArgumentError)”

有什么想法吗?

【问题讨论】:

【参考方案1】:

固定。

这是一个愚蠢的错误,我在 deploy.rb 中有两次 'set :scm, :git'。

【讨论】:

以上是关于capistrano 部署 - 基本命令失败的主要内容,如果未能解决你的问题,请参考以下文章

Rails 3 -- Bundler/Capistrano 错误

我更改存储库 URL 后 Capistrano 部署失败

由于Composer,Capistrano部署中止

Capistrano 和几个 SSH 密钥

使用资产前缀时,由于缺少清单文件,Capistrano部署失败

Git之基本命令