mroth/lolcommits — pull request #63 by kenmazaika (2012-07-18 02:23:23+00:00)
Title: Add Support For Plugins

I wanted to add a plugin for lolcommits.com, a project that I worked on that is a server that accepts the lolcommit images after post. The service acts as a database of lolcommit images. We use this on our testing script, that comments on github pull requests about whether our automated tests pass or fail to also show a lolcommit animated gif of the shas that are in the pull request: see [this](https://ken-mazaika-music-dev.s3.amazonaws.com/uploads/animated_gif/image/55/7b156d20af27012f257112313d162254.gif).

In the process of adding support for this, I noticed that the code wasn't very well modularized. I ended up refactoring the code, and making it support third party plugins more cleanly.

After I did this I wanted to add custom configuration options for my plugin. I ran into the issue that configuration options seemed arbitrary, not well documented, so I built a simple configuration system for each of the plugins.

Now running

```
lolcommits --plugins
```

Will result in a list of plugins, and running

```
lolcommits --configure
```

Will allow the user to configure the options for a given plugin in a single location. This folded in options from tranzlate, etc. Each plugin has the ability to enable / disable it. Other plugins can have additional configuration options (see the dot_com example for that).

This configuration management pulls all the configuration into a yaml file located in the loldir. For example the test capture image configuration I setup looks like this:

```
bulletproof:lolcommits ken$ cat ~/.lolcommits/lolcommits/config.yml
---
dot_com:
enabled: true
api_key: hidden
api_secret: hidden
repo_id: hidden
loltext:
enabled: true
```

I know this is a pretty big change so you may be hesitant to merge this in. I think this will allow future innovation on this cutting edge technology to continue, without adding kludge in the code for each future idea.

Let me know if this is a change you'd be willing to accept, see things I should change in it, or if I should fork the project to add support for lolcommits.com in a separate gem.