Getting an old-style revisions.log with Capistrano 2.0

Posted by Andreas on Monday, August 20, 2007 at 13:08 (CEST)

Capistrano 2.0 does not write a revisions.log anymore when deploying your application. However, I liked the revisions.log, because it gives you a clear history of which revision you deployed to your servers at which time. Therefore I wrote a little Capistrano recipe which updates an old-style revisions.log whenever you deploy or rollback your appliaction.

Adding the following statements to your Capfile will write an old-style revisions.log when deploying or rolling back your application, like Capistrano 1.x did:

 1 namespace :deploy do
 2   desc <<-DESC
 3     [internal] Adds a line to revisions.log after updating the code
 4   DESC
 5   task :update_revisions_log, :except => { :no_release => true } do
 6     timestamp = Time.now.strftime('%Y-%m-%d %H:%M:%S')
 7     run "echo '#{timestamp} #{user} #{latest_revision} #{releases.last}' >>#{deploy_to}/revisions.log"
 8   end
 9 end
10 after 'deploy:update_code', 'deploy:update_revisions_log'
11 after 'deploy:rollback_code', 'deploy:update_revisions_log'
• Tags: , ,
CommentsPermalink
blog comments powered by Disqus