Created
December 3, 2009 23:51
-
-
Save toolmantim/248682 to your computer and use it in GitHub Desktop.
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
So I asked about conditionals in Rake and basically everybody | |
told me the concept is ridiculous, but I could maybe use invoke. | |
I'm thinking maybe I asked the wrong question, so here's some more | |
detail so we can either find me a viable solution or confirm I'm crazy. | |
I have a rake task that combines and minifies all my CSS and JS into | |
one file each. I want to automate that task so that it runs before | |
each deploy. | |
Ideally, I type 'cap deploy' as per normal, it runs the minifier tasks, | |
commits any changes to master, pushes that to GitHub and then runs my | |
normal deploy. | |
My concern is the automatic commit and push. I need to ensure I have a | |
clean index before the minifier runs so I don't inadvertently commit | |
the wrong shizzy or the right shizzy under the commit message about | |
minification. | |
My original question was because I only wanted to proceed with the | |
minification and deploy if the task found my index was clean. But | |
maybe there is a better way? | |
How would you do it? |
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
task :minify do | |
raise "You've uncommitted changes" unless `git status`.include?("working directory clean") | |
`minify && git commit -am "Minify"` | |
end | |
task :deploy => :minify do | |
# Do the deploy | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment