Add a version timestamp with capistrano

15 Jul
2009

If you want to show _when_ the app has been deployed with capistrano, this snipped might come in handy:

#############################################################
#   Custom Tasks
#############################################################

set :version_file, "#{tcdb_path}/app/views/layouts/_version.html.erb"

namespace :my_tasks do
desc "Sets the timestamp in version_file"
task :set_version_info do
run "rm #{version_file}"
run "echo '#{Time.now}' >> #{version_file}"
end
end

after 'deploy:symlink', 'my_tasks:set_version_info'

One more thing… add this file to your layout (the footer is a good place for it)

< %= render :partial => '/layouts/version' %>

Related posts:

  1. Capistrano – Deploying 2.0

Comment Form

top

Switch to our mobile site