Skip to content

Commit

Permalink
Add some debug comments to show when each task begins
Browse files Browse the repository at this point in the history
  • Loading branch information
robinbowes committed Nov 3, 2010
1 parent 1ff5f3e commit 52fff22
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion lib/railsless-deploy.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def try_runner(*args)
task, which handles the cold start specifically. task, which handles the cold start specifically.
DESC DESC
task :default do task :default do
logger.debug "Beginning railsless-deploy task - deploy:default"
update update
end end


Expand All @@ -167,6 +168,7 @@ def try_runner(*args)
will not destroy any deployed revisions or data. will not destroy any deployed revisions or data.
DESC DESC
task :setup, :except => { :no_release => true } do task :setup, :except => { :no_release => true } do
logger.debug "Beginning railsless-deploy task - deploy:setup"
dirs = [deploy_to, releases_path, shared_path] dirs = [deploy_to, releases_path, shared_path]
dirs += shared_children.map { |d| File.join(shared_path, d) } dirs += shared_children.map { |d| File.join(shared_path, d) }
run "#{try_sudo} mkdir -p #{dirs.join(' ')} && #{try_sudo} chmod g+w #{dirs.join(' ')}" run "#{try_sudo} mkdir -p #{dirs.join(' ')} && #{try_sudo} chmod g+w #{dirs.join(' ')}"
Expand All @@ -181,6 +183,7 @@ def try_runner(*args)
handy if you want to deploy, but not immediately restart your application. handy if you want to deploy, but not immediately restart your application.
DESC DESC
task :update do task :update do
logger.debug "Beginning railsless-deploy task - deploy:update"
transaction do transaction do
update_code update_code
symlink symlink
Expand All @@ -200,6 +203,7 @@ def try_runner(*args)
defaults to :checkout). defaults to :checkout).
DESC DESC
task :update_code, :except => { :no_release => true } do task :update_code, :except => { :no_release => true } do
logger.debug "Beginning railsless-deploy task - deploy:update_code"
on_rollback { run "rm -rf #{release_path}; true" } on_rollback { run "rm -rf #{release_path}; true" }
strategy.deploy! strategy.deploy!
finalize_update finalize_update
Expand All @@ -221,6 +225,7 @@ def try_runner(*args)
set to true, which is the default. set to true, which is the default.
DESC DESC
task :finalize_update, :except => { :no_release => true } do task :finalize_update, :except => { :no_release => true } do
logger.debug "Beginning railsless-deploy task - deploy:finalize_update"
run "chmod -R g+w #{latest_release}" if fetch(:group_writable, true) run "chmod -R g+w #{latest_release}" if fetch(:group_writable, true)
end end


Expand All @@ -234,6 +239,7 @@ def try_runner(*args)
except `restart'). except `restart').
DESC DESC
task :symlink, :except => { :no_release => true } do task :symlink, :except => { :no_release => true } do
logger.debug "Beginning railsless-deploy task - deploy:symlink"
on_rollback do on_rollback do
if previous_release if previous_release
run "rm -f #{current_path}; ln -s #{previous_release} #{current_path}; true" run "rm -f #{current_path}; ln -s #{previous_release} #{current_path}; true"
Expand Down Expand Up @@ -264,6 +270,7 @@ def try_runner(*args)
$ cap deploy:upload FILES='config/apache/*.conf' $ cap deploy:upload FILES='config/apache/*.conf'
DESC DESC
task :upload, :except => { :no_release => true } do task :upload, :except => { :no_release => true } do
logger.debug "Beginning railsless-deploy task - deploy:upload"
files = (ENV["FILES"] || "").split(",").map { |f| Dir[f.strip] }.flatten 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? abort "Please specify at least one file or directory to update (via the FILES environment variable)" if files.empty?


