Sneak Peek: The first Warehouse post-commit hook
|
|
Here’s the Lighthouse post-commit hook. Hooks are just very simple classes that gather up data from the commit and do something interesting with it. I tried to make hooks as easy to define as possible, so that even without much Ruby experience you should be able to whip one up. I went with a DSL approach so that you don’t have to worry about a few underlying details. After setting some plugin info and defining what options your hook uses, you can dive right into the methods of your hook. You can actually just define one #run method and throw everything in there, but I broke this up so I could test some of the smaller bits of logic in the plugin. You don’t need to use the DSL approach of course, it just helps out in a few minor ways. That’s right, tests. It’s really easy to write a test (using test/unit or test/spec if you like) for various bits of your hook. You can then run Here’s what the admin looks like right now, but there’s still some UI cleanup to do. You can actually have multiple instances of the same hook run for each repository with different prefix options. For instance, you can set it to post to one Lighthouse project if the path matches /mephisto, or another if it matches /beast. Any thoughts on the hook system? Plugins will likely have a similar structure. Though since they’ll be larger projects, they won’t have some of the shortcuts I was able to use with Hooks. |
|
|
I am looking at getting a license to Lighthouse and think it would be amazing to see this integration. When do you think you’ll have a version with these hooks out? |
|
|
Sometime in August. As soon as I get plugins working, I want to put out a developers release so interested folks can check it out though. |