Add new way to write mikutter plugin.
Add this line to your mikutter's Gemfile:
gem 'mikutter_plugin_base'
And then execute:
$ bundle
Or install it yourself as:
$ gem install mikutter_plugin_base
Finally execute mikkuter with bundled gems:
$ bundle exec ruby mikkuter.rb
# path/to/mikutter/plugin/dir/sample.rb
require 'mikutter_plugin_base'
class Sample < Mikutter::PluginBase
def run(plugin)
"write your code here."
"you can access mikutter plugin api via `plugin`."
end
def on_update(service, messages)
"define mikutter event callbacks, hooks, filters as method."
"plugin base will automatically add them."
end
end
# at last of your plugin script do `resister!`
Sample.register!This gem just convert your plugin code.
Plugin like this code goes...
class SamplePlugin < Mikutter::PluginBase
def run(plugin)
@data_store = setup
end
def on_update(service, messages)
messages.each do |msg|
@data_store.save msg
end
end
end
SamplePlugin.register!like this.
Plugin.create :sample_plugin do |plugin|
@data_store = setup
on_update do |service, messages|
messages.each do |msg|
@data_store.save msg
end
end
end- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request