Rake script for managing Rails plugins with Git submodules

Problem with gitmodules and rails plugins

Submodules aren’t very easy. You have to know a few things before messing with them. When installing you have to follow a bunch of steps in order to get them properly registered within git. Uninstalling is even sadder. You need to manually edit a couple of git config files, and perform some more git operations. When dealing with Rails plugins – you should also remember to check if plugin contains an install.rb/uninstall.rb hook and run them manually. This is enough repetitive crap for me to justify some automation.

Solution: Automation with Rake

Note: This solution is specifically for rails plugins hosted on github.

When I think automation in the context of Rails – I immediately think rake. Without further ado I present a rake script which takes care of all the aforementioned problems for you.

  • Automated module install – no need to run any git commands.
  • Automated module uninstall – no need to edit git config files by hand.
  • Automated running of install.rb/uninstall.rb plugin hooks.
  • Automated module updates.
  • Automatically uses github.

The usage is as simple as it gets. Read comments on top for list of available tasks.

Grab it here: http://gist.github.com/185746

Leave a Reply