Expand All @@ -277,6 +284,7 @@ def try_runner(*args)
ever) need to be called directly. ever) need to be called directly.
DESC DESC
task :revision, :except => { :no_release => true } do task :revision, :except => { :no_release => true } do
logger.debug "Beginning railsless-deploy task - rollback:upload"
if previous_release if previous_release
run "rm #{current_path}; ln -s #{previous_release} #{current_path}" run "rm #{current_path}; ln -s #{previous_release} #{current_path}"
else else
Expand All @@ -290,6 +298,7 @@ def try_runner(*args)
(if ever) need to be called directly. (if ever) need to be called directly.
DESC DESC
task :cleanup, :except => { :no_release => true } do task :cleanup, :except => { :no_release => true } do
logger.debug "Beginning railsless-deploy task - rollback:cleanup"
run "if [ `readlink #{current_path}` != #{current_release} ]; then rm -rf #{current_release}; fi" run "if [ `readlink #{current_path}` != #{current_release} ]; then rm -rf #{current_release}; fi"
end end


Expand All @@ -299,6 +308,7 @@ def try_runner(*args)
current release will be removed from the servers. current release will be removed from the servers.
DESC DESC
task :code, :except => { :no_release => true } do task :code, :except => { :no_release => true } do
logger.debug "Beginning railsless-deploy task - rollback:code"
revision revision
cleanup cleanup
end end
Expand All @@ -309,6 +319,7 @@ def try_runner(*args)
back where you were, on the previously deployed version. back where you were, on the previously deployed version.
DESC DESC
task :default do task :default do
logger.debug "Beginning railsless-deploy task - rollback:default"
revision revision
cleanup cleanup
end end
Expand All @@ -322,6 +333,7 @@ def try_runner(*args)
for your environment, set the :use_sudo variable to false instead. for your environment, set the :use_sudo variable to false instead.
DESC DESC
task :cleanup, :except => { :no_release => true } do task :cleanup, :except => { :no_release => true } do
logger.debug "Beginning railsless-deploy task - deploy:cleanup"
count = fetch(:keep_releases, 5).to_i count = fetch(:keep_releases, 5).to_i
if count >= releases.length if count >= releases.length
logger.important "no old releases to clean up" logger.important "no old releases to clean up"
Expand All @@ -348,6 +360,7 @@ def try_runner(*args)
depend :remote, :directory, "/u/depot/files" depend :remote, :directory, "/u/depot/files"
DESC DESC
task :check, :except => { :no_release => true } do task :check, :except => { :no_release => true } do
logger.debug "Beginning railsless-deploy task - deploy:check"
dependencies = strategy.check! dependencies = strategy.check!


other = fetch(:dependencies, {}) other = fetch(:dependencies, {})
Expand Down Expand Up @@ -382,6 +395,7 @@ def try_runner(*args)
invoke `deploy:start' to fire up the application servers. invoke `deploy:start' to fire up the application servers.
DESC DESC
task :cold do task :cold do
logger.debug "Beginning railsless-deploy task - deploy:cold"
update update
end end


Expand All @@ -392,6 +406,7 @@ def try_runner(*args)
not be supported on all SCM's. not be supported on all SCM's.
DESC DESC
task :diff, :except => { :no_release => true } do task :diff, :except => { :no_release => true } do
logger.debug "Beginning railsless-deploy task - pending:diff"
system(source.local.diff(current_revision)) system(source.local.diff(current_revision))
end end


Expand All @@ -401,11 +416,12 @@ def try_runner(*args)
might not be supported on all SCM's. might not be supported on all SCM's.
DESC DESC
task :default, :except => { :no_release => true } do task :default, :except => { :no_release => true } do
logger.debug "Beginning railsless-deploy task - pending:default"
from = source.next_revision(current_revision) from = source.next_revision(current_revision)
system(source.local.log(from)) system(source.local.log(from))
end end
end end


end end


end # Capistrano::Configuration.instance(:must_exist).load do end # Capistrano::Configuration.instance(:must_exist).load do

0 comments on commit 52fff22

Please sign in to comment.