mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
switchtower: the rails rake tasks now load ST directly, instead of invoking it via system
git-svn-id: http://svn.rubyonrails.org/rails/tools/switchtower@3336 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
0e6ca2082e
commit
fdcb4e362f
3 changed files with 24 additions and 7 deletions
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* The Rails rake tasks now load ST directly, instead of invoking it via system
|
||||
|
||||
* Added ssh_options variable to configure the SSH connection parameters #2734 [jerrett@bravenet.com]
|
||||
|
||||
* Require Net::SSH 1.0.3
|
||||
|
|
|
@ -120,7 +120,7 @@ module SwitchTower
|
|||
end
|
||||
|
||||
opts.separator ""
|
||||
opts.separator <<DETAIL.split(/\n/)
|
||||
opts.separator <<-DETAIL.split(/\n/)
|
||||
You can use the --apply-to switch to generate a minimal set of switchtower
|
||||
scripts and recipes for an application. Just specify the path to the application
|
||||
as the argument to --apply-to, like this:
|
||||
|
|
|
@ -2,24 +2,39 @@
|
|||
# A set of rake tasks for invoking the SwitchTower automation utility.
|
||||
# =============================================================================
|
||||
|
||||
# Invoke the given actions via SwitchTower
|
||||
def switchtower_invoke(*actions)
|
||||
begin
|
||||
require 'rubygems'
|
||||
rescue LoadError
|
||||
# no rubygems to load, so we fail silently
|
||||
end
|
||||
|
||||
require 'switchtower/cli'
|
||||
|
||||
args = %w[-vvvvv -r config/<%= recipe_file %>]
|
||||
args.concat(actions.map { |act| ["-a", act.to_s] }.flatten)
|
||||
SwitchTower::CLI.new(args).execute!
|
||||
end
|
||||
|
||||
desc "Push the latest revision into production using the release manager"
|
||||
task :deploy do
|
||||
system "switchtower -vvvv -r config/<%= recipe_file %> -a deploy"
|
||||
switchtower_invoke :deploy
|
||||
end
|
||||
|
||||
desc "Rollback to the release before the current release in production"
|
||||
task :rollback do
|
||||
system "switchtower -vvvv -r config/<%= recipe_file %> -a rollback"
|
||||
switchtower_invoke :rollback
|
||||
end
|
||||
|
||||
desc "Describe the differences between HEAD and the last production release"
|
||||
task :diff_from_last_deploy do
|
||||
system "switchtower -vvvv -r config/<%= recipe_file %> -a diff_from_last_deploy"
|
||||
switchtower_invoke :diff_from_last_deploy
|
||||
end
|
||||
|
||||
desc "Enumerate all available deployment tasks"
|
||||
task :show_deploy_tasks do
|
||||
system "switchtower -r config/<%= recipe_file %> -a show_tasks"
|
||||
switchtower_invoke :show_tasks
|
||||
end
|
||||
|
||||
desc "Execute a specific action using the release manager"
|
||||
|
@ -28,6 +43,6 @@ task :remote_exec do
|
|||
raise "Please specify an action (or comma separated list of actions) via the ACTION environment variable"
|
||||
end
|
||||
|
||||
actions = ENV['ACTION'].split(",").map { |a| "-a #{a}" }.join(" ")
|
||||
system "switchtower -vvvv -r config/<%= recipe_file %> #{actions}"
|
||||
actions = ENV['ACTION'].split(",")
|
||||
switchtower_invoke(*actions)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue