lib/alpha_omega/deploy.rb in alpha_omega-0.0.132 vs lib/alpha_omega/deploy.rb in alpha_omega-0.0.133
- old
+ new
@@ -62,20 +62,36 @@
_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(:previous_release_path) {
+ if releases.length > 0
+ w = current_workarea
+ releases.index(w) && releases[(releases.index(w)-1)%releases.length]
+ else
+ ""
+ end
+ }
_cset(: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) {
+ if releases.length > 0
+ w = current_workarea
+ releases.index(w) && releases[(releases.index(w)+1)%releases.length]
+ else
+ ""
+ end
+ }
_cset :releases, [ "alpha", "beta", "omega" ]
_cset(:releases_dir) { releases.length > 0 ? "releases" : "" }
_cset :previous_dir, "previous"
_cset :current_dir, "current"
@@ -84,27 +100,13 @@
_cset :log_dir, "log"
_cset(:releases_path) { File.join(deploy_to, releases_dir) }
_cset(:release_path) { File.join(releases_path, release_name) }
- _cset(:previous_path) {
- if releases.length > 0
- w = current_workarea
- releases.index(w) && releases[(releases.index(w)-1)%releases.length] || ""
- else
- ""
- end
- }
+ _cset(:previous_path) { File.join(deploy_to, previous_dir) }
_cset(:current_path) { File.join(deploy_to, current_dir) }
- _cset(:next_path) {
- if releases.length > 0
- w = current_workarea
- releases.index(w) && releases[(releases.index(w)+1)%releases.length] || ""
- else
- ""
- end
- }
+ _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) }
_cset(:previous_revision) { capture("cat #{previous_release}/REVISION", :except => { :no_release => true }).chomp if previous_release }
@@ -121,12 +123,12 @@
# the timestamped release_path will be inaccurate, since the directory won't
# 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(:previous_release) { previous_path }
+ _cset(:previous_release) { previous_release_path }
_cset(:current_release) { release_path }
- _cset(:next_release) { next_path }
+ _cset(:next_release) { next_release_path }
_cset(:latest_release) { current_release }
# =========================================================================
# deploy:lock defaults
# =========================================================================