cknv/beetle — pull request #3 by Dinoshauer (2014-08-07 21:14:12+00:00)
Title: Plugins

This pull request has breaking changes to the way plugins are loaded.

Config changes:

commands = [
{
'name': 'render',
'command': render,
'args': [
config
],
'kwargs': {
},
},
]

---
plugins:
-
name: "sample-plugin"
args:
- "foo"
- "bar"
- "baz"
kwargs:
foo: "foo"

This way it's easy to understand how you pass in parameters to a
plugins command.

Plugins are following the same naming convention as the ones in
[Flask](http://flask.pocoo.org/docs/extensiondev/#ext-import-transition), so a plugin will be called `beetle_foo` but the user will import it as `foo`
(or in case of a multi word plugin: `beetle_foo_bar` becomes `foo-bar`)
this is for cosmetic reasons and is easily changable.

Testing it out:

I created a sample plugin that does nothing, currently because it does
not have a `command` but it is still imported.

`pip install git+git@github.com:Dinoshauer/beetle-sample-plugin.git`

The plugin will pull in `beetle` by itself so it's easy to just launch
a new `virtualenv` and install it with the command above.

There are other ways that might be nicer but this is just a quick solution.