Adding a Deployment Message to Your Capistrano Deployment Recipe
Mark Flecther's 7th Startup Commandment is "Perfection is the enemy of good enough. Leonardo could paint the Mona Lisa only once. You, Bob Ross, can push a bug release every 5 minutes because you were at least smart enough to do a web app." Well put. Working on a web app with an agile-ish team, there are going to be a lot of deployments. Add a couple of staging servers and a couple of different projects, and it can become difficult to keep track of what is pushed out, and why. Additionally, after getting used to the logging functionality of a source control tool like Subversion, the adding a deployment message is an easy way to keep your team on the same page. This is how I went about it.
First, set the +message+ variable to the command-line argument, and make sure it is there:
deploy.rb
set :message, self[:message]
task :before_deploy do
raise "Please enter a reason for deploying, i.e. cap depoy -S message='Pushing out new graphics for the homepage to staging server'" if message.nil?
end
task :after_deploy do
run "echo #{message} >> {release_path}/revision_msg.txt"
end
From there you can harness your :after_deploy task to email a deployment notification to the team, or you can override capistrano's default behavior to put in a revisions log, or anything else.
And then from the command line:
cap deploy -S message='Pushing the new homepage graphics to the staging server'
