Automating Docco Generation And Deployment To Heroku And Github

I got tired of manually typing “git push origin master” and “git push heroku master” to push changes in my BBCloneMail app up to Github and then deploy to Heroku. So I automated that with a rake task.

Then I got tired of the same 10 commands to generated new Docco docs for BBCloneMail and push that up to my Github `gh-pages`… so I automated that with a rake task, too.

The end result is 23 lines of rake tasks (including spaces and task definitions) to automate the updating of my project’s Docco documentation, push repository commits up to Github and then deploy to Heroku:

desc "Deploy site and docs to github and heroku"
task :deploy => [:push_github, :push_heroku, :docco]

task :docco do
  `docco public/javascripts/bbclonemail*.js`
  `git add -A`
  `git stash`
  `git checkout gh-pages`
  `rm -rdf docs`
  `git add -A`
  `git stash pop`
  `git commit -am 'updating docs'`
  `git push origin gh-pages`
  `git checkout master`
end

task :push_github do
  `git push origin master`
end

task :push_heroku do
  `git push heroku master`
end

The only complexity in this is the process to update the Doco docs for the project. These commands ensure that the docs are built from the branch I’m currently on (which is always `master` for this project), but are only committed to the `gh-pages` branch, for the Github “Pages” feature. It also pushes the changes up to Github for me.

Now I just run `rake deploy` from the command line and everything is done for me. File this under “that was easy”.


Post Footer automatically generated by Add Post Footer Plugin for wordpress.

About Derick Bailey

Derick Bailey is an entrepreneur, problem solver (and creator? :P ), software developer, screecaster, writer, blogger, speaker and technology leader in central Texas (north of Austin). He runs SignalLeaf.com - the amazingly awesome podcast audio hosting service that everyone should be using, and WatchMeCode.net where he throws down the JavaScript gauntlets to get you up to speed. He has been a professional software developer since the late 90's, and has been writing code since the late 80's. Find me on twitter: @derickbailey, @mutedsolutions, @backbonejsclass Find me on the web: SignalLeaf, WatchMeCode, Kendo UI blog, MarionetteJS, My Github profile, On Google+.
This entry was posted in Command Line, Deployment, Git, Rake. Bookmark the permalink. Follow any comments here with the RSS feed for this post.