From 4e1888ea8a40c2168250d60717a9fd20afa94771 Mon Sep 17 00:00:00 2001 From: tknew2 Date: Mon, 26 May 2014 19:17:37 +0200 Subject: [PATCH] 0.8.13 --- README.md | 4 +-- examples/custom_action.js | 7 ++++ examples/custom_action_with_params.js | 22 ++++++++++++ examples/load-me.js | 48 +++++++++++++++++++++++++++ package.json | 4 +-- 5 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 examples/custom_action.js create mode 100644 examples/custom_action_with_params.js create mode 100644 examples/load-me.js diff --git a/README.md b/README.md index 86a88dd6..d1a80cb4 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,9 @@ Works on Linux & MacOS. - +Master: [![Build Status](https://api.travis-ci.org/Unitech/pm2.png?branch=master)](https://travis-ci.org/Unitech/pm2) - +Development: [![Build Status](https://api.travis-ci.org/Unitech/pm2.png?branch=development)](https://travis-ci.org/Unitech/pm2) ## Monitoring dashboard diff --git a/examples/custom_action.js b/examples/custom_action.js new file mode 100644 index 00000000..a30483d3 --- /dev/null +++ b/examples/custom_action.js @@ -0,0 +1,7 @@ + +var axm = require('axm'); + +axm.action('refresh:db', function(reply) { + console.log('Refreshing'); + reply({success : true}); +}); diff --git a/examples/custom_action_with_params.js b/examples/custom_action_with_params.js new file mode 100644 index 00000000..81b1aeca --- /dev/null +++ b/examples/custom_action_with_params.js @@ -0,0 +1,22 @@ + +var axm = require('axm'); + +axm.action('refresh:db', { comment : 'Refresh the database' }, function(reply) { + console.log('Refreshing'); + reply({success : true}); +}); + +axm.action('chanme:ladb', { comment : 'Refresh la BIG database' }, function(reply) { + console.log('Refreshing BIG DB'); + reply({success : true}); +}); + +axm.action('rm:rf', { comment : 'Delete moi ca plus vite que ca !' }, function(reply) { + console.log('RMING RFING'); + reply({success : true}); +}); + +axm.action('rm:roff', function(reply) { + console.log('RMING RFING'); + reply({success : true}); +}); diff --git a/examples/load-me.js b/examples/load-me.js new file mode 100644 index 00000000..c6399413 --- /dev/null +++ b/examples/load-me.js @@ -0,0 +1,48 @@ + +var stop = false; + +function add(a, b) { + while (a.length < b.length) a.unshift(0); + while (a.length > b.length) b.unshift(0); + var carry = 0, sum = [] + for (var i = a.length - 1; i >= 0; i--) { + var s = a[i] + b[i] + carry; + if (s >= 10) { + s = s - 10; + carry = 1; + } else { + carry = 0; + } + sum.unshift(s); + } + if (carry) + sum.unshift(carry); + return sum; +} + +function fib(n) { + var f1 = [0]; + var f2 = [1]; + + while (n--) { + var f3 = add(f1, f2) + if (stop) return false; + f1 = f2; + f2 = f3; + } + return f1.join(""); +} + + +var axm = require('axm'); + +axm.action('load:start', function(reply) { + fib(50000); + reply({success : true}); +}); + + +axm.action('load:stop', function(reply) { + stop = true; + reply({success : true}); +}); diff --git a/package.json b/package.json index ba1100e1..f51c5fe8 100644 --- a/package.json +++ b/package.json @@ -64,9 +64,7 @@ "description": "Modern CLI process manager for Node apps with a builtin load-balancer", "main": "index.js", "scripts": { - "test": "bash ./test/cli.sh && bash ./test/json_file.sh && bash ./test/harmony.sh && bash ./test/reload.sh && bash ./test/right-exit-code.sh && bash ./test/log-reload.sh && bash ./test/gracefulReload.sh && bash ./test/cli2.sh && bash ./test/misc.sh && bash ./test/watchdog.sh && bash ./test/fork.sh && bash ./test/infinite_loop.sh && NODE_ENV=test ./node_modules/mocha/bin/mocha test", - "install" : "node scripts/install.js", - "update" : "node scripts/install.js" + "test": "bash ./test/cli.sh && bash ./test/json_file.sh && bash ./test/harmony.sh && bash ./test/reload.sh && bash ./test/right-exit-code.sh && bash ./test/log-reload.sh && bash ./test/gracefulReload.sh && bash ./test/cli2.sh && bash ./test/misc.sh && bash ./test/watchdog.sh && bash ./test/fork.sh && bash ./test/infinite_loop.sh && NODE_ENV=test ./node_modules/mocha/bin/mocha test" }, "keywords": [ "cli",