我正在尝试将多阶段capistrano部署到我的生产和登台服务器。这是我的deploy.rb
文件(省略了scm详细信息):
require 'bundler/capistrano'
require 'whenever/capistrano'
set :application, "myapp"
set :stages, %w{staging, production}
set :default_stage, "staging"
require 'capistrano/ext/multistage'
set :deploy_to, "/webapps/myapp"
set(:domain) { "#{domain}" }
role(:web) { domain }
role(:app) { domain }
role(:db, :primary => true) { domain }
default_run_options[:pty] = true
namespace :one do
task :foo do
puts "foo"
end
end
在config/deploy/production.rb
:
set :domain, "production.com"
set :user, "prod"
config/deploy/staging.rb
:
set :domain, "shootsystage.com"
set :user, "stage"
没什么太奇特的了(我想)。运行cap production one:foo
运行正常。但是运行cap staging one:foo
会导致:
the task `staging' does not exist
发生了什么事?
答案 0 :(得分:11)
在屁股上看起来像一小段语法。它应该是:
set :stages, %w{staging production}
请注意%w{}
中缺少逗号。 Ffffuuuuuuuuuuu ...