Created
March 1, 2012 23:20
-
-
Save tomkersten/1953961 to your computer and use it in GitHub Desktop.
Vlad(/rake) task to let you know what you'd be deploying if you were to do so now...(based off your repo's 'origin' server master branch)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :deploy do | |
desc "Show which commits would be deployed right now" | |
remote_task :what do | |
print "(Locally) Fetching current state of origin..." | |
`git fetch origin` | |
origin_master_head = `cat .git/refs/remotes/origin/master`.chomp | |
origin_head_details = `git log #{origin_master_head} --pretty=oneline -n 1` | |
puts origin_master_head | |
print "Current commit on server is..." | |
production_head = run("cd #{deploy_to} > /dev/null 2>&1 && cat .git/refs/heads/master").chomp | |
puts "" | |
if origin_master_head == production_head | |
puts "Server is in sync with origin/master...no need to deploy" | |
else | |
puts "If you deploy now, the following commits will be added to prod:" | |
puts `git log #{production_head}..#{origin_master_head} --oneline --abbrev-commit` | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use:
rake deploy:what
(or,rake production deploy:what
if you use staged deploys)