Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Extract branch confirmation code into a gem

  • Loading branch information...
commit bd9038fb44f47ece87c2291ae8f4b6fbc174212c 1 parent c4ee0a3
@jordanbyron jordanbyron authored
Showing with 5 additions and 33 deletions.
  1. +1 −0  Gemfile
  2. +3 −0  Gemfile.lock
  3. +1 −33 config/deploy.rb
View
1  Gemfile
@@ -31,6 +31,7 @@ gem 'delayed_job_active_record'
gem 'daemons', :require => false
gem 'capistrano'
+gem 'capistrano_confirm_branch'
gem 'whenever'
group :assets do
View
3  Gemfile.lock
@@ -40,6 +40,8 @@ GEM
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
+ capistrano_confirm_branch (0.0.1)
+ capistrano
capybara (1.1.1)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
@@ -247,6 +249,7 @@ PLATFORMS
DEPENDENCIES
albino
capistrano
+ capistrano_confirm_branch
capybara
capybara-screenshot
capybara-webkit (= 0.10.1)
View
34 config/deploy.rb
@@ -3,6 +3,7 @@
require 'capistrano/ext/multistage'
require 'bundler/capistrano'
+require 'capistrano/confirm_branch'
set :application, "practicing-ruby"
set :repository, "git@github.com:elm-city-craftworks/practicing-ruby-web.git"
@@ -32,44 +33,11 @@
end
end
-before "deploy:update_code", "deploy:confirm"
after "deploy", "deploy:migrate"
after "deploy", "deploy:cleanup"
-after "deploy", "deploy:update_current_branch"
load 'deploy/assets'
-namespace :deploy do
- desc 'Confirms deployment when switching deployed branches'
- task :confirm do
- deployed_branch = nil
- pending_deploy_branch = fetch(:branch)
-
- run %{cat #{shared_path}/current_branch} do |ch, stream, out|
- deployed_branch = out.strip
- end
-
- if deployed_branch != pending_deploy_branch
- Capistrano::CLI.ui.say %{
- ============ Changing deployed branches ============
- Deployed Branch: #{deployed_branch}
- Pending Deploy Branch: #{pending_deploy_branch}
- ====================================================
-
- }
-
- abort unless Capistrano::CLI.ui.agree(
- "Do you wish to continue deploying #{pending_deploy_branch}?"
- )
- end
- end
-
- desc 'Updates the file which tracks the currently deployed branch'
- task :update_current_branch do
- run %{echo "#{fetch(:branch)}" > #{shared_path}/current_branch}
- end
-end
-
desc "Import articles, volumes, and collections from the server"
namespace :import do
task :articles do
Please sign in to comment.
Something went wrong with that request. Please try again.