capistrano and git, sitting in a tree - display the latest revision from both

April 29th, 2008 @ 05:50 PM

Figure out if your deployed revision is the same as your local revision.

1
2
3
4
5
# plain jane capistrano
cap status

# capistrano multi-stage
cap production status

Plop this into your deploy.rb

1
2
3
4
5
6
7
8
9
10
11
desc "where's my server at?"
task :status, :roles => :app do
  server = current_revision
  local = source.local.query_revision('HEAD'){|cmd| `#{cmd}` }
  if server == local
    puts "Delpoyed & localhost synced! (#{source.head} at #{server})"
  else
    puts "Deployed: #{server} (#{source.head})"
    puts "Local: #{local} (#{source.local.head})"
  end
end

Post a comment