lib/alpha_omega/deploy.rb in alpha_omega-1.3.48 vs lib/alpha_omega/deploy.rb in alpha_omega-1.4.0

- old
+ new

@@ -32,17 +32,14 @@ # These variables may be set in the client capfile if their default values # are not sufficient. # ========================================================================= _cset :skip_scm, false - _cset :skip_notifications, false - _cset :skip_performance, true - _cset :skip_performance_task, "" _cset :scm, :git _cset :deploy_via, :checkout _cset(:branch) { AlphaOmega.what_branch } - _cset(:revision) { ENV['FLAGS_tag'] || source.head } + _cset(:revision) { source.head } _cset :default_shell, "/bin/bash" _cset(:deploy_to) { "/data/#{application}" } _cset :root_user, "root" @@ -54,16 +51,12 @@ _cset :ruby_loader, "" _cset(:run_method) { fetch(:use_sudo, true) ? :sudo : :run } _cset :last_pod, nil - _cset :success, false - _cset (:figlet) { - fig = [%x(which figlet).strip].reject {|f| !(File.executable? f)}.first - fig ? "#{fig} -w 200" : "echo" - } + _cset (:figlet) { [%x(which figlet).strip].reject {|f| !(File.executable? f)}.first || echo } # ========================================================================= # services, logs # ========================================================================= _cset :service_dir, "service" @@ -132,11 +125,11 @@ } _cset(:current_release_name) { unless releases.empty? w = current_workarea workarea = releases[((releases.index(w)?releases.index(w):-1)+1)%releases.length] - system "#{figlet} on #{workarea}" + system "#{figlet} -w 200 on #{workarea}" workarea else "" end } @@ -162,13 +155,11 @@ _cset(:migrate_release) { File.join(releases_path, migrate_release_name) } _cset(:deploy_release) { File.join(releases_path, deploy_release_name) } _cset(:rollback_revision) { capture("cat #{rollback_release}/REVISION 2>&- || true").strip } _cset(:previous_revision) { capture("cat #{previous_release}/REVISION 2>&- || true").strip } - _cset(:cmp_previous_revision) { capture("cat #{previous_path}/REVISION 2>&- || true").strip } _cset(:current_revision) { capture("cat #{current_release}/REVISION 2>&- || true").strip } - _cset(:cmp_current_revision) { capture("cat #{current_path}/REVISION 2>&- || true").strip } _cset(:next_revision) { capture("cat #{next_release}/REVISION 2>&- || true").strip } _cset(:active_revision) { capture("cat #{active_release}/REVISION 2>&- || true").strip } _cset(:compare_revision) { capture("cat #{compare_release}/REVISION 2>&- || true").strip } _cset(:migrate_revision) { capture("cat #{migrate_release}/REVISION 2>&- || true").strip } _cset(:deploy_revision) { capture("cat #{deploy_release}/REVISION 2>&- || true").strip } @@ -312,14 +303,16 @@ servers. You will rarely call this task directly, however; instead, you \ should call the `deploy' task (to do a complete deploy) or the `update' \ task (if you want to perform the `restart' task separately). DESC task :update_code do - scm + strategy.deploy! unless skip_scm bundle - build - dist + unless deploy_path_name == migrate_path_name + build + dist + end end task :symlink_next do if releases.length >= 2 run "ln -nfs #{current_release} #{next_path}.new" @@ -361,11 +354,11 @@ end run "ln -nfs #{rollback_release} #{previous_path}.new" run "mv -T #{previous_path}.new #{previous_path}" end - system "#{figlet} #{current_release_name} activated" + system "#{figlet} -w 200 #{current_release_name} activated" end end desc <<-DESC Copy files to the currently deployed version. This is useful for updating \ @@ -409,13 +402,10 @@ Distribute binaries built in deploy:build. DESC task :dist do end - task :scm do - strategy.deploy! unless skip_scm - end desc <<-DESC Checkpoint for various language bundlers DESC task :bundle do @@ -438,16 +428,16 @@ This is called by the rollback sequence, and should rarely (if ever) need to be called directly. DESC task :revision do if previous_release - system "#{figlet} on #{previous_release_name}" + system "#{figlet} -w 200 on #{previous_release_name}" run "rm -f #{previous_path} #{next_path}" run "ln -nfs #{previous_release} #{current_path}.new" run "mv -T #{current_path}.new #{current_path}" else - system "#{figlet} failed to rollback" + system "#{figlet} -w 200 failed to rollback" abort "could not rollback the code because there is no prior release" end end desc <<-DESC @@ -587,14 +577,11 @@ puts "use 'ao unlock' to remove this lock" abort end if want_unlock - at_exit { - self.unlock; - self.successful; - } + at_exit { self.unlock; } end run "echo #{epoch} #{ENV['_AO_DEPLOYER']} > #{lock_path}" end @@ -626,20 +613,12 @@ if want_unlock run "rm -f #{lock_path}" end end - task :successful do - if success - system "#{figlet} success" - else - system "#{figlet} failed" - end - end - task :finished do - set :success, true end + end # :deploy end # Capistrano::Configuration require 'alpha_omega/config/deploy'