# ============================================================================= # A set of rake tasks for invoking the SwitchTower automation utility. # ============================================================================= desc "Figure out the correct switchtower to call based on platform" task :switchtower_command do if File::ALT_SEPARATOR ENV["switchtower_app"] = "switchtower.cmd" else ENV["switchtower_app"] = "switchtower" end end desc "Push the latest revision into production using the release manager" task :deploy => [:switchtower_command] do system "#{ENV["switchtower_app"]} -vvvv -r config/deploy -a deploy" end desc "Rollback to the release before the current release in production" task :rollback => [:switchtower_command] do system "#{ENV["switchtower_app"]} -vvvv -r config/deploy -a rollback" end desc "Describe the differences between HEAD and the last production release" task :diff_from_last_deploy => [:switchtower_command] do system "#{ENV["switchtower_app"]} -vvvv -r config/deploy -a diff_from_last_deploy" end desc "Enumerate all available deployment tasks" task :show_deploy_tasks => [:switchtower_command] do system "#{ENV["switchtower_app"]} -r config/deploy -a show_tasks" end desc "Execute a specific action using the release manager" task :remote_exec => [:switchtower_command] do unless ENV['ACTION'] 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 "#{ENV["switchtower_app"]} -vvvv -r config/deploy #{actions}" end