plamoni/SiriProxy — pull request #453 by kylethedude (2013-02-18 15:42:07+00:00)
Title: Allow plugins to initialize at server startup

Added the ability for a plugin to specify an initialization routine that
is only executed when the SiriProxy server is started. This provides the
plugin a mechanism to perform a task that is not required to be
performed upon every connection. This is an optional feature, so existing plugins won't break.

**Usage**

1. Plugin defines a function called "plugin_init" to be called once when the server is started.
```ruby
def plugin_init
init_data = Hash.new

# dynamically collect info into "init_data"

return init_data
end
```
2. Function "plugin_init" should return initialization data to be used on future connections.
3. In plugin "initialize" (constructor) function, plugin can access saved initialization data from passed "config" hash.
```ruby
def initialize(config)
if (config.has_key?("init"))
# plugin has been initialized, use config['init'] to access "init_data"
else
# plugin is being called on server start
end
end
```

**Usefulness**

* For plugins that require processing time to dynamically collect static data (information about a home automation system, for example)