Useful Capistrano tricks 0
I just ran into a neat little capistrano trick. I have been making some changes to an app, and knew it had been a while since I had made a release to one of the apps I am working on. But which version do I have installed?
I tried the cap diff_from_last_deploy, but it was a little too much information.
I ran into capistrano's stream command, and that proved to be just right:
desc "Find out svn version on server"
task :what_version, :roles => [:app] do
stream <<-CMD
svn info #{current_path}/app
CMD
end
It's also useful for those one-off commands you might want to run on your server, like seeing how many users registered at your site:
desc "Find out how many users are registered"
task :how_many_users, :roles => [:app] do
stream <<-CMD
psql -U user -d yourapp_production -c 'select count(login) from users'
CMD
end
