mirror of https://github.com/balkian/Web4.0.git
Changes to monkey, added scripts
parent
3cda73ebab
commit
34083a8339
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
nodejs hookio/monkey/monkey.js > monkey.log &
|
||||
hookio/hooks/runAllHooks.sh > hooks.log &
|
||||
wait
|
@ -0,0 +1 @@
|
||||
{}
|
@ -0,0 +1,41 @@
|
||||
Web40Hook = require('hook.io-web40').Web40Hook
|
||||
|
||||
stdin = process.openStdin();
|
||||
stdin.on 'data', (chunk) ->
|
||||
killHook(chunk)
|
||||
|
||||
killHook = (data)->
|
||||
hook.emit('kill',otherhooks[parseInt(data)], (res)->
|
||||
console.log('Killed the hook '+data)
|
||||
otherhooks.splice(parseInt(data),1))
|
||||
|
||||
hook = new Web40Hook { name : 'hookManager' , silent : true}
|
||||
|
||||
|
||||
otherhooks = []
|
||||
|
||||
hook.on '*::ready', ->
|
||||
console.log 'listo'
|
||||
|
||||
redraw = ->
|
||||
process.stdout.write '\u001B[2J\u001B[0;0f'
|
||||
process.stdout.write 'Hooks:\n'
|
||||
for name,i in otherhooks
|
||||
process.stdout.write '['+i+']: '+name+'\n'
|
||||
|
||||
refresh = ->
|
||||
otherhooks = []
|
||||
hook.emit 'ping', null, (name)->
|
||||
console.log('Reply by'+name)
|
||||
setTimeout refresh, 2000
|
||||
|
||||
#//'\u001B[2J\u001B[0;0f'
|
||||
|
||||
hook.on '*::pong', (data,fn) ->
|
||||
console.log data.name+' replied'
|
||||
if !(data.name in otherhooks)
|
||||
otherhooks.push data.name
|
||||
redraw()
|
||||
|
||||
hook.connect()
|
||||
refresh()
|
@ -0,0 +1,3 @@
|
||||
var Web40Hook = require('./hook.io-web40').Web40;
|
||||
|
||||
var Hook = new Web40Hook();
|
@ -1,5 +1,12 @@
|
||||
#!/bin/bash
|
||||
for i in `npm bin`/hookio-*
|
||||
for i in $(ls `npm bin`/hookio-* 2> /dev/null)
|
||||
do
|
||||
$i &
|
||||
echo running $i
|
||||
nodejs $i &
|
||||
done
|
||||
for i in `ls | grep "hook.io-" 2>/dev/null`
|
||||
do
|
||||
echo running $i
|
||||
nodejs $i/index.js &
|
||||
done
|
||||
wait
|
||||
|
@ -1,9 +1,10 @@
|
||||
{
|
||||
"name": "Web4.0",
|
||||
"version" : "0.0.1",
|
||||
"version" : "0.0.2",
|
||||
"dependencies":{
|
||||
"socket.io":"*",
|
||||
"hook.io":"*",
|
||||
"Hook.io-mailer":"git+https://github.com/balkian/Hookio-Mailer.git"
|
||||
"Hook.io-mailer":"git+https://github.com/balkian/Hookio-Mailer.git",
|
||||
"hook.io-web40": "*"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue