Subversion post commit hook using basecamp api
The Basecamp API was released last week.
We’ve created a subversion post-commit hook that posts nicely formatted messages to a specific category for all of our clients basecamp projects.
This way our clients are continuously informed about the project status and the added benefit is that it forces us to write decent, coherent and descriptive log messages.
We have our svn repository setup so that the first level is a reference to the client’s company and the second level is the name of the client’s project (svn/projects/client-name/project-name).
‘SCM Commits’ category exists in project
The script uses the path of the changed files to select the correct basecamp project and then posts to the ‘SCM Commits’ category if it exists for that project. It also only posts a message if the post was to the main trunk branch.
Feel free to refactor, rewrite or otherwise modify the script. (Make sure to rename it to “post-commit” (no extension) before sticking it in your subversion repository’s ‘hooks’ directory.
- Tip for textdrive users: Make sure the shebang line points to the actual path to the ruby executable and don’t use ”/usr/bin/env ruby” because when this is executed by the apache user the environment isn’t set.
- 2nd tip for textdrive users: Make sure all call to external system files have a full absolute path.