Doc update and portability improvements

This commit is contained in:
Dominic Bosch 2014-04-30 11:28:43 +02:00
parent ce36359539
commit 42d16c30d7
9 changed files with 16 additions and 12 deletions

View file

@ -27,7 +27,7 @@ Download and install dependencies:
cd webapi-eca
npm install
Get your [redis](http://redis.io/) instance up and running (and find the port for the config file below) or create your own `js/persistence.js`.
Get your [redis](http://redis.io/) instance up and running ( and find the port for the config file below ) or create your own `js/persistence.js`.
Edit the configuration file:

View file

@ -225,6 +225,8 @@ storeModule = ( user, oBody, modType, dbMod, callback ) =>
# dbMod.publish oBody.id
callback answ
# Store a rule and inform everybody about it
# ------------------------------------------
storeRule = ( user, oBody, callback ) =>
# This is how a rule is stored in the database
rule =
@ -244,22 +246,22 @@ storeRule = ( user, oBody, callback ) =>
db.linkRule rule.id, user.username
# activate the rule
db.activateRule rule.id, user.username
# if event module parameters were send, store them
# if event module parameters were sent, store them
if oBody.eventparams
epModId = rule.eventname.split( ' -> ' )[ 0 ]
db.eventPollers.storeUserParams epModId, user.username, JSON.stringify oBody.eventparams
oFuncArgs = oBody.eventfunctions
# if event function arguments were send, store them
# if event function arguments were sent, store them
for id, args of oFuncArgs
arr = id.split ' -> '
db.eventPollers.storeUserArguments user.username, rule.id, arr[ 0 ], arr[ 1 ], JSON.stringify args
# if action module params were send, store them
# if action module params were sent, store them
oParams = oBody.actionparams
for id, params of oParams
db.actionInvokers.storeUserParams id, user.username, JSON.stringify params
oFuncArgs = oBody.actionfunctions
# if action function arguments were send, store them
# if action function arguments were sent, store them
for id, args of oFuncArgs
arr = id.split ' -> '
db.actionInvokers.storeUserArguments user.username, rule.id, arr[ 0 ], arr[ 1 ], JSON.stringify args
@ -450,6 +452,7 @@ commandFunctions =
# WEBHOOKS
# --------
create_webhook: ( user, oBody, callback ) ->
answ = hasRequiredParams [ 'hookname' ], oBody
if answ.code isnt 200

View file

@ -59,7 +59,7 @@ isRunning = true
# Register disconnect action. Since no standalone mode is intended
# the event poller will shut down
process.on 'disconnect', () ->
log.info 'EP | Shutting down Event Poller'
log.warn 'EP | Shutting down Event Poller'
isRunning = false
# very important so the process doesnt linger on when the paren process is killed
process.exit()

View file

@ -157,8 +157,6 @@ init = =>
@log.info 'RS | Initialzing DB'
db args
# > We only proceed with the initialization if the DB is ready
#TODO eventually we shouldn't let each module load its own persistence
#module, but hand this one through them via the args...
db.isConnected ( err ) =>
db.selectDatabase parseInt( args[ 'db-select' ] ) || 0
if err
@ -192,6 +190,7 @@ init = =>
# - The keygen phrase, this has to be handled differently in the future!
args[ 'keygen' ]
]
# Initialize the event poller with the required CLI arguments
poller = cp.fork path.resolve( __dirname, nameEP ), cliArgs
# after the engine and the event poller have been initialized we can
@ -203,7 +202,7 @@ init = =>
cm.addRuleListener ( evt ) -> poller.send evt
@log.info 'RS | Initialzing http listener'
# The request handler passes certain requests to the module manager
# The request handler passes certain requests to the components manager
args[ 'request-service' ] = cm.processRequest
# We give the HTTP listener the ability to shutdown the whole system
args[ 'shutdown-function' ] = shutDown

View file

@ -6,6 +6,7 @@ ProBinder ACTION INVOKER
Global variables
This module requires user-specific parameters:
- username
- password
###

View file

@ -3,6 +3,7 @@ OpenWeather EVENT POLLER
------------------------
This module requires user-specific parameters:
- appid
###
urlService = 'http://api.openweathermap.org/data/2.5/weather'

View file

@ -1,4 +1,4 @@
#!/usr/bin/env node
#!/usr/bin/env nodejs
/*
* # groc Documentation
* Create the documentation to be displayed through the webserver.

View file

@ -1,3 +1,3 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
node $DIR/js/webapi-eca | $DIR/node_modules/bunyan/bin/bunyan
nodejs $DIR/js/webapi-eca | $DIR/node_modules/bunyan/bin/bunyan

View file

@ -1,4 +1,4 @@
#!/usr/bin/env node
#!/usr/bin/env nodejs
process.chdir( __dirname );
var fs = require( 'fs' ),
path = require( 'path' ),