lib/alpha_omega/deploy.rb in alpha_omega-0.0.136 vs lib/alpha_omega/deploy.rb in alpha_omega-0.0.137

- old
+ new

@@ -62,37 +62,38 @@ _cset(:source) { Capistrano::Deploy::SCM.new(scm, self) } _cset(:strategy) { Capistrano::Deploy::Strategy.new(deploy_via, self) } _cset(:real_revision) { source.local.query_revision(revision) { |cmd| with_env("LC_ALL", "C") { run_locally(cmd) } } } _cset(:current_workarea) { capture("readlink #{current_path} || true").strip.split("/")[-1] } - _cset(:rollback_release_path) { + _cset(:rollback_release_name) { if releases.length > 0 w = current_workarea releases.index(w) && releases[(releases.index(w))%releases.length] else "" end } - _cset(:previous_release_path) { + _cset(:previous_release_name) { if releases.length > 0 w = current_workarea releases.index(w) && releases[(releases.index(w)-1)%releases.length] else "" end } - _cset(:current_release_path) { + _cset(:current_release_name) { if releases.length > 0 w = current_workarea stage = releases[((releases.index(w)?releases.index(w):-1)+1)%releases.length] system "#{figlet} -w 200 on #{stage}" stage else "" end } - _cset(:next_release_path) { + _cset (:release_name) { current_release_name } # compact + _cset(:next_release_name) { if releases.length > 0 w = current_workarea releases.index(w) && releases[(releases.index(w)+1)%releases.length] else "" @@ -117,13 +118,12 @@ _cset(:service_drop) { File.join(deploy_to, ".#{service_dir}.d") } _cset(:log_path) { File.join(deploy_to, log_dir) } _cset(:rollback_revision) { capture("cat #{rollback_release}/REVISION", :except => { :no_release => true }).strip } _cset(:previous_revision) { capture("cat #{previous_release}/REVISION", :except => { :no_release => true }).strip } - _cset(:current_revision) { capture("cat #{current_path}/REVISION", :except => { :no_release => true }).strip } + _cset(:current_revision) { capture("cat #{current_release}/REVISION", :except => { :no_release => true }).strip } _cset(:next_revision) { capture("cat #{next_release}/REVISION", :except => { :no_release => true }).strip } - _cset(:latest_revision) { capture("cat #{current_release}/REVISION", :except => { :no_release => true }).strip } _cset(:run_method) { fetch(:use_sudo, true) ? :sudo : :run } # formerly: # @@ -133,15 +133,14 @@ # actually exist. This variable lets tasks like symlink work either in the # standalone case, or during deployment. # # with persistent releases, the latest release is always the current release - _cset(:rollback_release) { File.join(releases_path, rollback_release_path) } - _cset(:previous_release) { File.join(releases_path, previous_release_path) } - _cset(:current_release) { File.join(releases_path, current_release_path) } - _cset(:latest_release) { current_release } - _cset(:next_release) { File.join(releases_path, next_release_path) } + _cset(:rollback_release) { File.join(releases_path, rollback_release_name) } + _cset(:previous_release) { File.join(releases_path, previous_release_name) } + _cset(:current_release) { File.join(releases_path, current_release_name) } + _cset(:next_release) { File.join(releases_path, next_release_name) } # ========================================================================= # deploy:lock defaults # ========================================================================= _cset(:want_unlock) { true } @@ -282,11 +281,11 @@ cook end task :symlink_next, :except => { :no_release => true } do if releases.length >= 2 - run "ln -vsnf #{latest_release} #{next_path}" + run "ln -vsnf #{current_release} #{next_path}" end end desc <<-DESC Updates the symlink to the most recently deployed version. Capistrano works \ @@ -307,21 +306,21 @@ logger.important "no previous release to rollback to, rollback of symlink skipped" end end if releases.length == 1 - run "ln -vsnf #{latest_release} #{current_path}" + run "ln -vsnf #{current_release} #{current_path}" else run "rm -fv #{previous_path} #{next_path}" - run "ln -vsnf #{latest_release} #{current_path}" + run "ln -vsnf #{current_release} #{current_path}" if current_path != external_path run "#{File.dirname(external_path).index(deploy_to) == 0 ? "" : try_sudo} ln -vsnf #{current_path} #{external_path}" end run "ln -vsnf #{rollback_release} #{previous_path}" end - system "#{figlet} -w 200 #{release_name} activated" + system "#{figlet} -w 200 #{current_release_path} activated" end end desc <<-DESC Copy files to the currently deployed version. This is useful for updating \ @@ -376,11 +375,11 @@ desc <<-DESC Apply microwave tvdinners to a release directory. DESC task :cook, :roles => :app, :except => { :no_release => true } do run_script = <<-SCRIPT - set -e; cd #{release_path}; + set -e; cd #{current_release}; if [[ -x bin/nuke ]]; then #{ruby_loader} bin/nuke; fi; SCRIPT run run_script.gsub(/[\n\r]+[ \t]+/, " ") end @@ -579,11 +578,11 @@ end # :deploy namespace :ruby do task :bundle do run_script = <<-SCRIPT - set -e; cd #{release_path}; + set -e; cd #{current_release}; SCRIPT run_script += <<-SCRIPT #{ruby_loader} bundle check 2>&1 > /dev/null || { #{ruby_loader} bundle install --quiet --local #{bundler_options} && #{ruby_loader} bundle check > /dev/null; }; SCRIPT @@ -595,11 +594,11 @@ after "deploy:bundle", "ruby:bundle" namespace :node do task :bundle do run_script = <<-SCRIPT - set -e; cd #{release_path}; + set -e; cd #{current_release}; SCRIPT run_script += <<-SCRIPT npm install; SCRIPT @@ -608,10 +607,10 @@ end end on :exit do unless local_only - put full_log, "#{log_path}/#{application}_last_deploy-#{release_name}-#{branch.gsub(/\W+/,"_")}.log-#{Time.now.strftime('%Y%m%d-%H%M')}" + put full_log, "#{log_path}/#{application}_last_deploy-#{current_release_path}-#{branch.gsub(/\W+/,"_")}.log-#{Time.now.strftime('%Y%m%d-%H%M')}" end end end # Capistrano::Configuration