lib/alpha_omega/deploy.rb in alpha_omega-0.0.153 vs lib/alpha_omega/deploy.rb in alpha_omega-0.0.154
- old
+ new
@@ -72,10 +72,11 @@
_cset :previous_dir, "previous"
_cset :current_dir, "current"
_cset :next_dir, "next"
_cset :compare_dir, "compare"
_cset :migrate_dir, "migrate"
+ _cset(:deploy_dir) { current_dir }
_cset :service_dir, "service"
_cset :log_dir, "log"
_cset(:service_path) { File.join(deploy_to, service_dir) }
@@ -116,25 +117,28 @@
""
end
}
_cset :compare_release_name, compare_dir
_cset :migrate_release_name, migrate_dir
+ _cset(:deploy_release_name) { current_release_name }
_cset(:releases_path) { File.join(deploy_to, releases_dir) }
_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(:compare_path) { File.join(deploy_to, compare_dir) }
_cset(:migrate_path) { File.join(deploy_to, migrate_dir) }
+ _cset(:deploy_path) { File.join(deploy_to, deploy_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_release}/REVISION", :except => { :no_release => true }).strip }
_cset(:next_revision) { capture("cat #{next_release}/REVISION", :except => { :no_release => true }).strip }
_cset(:compare_revision) { capture("cat #{compare_release}/REVISION", :except => { :no_release => true }).strip }
_cset(:migrate_revision) { capture("cat #{migrate_release}/REVISION", :except => { :no_release => true }).strip }
+ _cset(:deploy_revision) { capture("cat #{deploy_release}/REVISION", :except => { :no_release => true }).strip }
# formerly:
#
# some tasks, like symlink, need to always point at the latest release, but
# they can also (occassionally) be called standalone. In the standalone case,
@@ -148,10 +152,11 @@
_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) }
_cset(:compare_release) { File.join(releases_path, compare_release_name) }
_cset(:migrate_release) { File.join(releases_path, migrate_release_name) }
+ _cset(:deploy_release) { File.join(releases_path, deploy_release_name) }
# =========================================================================
# deploy:lock defaults
# =========================================================================
_cset(:want_unlock) { true }
@@ -353,11 +358,11 @@
DESC
task :upload, :except => { :no_release => true } do
files = (ENV["FILES"] || "").split(",").map { |f| Dir[f.strip] }.flatten
abort "Please specify at least one file or directory to update (via the FILES environment variable)" if files.empty?
- files.each { |file| top.upload(file, File.join(current_path, file)) }
+ files.each { |file| top.upload(file, File.join(deploy_path, file)) }
end
desc <<-DESC
Restarts your application.
DESC
@@ -385,25 +390,20 @@
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 #{current_release};
- if [[ -x bin/nuke ]]; then #{ruby_loader} bin/nuke; fi;
- SCRIPT
-
- run run_script.gsub(/[\n\r]+[ \t]+/, " ")
end
desc <<-DESC
Compares your application.
DESC
task :compare, :roles => :app, :except => { :no_release => true } do
- set :current_release_name, "compare"
+ set :deploy_dir, "compare"
+ set :deploy_release_name, "compare"
update_code
- run "ln -vnfs #{compare_release} #{compare_path}"
+ run "ln -vnfs #{deploy_release} #{deploy_path}"
end
namespace :rollback do
desc <<-DESC
[internal] Points the current symlink at the previous revision.
@@ -454,24 +454,13 @@
desc <<-DESC
Override in deploy recipes. Formerly a railsy rake db:migrate.
DESC
task :migrate, :roles => :db, :only => { :primary => true } do
- end
-
- desc <<-DESC
- Deploy and run pending migrations. This will work similarly to the \
- `deploy' task, but will also run any pending migrations (via the \
- `deploy:migrate' task) prior to updating the symlink. Note that the \
- update in this case it is not atomic, and transactions are not used, \
- because migrations are not guaranteed to be reversible.
- DESC
- task :migrations do
- set :migrate_target, :latest
+ set :deploy_dir, "migrate"
+ set :deploy_release_name, "migrate"
update_code
- migrate
- symlink
- restart
+ run "ln -vnfs #{deploy_release} #{deploy_path}"
end
desc <<-DESC
Test deployment dependencies. Checks things like directory permissions, \
necessary utilities, and so forth, reporting on the things that appear to \