Created
May 4, 2012 19:45
-
-
Save davidcornu/2597272 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env ruby | |
projectroot = File.expand_path("../../", __FILE__) | |
Dir.chdir(projectroot) | |
puts <<-INFO | |
This script pushes all changes in master to the production | |
branch in addition to cleaning and precompiling assets. | |
Press ENTER to continue, CTRL-C to exit: | |
INFO | |
begin | |
gets | |
rescue Interrupt | |
puts '>> Cancelled' | |
exit | |
end | |
puts '>> Running...' | |
success = system <<-CMD | |
git checkout production && | |
git pull origin master && | |
bundle exec rake assets:clean && | |
bundle exec rake assets:precompile && | |
git add . && | |
git commit -am "Precompiled Assets" && | |
git push origin production && | |
git checkout master | |
CMD | |
if success | |
puts '>> Complete' | |
else | |
puts '>> Error' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yup, the && prevents anything else from being executed