mroth/lolcommits — pull request #179 by matthutchinson (2013-11-30 23:50:23+00:00)
Title: Plugins refactoring & twitter fixes for #73 and #136

This PR refactors the plugin code and plugin configuration. It also adds fixes for issues #73 and #136.
Here is a summary of all the changes, check the diff for more details.

`Lolcommits::Configuration`

Refactored with (smaller) methods for:

* `ask_for_plugin_name` added to grab user input
* `find_plugin` finds plugin by name, returns new plugin object (with nil runner)
* `do_configure!` now delegates to each plugin's own `configure_options!` method
* `save` simply writes the config file to disk
* `to_s` now returns the config yaml file to a string

`Lolcommits::Plugin`

The base plugin class now has a basic method for `configure_options!` that can be
overridden in each plugin sub class. The following methods were added or changed:

* `is_enabled?` and `is_configured?` methods now exist that can be used in plugins
* `puts` was overidden so that plugin output respects the lolcommits `stealth` option
* `plugdebug` was renamed to simply `debug`, and postfixes the plugin name in debug calls
* `self.name` is a new class method that defines the plugins name (used in config/listing/finding plugins etc.)
* `valid_configuration?` checks for a valid config, shows error if its missing

After these changes it was nesecary to refactor the existing plugins to work.
Most of the changes are minor, adding `is_configured?` and `self.name` methods.

* `lolsrv` got better logging and error handling methods
* Removed a bunch of old commented out code from the `loltext` plugin
* `lol_twitter` had a bigger set of changes (see below)

`Lolcommits::LolTwitter`

The main change here was tho have configuration happening through the regular method, via:

lolcommits --config -p twitter

This resolves issue #73, and the configuration code now handles errors better and checks
for a valid PIN before proceeding.

Issue #136 should also be resolved now too so tweet messages are properly truncated (test added)