-
Notifications
You must be signed in to change notification settings - Fork 57
/
my-plugin.coffee
49 lines (39 loc) · 1.76 KB
/
my-plugin.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# #Plugin template
# This is an plugin template and mini tutorial for creating pimatic plugins. It will explain the
# basics of how the plugin system works and what a plugin should look like.
# ##The plugin code
# Your plugin must export a single function, that takes one argument and returns a instance of
# your plugin class. The parameter is an envirement object containing all pimatic related functions
# and classes. See the [startup.coffee](http://sweetpi.de/pimatic/docs/startup.html) for details.
module.exports = (env) ->
# ###require modules included in pimatic
# To require modules that are included in pimatic use `env.require`. For available packages take
# a look at the dependencies section in pimatics package.json
# Require the bluebird promise library
Promise = env.require 'bluebird'
# Require the [cassert library](https://github.com/rhoot/cassert).
assert = env.require 'cassert'
# Include your own depencies with nodes global require function:
#
# someThing = require 'someThing'
#
# ###MyPlugin class
# Create a class that extends the Plugin class and implements the following functions:
class MyPlugin extends env.plugins.Plugin
# ####init()
# The `init` function is called by the framework to ask your plugin to initialise.
#
# #####params:
# * `app` is the [express] instance the framework is using.
# * `framework` the framework itself
# * `config` the properties the user specified as config for your plugin in the `plugins`
# section of the config.json file
#
#
init: (app, @framework, @config) =>
env.logger.info("Hello World")
# ###Finally
# Create a instance of my plugin
myPlugin = new MyPlugin
# and return it to the framework.
return myPlugin