lib/alpha_omega/deploy.rb in alpha_omega-0.0.134 vs lib/alpha_omega/deploy.rb in alpha_omega-0.0.135

- old
+ new

@@ -110,10 +110,11 @@ _cset(:releases_path) { File.join(deploy_to, releases_dir) } _cset(:release_path) { File.join(releases_path, release_name) } _cset(:previous_path) { File.join(deploy_to, previous_dir) } _cset(:current_path) { File.join(deploy_to, current_dir) } + _cset(:external_path) { current_path } _cset(:next_path) { File.join(deploy_to, next_dir) } _cset(:service_path) { File.join(deploy_to, service_dir) } _cset(:service_drop) { File.join(deploy_to, ".#{service_dir}.d") } _cset(:log_path) { File.join(deploy_to, log_dir) } @@ -299,25 +300,23 @@ task :symlink, :except => { :no_release => true } do if releases.length > 0 on_rollback do if rollback_release run "rm -fv #{previous_path} #{next_path}; true" - run "#{File.dirname(current_path).index(deploy_to) == 0 ? "" : try_sudo} ln -vsnf #{rollback_release} #{current_path}; true" + run "ln -vsnf #{rollback_release} #{current_path}; true" else logger.important "no previous release to rollback to, rollback of symlink skipped" end end if releases.length == 1 - run "[[ $(readlink #{current_path} 2>&-) = #{latest_release} ]] || #{try_sudo} ln -vsnf #{latest_release} #{current_path}" + run "ln -vsnf #{latest_release} #{current_path}" else run "rm -fv #{previous_path} #{next_path}" - if current_path == "#{deploy_to}/current" - run "#{File.dirname(current_path).index(deploy_to) == 0 ? "" : try_sudo} ln -vsnf #{latest_release} #{current_path}" - else - run "ln -vsnf #{latest_release} #{deploy_to}/current" - run "#{File.dirname(current_path).index(deploy_to) == 0 ? "" : try_sudo} ln -vsnf #{deploy_to}/current #{current_path}" + run "ln -vsnf #{latest_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" @@ -402,15 +401,10 @@ task :revision, :except => { :no_release => true } do if previous_release system "#{figlet} -w 200 on #{previous_release}" run "rm -fv #{previous_path} #{next_path}" - if current_path == "#{deploy_to}/current" - run "#{File.dirname(current_path).index(deploy_to) == 0 ? "" : try_sudo} ln -vsnf #{previous_release} #{current_path}" - else - run "ln -vsnf #{previous_release} #{deploy_to}/current" - run "#{File.dirname(current_path).index(deploy_to) == 0 ? "" : try_sudo} ln -vsnf #{deploy_to}/current #{current_path}" - end + run "ln -vsnf #{previous_release} #{current_path}" else abort "could not rollback the code because there is no prior release" end end