Skip to content

Commit 8041e56

Browse files
committed
Add readme, update install/uninstall
1 parent 8d39d26 commit 8041e56

File tree

4 files changed

+57
-3
lines changed

4 files changed

+57
-3
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Openframe Plugin Example
2+
3+
A boilerplate example of an Openframe plugin.
4+
5+
--
6+
7+
[Openframe](http://openframe.io) is an open source platform for displaying art. Frames running the [Frame Controller](https://github.com/OpenframeProject/Openframe-FrameController) software can load plugins which extend functionality.
8+
9+
### Developing a Plugin
10+
11+
At its core, a plugin is an npm module which exports an object containing a number of predefined properties. The only required property is an `init` function which is called by the frame controller after the plugin has been installed. This `init` function is called with a single argument, a reference to the frame controller instance, which gives the plugin access to the global event system and other frame functionality.
12+
13+
> Note: This is an early prototype. The API may change.
14+
15+
### Installing dependencies
16+
17+
If a plugin requires NPM packages, they should be included in the package.json `dependencies` as with any other node package.
18+
19+
Some plugins may need to install other types of dependencies, or run other types of non-nodejs installation processes. This example uses [npm scripts](https://docs.npmjs.com/misc/scripts) to execute the install.sh shell script upon install. As a best practice, plugins that modify the system using install.sh should take care of undoing those changes using an uninstall.sh script, which is executed when the npm module is uninstalled.
20+
21+

install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Be VERY Careful. This script may be executed with admin privileges.
44

5-
echo "Hello Openframe (ExamplePlugin install.sh)"
5+
echo "Openframe Plugin Example -- install.sh"
66

77
# Some limited platform detection might be in order... though at present we're targeting the Pi
88
os=$(uname)
@@ -12,8 +12,8 @@ if [ $os == "Linux" ]; then
1212

1313
# on Debian Linux distributions
1414

15-
# on RaspberryPi
1615
if [ $arq == "armv7l" ]; then
16+
# on RaspberryPi
1717

1818
# ####
1919
#

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"description": "An example Openframe Plugin.",
55
"main": "plugin.js",
66
"scripts": {
7-
"preinstall": "sh ./install.sh",
7+
"install": "sh ./install.sh",
8+
"uninstall": "sh ./uninstall.sh",
89
"test": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha"
910
},
1011
"keywords": [

uninstall.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
#
3+
# Be VERY Careful. This script may be executed with admin privileges.
4+
5+
echo "Openframe Plugin Example -- uninstall.sh"
6+
7+
# Some limited platform detection might be in order... though at present we're targeting the Pi
8+
os=$(uname)
9+
arq=$(uname -m)
10+
11+
if [ $os == "Linux" ]; then
12+
13+
# on Debian Linux distributions
14+
15+
# on RaspberryPi
16+
if [ $arq == "armv7l" ]; then
17+
18+
# ####
19+
#
20+
# FOR NOW, CODE GOES HERE since we're shooting for RPi support
21+
#
22+
# ####
23+
24+
25+
26+
else
27+
# Non-arm7 Debian...
28+
fi
29+
30+
elif [ $os == "Darwin" ]; then
31+
# OSX
32+
fi

0 commit comments

Comments
 (0)