From e9e6b583dbdbfcc5ec4245c0b73bb8292522e304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lache=CC=80ze=20Alexandre?= Date: Sat, 12 Oct 2013 17:38:11 +0200 Subject: [PATCH 01/18] Remove useless doc task --- Jakefile | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/Jakefile b/Jakefile index a7b0de4..1d992e6 100644 --- a/Jakefile +++ b/Jakefile @@ -1,4 +1,3 @@ -var DOC_DIR = __dirname + '/doc/jsdoc/'; var LIB_DIR = __dirname + '/lib/'; var DIST_DIR = __dirname + '/dist/'; var JsDoc3_CONF = __dirname + '/doc/JsDocConf.json'; @@ -68,34 +67,6 @@ namespace('test', function() { }); }); -// ------------ DOC ------------ -desc('Generate documentation using JsDoc3'); -task('doc', ['default'], function(){ - console.log('[Doc] Purging the doc folder'); - var rm = 'rm -rf '+DOC_DIR; - console.log(rm); - PROC.exec(rm, function (error, stdout, stderr) { - console.log('[Doc] ' + stdout); - console.error('[Doc] Error :' + stderr); - if (error !== null) { - console.error('[Doc] Error : ' + error); - } - }); - - console.log('[Doc] Generating documentation..'); - - var cmd = JsDoc3_EXEC+' --recurse '+LIB_DIR +' --destination '+DOC_DIR +' -c '+JsDoc3_CONF; - console.log(cmd); - - PROC.exec(cmd, function (error, stdout, stderr) { - console.log('[Doc] ' + stdout); - console.error('[Doc] Error :' + stderr); - if (error !== null) { - console.error('[Doc] Error : ' + error); - } - }); -}); - // ------------ BUILD ------------ var checked = ' done ✓'.green + '\n'; From 435c3434dfc27b935d910fd617722bea3a7fcb4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lache=CC=80ze=20Alexandre?= Date: Sat, 12 Oct 2013 18:53:55 +0200 Subject: [PATCH 02/18] Reformat package.json --- package.json | 104 +++++++++++++++++++++++++++++---------------------- 1 file changed, 59 insertions(+), 45 deletions(-) diff --git a/package.json b/package.json index be53df9..88d73ad 100644 --- a/package.json +++ b/package.json @@ -1,46 +1,60 @@ { - "name": "kadoh" - , "version": "0.1.0" - , "description": "Kademlia over HTTP in Javascript" - , "keywords":["p2p", "kad", "kademlia", "dht", "mainline", "bittorrent", "http", "xmpp", "bosh", "udp", "socket.io"] - , "contributors": [ - "Alexandre Lachèze " - , "Pierre Guilleminot " - ] - , "repository":{ - "type": "git" - , "url": "https://github.com/jinroh/kadoh.git" - } - , "main" : "./lib/index.js" - , "browserify" : "./lib/index-browserify.js" - , "dependencies": { - "colors" : "~0.6" - , "connect" : "~2.0" - , "express" : "~2.5" - , "ifconfig.me" : "https://github.com/alexstrat/ifconfig.me-node/tarball/master" - , "jake" : "~0.1" - , "klass" : "~1.2" - , "ltx" : ">= 0.2.0" - , "node-xmpp" : "~0.3" - , "bncode" : "~0.2" - , "socket.io" : "~0.9" - , "socket.io-client" : "https://github.com/substack/socket.io-client/tarball/master" - , "mustache" : "~0.4" - , "browserify" : "https://github.com/alexstrat/node-browserify/tarball/for-kadoh" - , "tagify" : "*" - , "Strophe.js" : "https://github.com/alexstrat/strophejs/tarball/for-kadoh" - }, - "scripts": { - "test": "jake test:node[spec]" - }, - "devDependencies": { - "mocha" : "~1.0" - , "chai" : "~1.0" - , "sinon-chai" : "~2.1" - , "sinon" : "~1.3" - , "optimist" : "~0.3" - , "nconf" : "~0.5" - , "multimeter" : "~0.1" - } - , "engines": { "node": ">= 0.6.0" } -} \ No newline at end of file + "name": "kadoh", + "version": "0.1.0", + "description": "Kademlia over HTTP in Javascript", + "keywords": [ + "p2p", + "kad", + "kademlia", + "dht", + "mainline", + "bittorrent", + "http", + "xmpp", + "bosh", + "udp", + "socket.io" + ], + "contributors": [ + "Alexandre Lachèze ", + "Pierre Guilleminot " + ], + "repository": { + "type": "git", + "url": "https://github.com/jinroh/kadoh.git" + }, + "main": "./lib/index.js", + "browserify": "./lib/index-browserify.js", + "dependencies": { + "colors": "~0.6", + "connect": "~2.0", + "express": "~2.5", + "ifconfig.me": "https://github.com/alexstrat/ifconfig.me-node/tarball/master", + "jake": "~0.1", + "klass": "~1.2", + "ltx": ">= 0.2.0", + "node-xmpp": "~0.3", + "bncode": "~0.2", + "socket.io": "~0.9", + "socket.io-client": "https://github.com/substack/socket.io-client/tarball/master", + "mustache": "~0.4", + "browserify": "https://github.com/alexstrat/node-browserify/tarball/for-kadoh", + "tagify": "*", + "Strophe.js": "https://github.com/alexstrat/strophejs/tarball/for-kadoh" + }, + "scripts": { + "test": "jake test:node[spec]" + }, + "devDependencies": { + "mocha": "~1.0", + "chai": "~1.0", + "sinon-chai": "~2.1", + "sinon": "~1.3", + "optimist": "~0.3", + "nconf": "~0.5", + "multimeter": "~0.1", + }, + "engines": { + "node": ">= 0.6.0" + } +} From a66c11ad2ffaed2ec39df37dbd6e15407cd3a8ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lache=CC=80ze=20Alexandre?= Date: Sat, 12 Oct 2013 18:55:15 +0200 Subject: [PATCH 03/18] Add basic grunt --- Gruntfile.js | 6 ++++++ package.json | 1 + 2 files changed, 7 insertions(+) create mode 100644 Gruntfile.js diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..e6868d5 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,6 @@ +module.exports = function(grunt) { + + // Project configuration. + grunt.initConfig({ + }); +}; diff --git a/package.json b/package.json index 88d73ad..6080c75 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "optimist": "~0.3", "nconf": "~0.5", "multimeter": "~0.1", + "grunt": "~0.4.1" }, "engines": { "node": ">= 0.6.0" From af7aabe51b559b5a7d13dd131851859b739dace2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lache=CC=80ze=20Alexandre?= Date: Sat, 12 Oct 2013 19:05:40 +0200 Subject: [PATCH 04/18] Move ascii to grunt --- Gruntfile.js | 10 ++++++++++ Jakefile | 14 -------------- kadoh.ascii.txt | 6 ++++++ 3 files changed, 16 insertions(+), 14 deletions(-) create mode 100644 kadoh.ascii.txt diff --git a/Gruntfile.js b/Gruntfile.js index e6868d5..c4c22cd 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,6 +1,16 @@ +require('colors'); + module.exports = function(grunt) { // Project configuration. grunt.initConfig({ }); + + // ascii task + grunt.registerTask('ascii', 'Print kadoh ascii', function() { + var logo = grunt.file.read('kadoh.ascii.txt'); + grunt.log.writeln(logo.yellow); + }); + + grunt.registerTask('default', ['ascii']); }; diff --git a/Jakefile b/Jakefile index 1d992e6..c4a69ce 100644 --- a/Jakefile +++ b/Jakefile @@ -30,20 +30,6 @@ var PROC = require('child_process'); var COLORS = require('colors'); var UI = require(__dirname + '/UI/generator'); -// ------------ DEFAULT ------------ -desc('Say Hello to Kadoh'); -task('default', [], function() { - var logo = - ' \n' + - ' _/ _/ _/ _/_/ _/ _/ \n' + - ' _/ _/ _/_/_/ _/_/_/ _/ _/ _/ _/ \n' + - ' _/_/ _/ _/ _/ _/ _/ _/ _/_/_/_/ \n' + - ' _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ \n' + - ' _/ _/ _/_/_/ _/_/_/ _/_/ _/ _/ \n' + - ' '; - console.log(logo.yellow); -}); - // ------------ TESTS ------------ namespace('test', function() { desc('Testing in node'); diff --git a/kadoh.ascii.txt b/kadoh.ascii.txt new file mode 100644 index 0000000..5b02f60 --- /dev/null +++ b/kadoh.ascii.txt @@ -0,0 +1,6 @@ + + _/ _/ _/ _/_/ _/ _/ + _/ _/ _/_/_/ _/_/_/ _/ _/ _/ _/ + _/_/ _/ _/ _/ _/ _/ _/ _/_/_/_/ + _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ + _/ _/ _/_/_/ _/_/_/ _/_/ _/ _/ From b22378f3ae1561378715d96f0d6b1c49b4554dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lache=CC=80ze=20Alexandre?= Date: Sat, 12 Oct 2013 19:14:05 +0200 Subject: [PATCH 05/18] Move node.js test to grunt --- Gruntfile.js | 12 ++++++++++++ Jakefile | 7 ------- package.json | 3 ++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index c4c22cd..c41d3af 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -4,6 +4,11 @@ module.exports = function(grunt) { // Project configuration. grunt.initConfig({ + mochaTest: { + test: { + src: ['test/**/*.js'] + } + } }); // ascii task @@ -12,5 +17,12 @@ module.exports = function(grunt) { grunt.log.writeln(logo.yellow); }); + // defautl task grunt.registerTask('default', ['ascii']); + + // tests tasks aliases + grunt.registerTask('test:node', ['ascii', 'mochaTest:test']); + + // load npm tasks + grunt.loadNpmTasks('grunt-mocha-test'); }; diff --git a/Jakefile b/Jakefile index c4a69ce..6cf5bd2 100644 --- a/Jakefile +++ b/Jakefile @@ -32,13 +32,6 @@ var UI = require(__dirname + '/UI/generator'); // ------------ TESTS ------------ namespace('test', function() { - desc('Testing in node'); - task('node', ['default'], function(reporter) { - reporter = reporter || 'dot' - var mocha = PROC.spawn('mocha', ['--colors', '--reporter', reporter]); - mocha.stdout.pipe(process.stdout, { end: false }); - mocha.stderr.pipe(process.stderr, { end: false }); - }, true); desc('Testing in the browser'); task('browser', ['default'], function() { diff --git a/package.json b/package.json index 6080c75..af4d92f 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,8 @@ "optimist": "~0.3", "nconf": "~0.5", "multimeter": "~0.1", - "grunt": "~0.4.1" + "grunt": "~0.4.1", + "grunt-mocha-test": "~0.7.0" }, "engines": { "node": ">= 0.6.0" From d98629bb130b10a63ef216c73cba47e7b0df7fae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lache=CC=80ze=20Alexandre?= Date: Sat, 12 Oct 2013 19:43:41 +0200 Subject: [PATCH 06/18] Forgot to remove all default tasks from Jakefile --- Jakefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Jakefile b/Jakefile index 6cf5bd2..5867f5f 100644 --- a/Jakefile +++ b/Jakefile @@ -34,7 +34,7 @@ var UI = require(__dirname + '/UI/generator'); namespace('test', function() { desc('Testing in the browser'); - task('browser', ['default'], function() { + task('browser', function() { jake.Task['build:test'].execute(); var jasmine = require('jasmine-runner'); @@ -51,7 +51,7 @@ namespace('test', function() { var checked = ' done ✓'.green + '\n'; desc('Building and minifing the embedded code'); -task('build', ['default'], function() { +task('build', function() { jake.Task['build:xmpp'].execute(); jake.Task['build:simudp'].execute(); }); @@ -79,10 +79,10 @@ namespace('build', function() { } desc('Building the brower-side code with xmpp configuration'); - task('xmpp', ['default'], build('xmpp', false)); + task('xmpp', build('xmpp', false)); desc('Building the brower-side code with simudp configuration'); - task('simudp', ['default'], build('simudp', false)); + task('simudp', build('simudp', false)); }); // ------------ UI GENERATE ------------ @@ -101,13 +101,13 @@ namespace('generate', function() { } desc('Generate the mainline proxy app UI'); - task('mainline', ['default'], generate('mainline')); + task('mainline', generate('mainline')); desc('Generate the udp proxy app UI'); - task('udp', ['default'], generate('udp')); + task('udp', generate('udp')); desc('Generate the xmpp app UI'); - task('xmpp', ['default'], generate('xmpp')); + task('xmpp', generate('xmpp')); }); // ------------ RUN SERVER ------------ From bceeacab09441434959ab85557886035013d69a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lache=CC=80ze=20Alexandre?= Date: Sun, 13 Oct 2013 00:45:06 +0200 Subject: [PATCH 07/18] Move build tasks to grunt --- Gruntfile.js | 46 ++++++++++++++++++++++++++++++++++++++++++++++ Jakefile | 39 --------------------------------------- 2 files changed, 46 insertions(+), 39 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index c41d3af..f9d9c97 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,4 +1,7 @@ require('colors'); +var browserify = require('browserify'); +var tagify = require('tagify'); +var path = require('path'); module.exports = function(grunt) { @@ -8,6 +11,24 @@ module.exports = function(grunt) { test: { src: ['test/**/*.js'] } + }, + + kadohBuild: { + xmpp: { + options: { + flags: ['xmpp', 'lawchair'], + }, + src: ['lib/index-browserify.js'], + dest: 'dist/KadOH.xmpp.js' + }, + + simudp: { + options: { + flags: ['simudp', 'lawchair'], + }, + src: ['lib/index-browserify.js'], + dest: 'dist/KadOH.simudp.js' + } } }); @@ -17,12 +38,37 @@ module.exports = function(grunt) { grunt.log.writeln(logo.yellow); }); + grunt.registerMultiTask('kadohBuild', 'Build kadoh file', function() { + var task = this; + this.files.forEach(function(file, next) { + var options = task.options({ + flags: [], + debug: false + }); + + var build = browserify({debug : options.debug}); + build.use(tagify.flags(options.flags)); + + var entries = grunt.file.expand({filter: 'isFile'}, file.src) + .map(function (f) { + return path.resolve(f); + }).forEach(function(entry) { + build.addEntry(entry); + }); + + grunt.file.write(file.dest, build.bundle()); + }); + }); // defautl task grunt.registerTask('default', ['ascii']); // tests tasks aliases grunt.registerTask('test:node', ['ascii', 'mochaTest:test']); + // build tasks aliases + grunt.registerTask('build:xmpp', ['ascii', 'kadohBuild:xmpp']); + grunt.registerTask('build:simudp', ['ascii', 'kadohBuild:simudp']); + // load npm tasks grunt.loadNpmTasks('grunt-mocha-test'); }; diff --git a/Jakefile b/Jakefile index 5867f5f..23b3472 100644 --- a/Jakefile +++ b/Jakefile @@ -46,45 +46,6 @@ namespace('test', function() { }); }); -// ------------ BUILD ------------ - -var checked = ' done ✓'.green + '\n'; - -desc('Building and minifing the embedded code'); -task('build', function() { - jake.Task['build:xmpp'].execute(); - jake.Task['build:simudp'].execute(); -}); - -namespace('build', function() { - - function build(type, debug) { - return function() { - var browserify = require('browserify'); - var tagify = require('tagify'); - - process.stdout.write('Building '+type); - - var build = browserify({debug : debug}); - build.use(tagify.flags([type, 'lawnchair'])); - build.addEntry(LIB_DIR+'index-browserify.js'); - - fs.writeFileSync( - DIST_DIR+'KadOH.'+type+'.js', - build.bundle() - ); - - process.stdout.write(checked); - }; - } - - desc('Building the brower-side code with xmpp configuration'); - task('xmpp', build('xmpp', false)); - - desc('Building the brower-side code with simudp configuration'); - task('simudp', build('simudp', false)); -}); - // ------------ UI GENERATE ------------ namespace('generate', function() { From 52052782de499b35131191527d1a01a17fb2a5bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lache=CC=80ze=20Alexandre?= Date: Mon, 14 Oct 2013 13:48:21 +0200 Subject: [PATCH 08/18] Add TODO for browserify v2 --- Gruntfile.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Gruntfile.js b/Gruntfile.js index f9d9c97..e2e777d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -38,6 +38,9 @@ module.exports = function(grunt) { grunt.log.writeln(logo.yellow); }); + // build kadoh task + // TODO: replace me with proper browserify task ASA + // we switch to browserify v2 grunt.registerMultiTask('kadohBuild', 'Build kadoh file', function() { var task = this; this.files.forEach(function(file, next) { From d61aa596eb1ba88e5c5fa94b03329d3f5ad3b664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lache=CC=80ze=20Alexandre?= Date: Mon, 14 Oct 2013 14:46:00 +0200 Subject: [PATCH 09/18] Move generate UI tasks to Grunt --- Gruntfile.js | 36 ++++++++++++++++++++++++++++++++++++ Jakefile | 24 ------------------------ 2 files changed, 36 insertions(+), 24 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index e2e777d..3ecc49a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -2,6 +2,7 @@ require('colors'); var browserify = require('browserify'); var tagify = require('tagify'); var path = require('path'); +var UIGenerator = require('./UI/generator'); module.exports = function(grunt) { @@ -29,6 +30,24 @@ module.exports = function(grunt) { src: ['lib/index-browserify.js'], dest: 'dist/KadOH.simudp.js' } + }, + + generateUI: { + mainline: { + files: { + 'apps/mainline/index.html': ['apps/mainline/conf.json'] + } + }, + udp: { + files: { + 'apps/udp/index.html': ['apps/udp/conf.json'] + } + }, + xmpp: { + files: { + 'apps/xmpp/index.html': ['apps/xmpp/conf.json'] + } + } } }); @@ -62,6 +81,18 @@ module.exports = function(grunt) { grunt.file.write(file.dest, build.bundle()); }); }); + + // gnerate UI task + grunt.registerMultiTask('generateUI', 'Generate UI', function() { + this.files.forEach(function(file) { + if(file.src.length !== 1) + return grunt.fail.warn('You should specify one conf file'); + + var conf = file.src[0]; + grunt.file.write(file.dest, UIGenerator.generate(conf)); + }); + }); + // defautl task grunt.registerTask('default', ['ascii']); @@ -72,6 +103,11 @@ module.exports = function(grunt) { grunt.registerTask('build:xmpp', ['ascii', 'kadohBuild:xmpp']); grunt.registerTask('build:simudp', ['ascii', 'kadohBuild:simudp']); + // generate tasks aliases + grunt.registerTask('generate:xmpp', ['ascii', 'generateUI:xmpp']); + grunt.registerTask('generate:simudp', ['ascii', 'generateUI:simudp']); + grunt.registerTask('generate:mainline', ['ascii', 'generateUI:mainline']); + // load npm tasks grunt.loadNpmTasks('grunt-mocha-test'); }; diff --git a/Jakefile b/Jakefile index 23b3472..9d6cfd9 100644 --- a/Jakefile +++ b/Jakefile @@ -46,30 +46,6 @@ namespace('test', function() { }); }); -// ------------ UI GENERATE ------------ - -namespace('generate', function() { - - function generate(type) { - return function() { - process.stdout.write('Creating '+type+' UI'); - fs.writeFileSync( - UI_FILES[type].index, - UI.generate(UI_FILES[type].conf) - ); - process.stdout.write(checked); - } - } - - desc('Generate the mainline proxy app UI'); - task('mainline', generate('mainline')); - - desc('Generate the udp proxy app UI'); - task('udp', generate('udp')); - - desc('Generate the xmpp app UI'); - task('xmpp', generate('xmpp')); -}); // ------------ RUN SERVER ------------ From f4ffa30cb635ee800f591a0f01accd3fab0658b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lache=CC=80ze=20Alexandre?= Date: Mon, 14 Oct 2013 19:43:26 +0200 Subject: [PATCH 10/18] Cann pass --debug --- Gruntfile.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Gruntfile.js b/Gruntfile.js index 3ecc49a..bf87340 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -15,6 +15,9 @@ module.exports = function(grunt) { }, kadohBuild: { + options: { + debug: grunt.option('debug') + }, xmpp: { options: { flags: ['xmpp', 'lawchair'], From 10a4b574a5650d1eb4b57cd5f470c84779aa9cfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lache=CC=80ze=20Alexandre?= Date: Mon, 14 Oct 2013 22:30:21 +0200 Subject: [PATCH 11/18] Move run tasks to browserify --- Gruntfile.js | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++ Jakefile | 26 ----------------------- 2 files changed, 59 insertions(+), 26 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index bf87340..df326b5 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -51,6 +51,21 @@ module.exports = function(grunt) { 'apps/xmpp/index.html': ['apps/xmpp/conf.json'] } } + }, + + runServer: { + mainline: { + src: './apps/mainline/app.js' + }, + udp: { + src: ['./apps/udp/app.js'] + }, + xmpp: { + src: ['./apps/xmpp/app.js'] + }, + boilerplate: { + src: ['./apps/boilerplate/app.js'] + } } }); @@ -96,6 +111,44 @@ module.exports = function(grunt) { }); }); + // run servers tasks + grunt.registerMultiTask('runServer', 'Run server', function() { + + var task = this; + var done = task.async(); + + this.files.forEach(function(file) { + if(file.src.length !== 1) + return grunt.fail.warn('You should specify one app file'); + + var options = task.options({ + port: 8080, + keepalive: false + }); + + // can pass --port=%port% + if(grunt.option('port')) + options.port = parseInt(grunt.option('port'), 10); + + // can pass --port=keepalive + if(grunt.option('keepalive')) + options.keepalive = grunt.option('keepalive'); + + // can do runServer:mainline:keepalive + if(typeof task.flags.keepalive == 'boolean') + options.keepalive = task.flags.keepalive; + + var app = file.src[0]; + require(app).server.listen(options.port) + .on('listening', function() { + if(!options.keepalive) done(); + }); + + grunt.log.ok('Server running on http://localhost:'+options.port); + + }); + }); + // defautl task grunt.registerTask('default', ['ascii']); @@ -111,6 +164,12 @@ module.exports = function(grunt) { grunt.registerTask('generate:simudp', ['ascii', 'generateUI:simudp']); grunt.registerTask('generate:mainline', ['ascii', 'generateUI:mainline']); + // run tasks aliases + grunt.registerTask('run:xmpp', ['ascii', 'generateUI:xmpp', 'runServer:xmpp:keepalive']); + grunt.registerTask('run:udp', ['ascii', 'generateUI:udp', 'runServer:udp:keepalive']); + grunt.registerTask('run:mainline', ['ascii', 'generateUI:mainline', 'runServer:mainline:keepalive']); + grunt.registerTask('run:boilerplate', ['ascii', 'runServer:boilerplate:keepalive']); + // load npm tasks grunt.loadNpmTasks('grunt-mocha-test'); }; diff --git a/Jakefile b/Jakefile index 9d6cfd9..668f1ea 100644 --- a/Jakefile +++ b/Jakefile @@ -45,29 +45,3 @@ namespace('test', function() { }); }); }); - - -// ------------ RUN SERVER ------------ - -namespace('run', function() { - - function run(type) { - return function(port) { - port = parseInt(port, 10) || 8080 ; - require(UI_FILES[type].app).server.listen(port); - console.log('Server running on http://localhost:'+port); - } - } - - desc('Run the mainline proxy app server'); - task('mainline', ['generate:mainline'], run('mainline')); - - desc('Run the udp proxy app server'); - task('udp', ['generate:udp'], run('udp')); - - desc('Run the xmpp app server'); - task('xmpp', ['generate:xmpp'], run('xmpp')); - - desc('Run the boilerplate app server'); - task('boilerplate', run('boilerplate')); -}); \ No newline at end of file From e93f03b7ebe5fd4afda0b904516cbb75e8e641b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lache=CC=80ze=20Alexandre?= Date: Mon, 14 Oct 2013 22:31:30 +0200 Subject: [PATCH 12/18] Move alias tasks upper --- Gruntfile.js | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index df326b5..14e1b69 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -6,7 +6,28 @@ var UIGenerator = require('./UI/generator'); module.exports = function(grunt) { - // Project configuration. + // defautl task + grunt.registerTask('default', ['ascii']); + + // tests tasks aliases + grunt.registerTask('test:node', ['ascii', 'mochaTest:test']); + + // build tasks aliases + grunt.registerTask('build:xmpp', ['ascii', 'kadohBuild:xmpp']); + grunt.registerTask('build:simudp', ['ascii', 'kadohBuild:simudp']); + + // generate tasks aliases + grunt.registerTask('generate:xmpp', ['ascii', 'generateUI:xmpp']); + grunt.registerTask('generate:simudp', ['ascii', 'generateUI:simudp']); + grunt.registerTask('generate:mainline', ['ascii', 'generateUI:mainline']); + + // run tasks aliases + grunt.registerTask('run:xmpp', ['ascii', 'generateUI:xmpp', 'runServer:xmpp:keepalive']); + grunt.registerTask('run:udp', ['ascii', 'generateUI:udp', 'runServer:udp:keepalive']); + grunt.registerTask('run:mainline', ['ascii', 'generateUI:mainline', 'runServer:mainline:keepalive']); + grunt.registerTask('run:boilerplate', ['ascii', 'runServer:boilerplate:keepalive']); + + // project configuration grunt.initConfig({ mochaTest: { test: { @@ -149,27 +170,6 @@ module.exports = function(grunt) { }); }); - // defautl task - grunt.registerTask('default', ['ascii']); - - // tests tasks aliases - grunt.registerTask('test:node', ['ascii', 'mochaTest:test']); - - // build tasks aliases - grunt.registerTask('build:xmpp', ['ascii', 'kadohBuild:xmpp']); - grunt.registerTask('build:simudp', ['ascii', 'kadohBuild:simudp']); - - // generate tasks aliases - grunt.registerTask('generate:xmpp', ['ascii', 'generateUI:xmpp']); - grunt.registerTask('generate:simudp', ['ascii', 'generateUI:simudp']); - grunt.registerTask('generate:mainline', ['ascii', 'generateUI:mainline']); - - // run tasks aliases - grunt.registerTask('run:xmpp', ['ascii', 'generateUI:xmpp', 'runServer:xmpp:keepalive']); - grunt.registerTask('run:udp', ['ascii', 'generateUI:udp', 'runServer:udp:keepalive']); - grunt.registerTask('run:mainline', ['ascii', 'generateUI:mainline', 'runServer:mainline:keepalive']); - grunt.registerTask('run:boilerplate', ['ascii', 'runServer:boilerplate:keepalive']); - // load npm tasks grunt.loadNpmTasks('grunt-mocha-test'); }; From a2e15e96acd094c04cad41e108714bdf2e34fb2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lache=CC=80ze=20Alexandre?= Date: Mon, 14 Oct 2013 22:32:29 +0200 Subject: [PATCH 13/18] hmm.. --- Gruntfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 14e1b69..b2b63fc 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -76,7 +76,7 @@ module.exports = function(grunt) { runServer: { mainline: { - src: './apps/mainline/app.js' + src: ['./apps/mainline/app.js'] }, udp: { src: ['./apps/udp/app.js'] From 8130ec844c7faabb7c33a0c601c5e523f6c778fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lache=CC=80ze=20Alexandre?= Date: Mon, 14 Oct 2013 22:47:16 +0200 Subject: [PATCH 14/18] Sorry travis! I missed you too.. --- .travis.yml | 6 +++++- package.json | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index eb93765..4dbaece 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,4 +8,8 @@ branches: language: node_js node_js: - 0.6 - - 0.8 \ No newline at end of file + - 0.8 + - 0.10 + +before_script: + - npm install -g grunt-cli diff --git a/package.json b/package.json index af4d92f..958bb96 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "Strophe.js": "https://github.com/alexstrat/strophejs/tarball/for-kadoh" }, "scripts": { - "test": "jake test:node[spec]" + "test": "grunt test:node" }, "devDependencies": { "mocha": "~1.0", From 6e79e862c98a75e69c339f07418ceb6c3e6941e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lache=CC=80ze=20Alexandre?= Date: Mon, 14 Oct 2013 23:24:07 +0200 Subject: [PATCH 15/18] Officily drop support for node v0.6 --- .travis.yml | 1 - README.md | 2 +- package.json | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4dbaece..3f625d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,6 @@ branches: language: node_js node_js: - - 0.6 - 0.8 - 0.10 diff --git a/README.md b/README.md index 02f0fe4..a0470cd 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ See the wiki for more informations on how to [launch your own DHT](/jinroh/kadoh ### Install KadOH -The only required dependency is [node.js](http://nodejs.org/) (version >= 0.6, but you clould try below..). Take a look at the [official manual](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager) to install node on your system. +The only required dependency is [node.js](http://nodejs.org/) (version >= 0.8). Take a look at the [official manual](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager) to install node on your system. Then run : diff --git a/package.json b/package.json index 958bb96..acec7d4 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,6 @@ "grunt-mocha-test": "~0.7.0" }, "engines": { - "node": ">= 0.6.0" + "node": ">= 0.8.0" } } From b3ea907e5f57f83186ba8ce464016398d5935353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lache=CC=80ze=20Alexandre?= Date: Tue, 15 Oct 2013 09:43:10 +0200 Subject: [PATCH 16/18] s/lawchair/lawnchair --- Gruntfile.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index b2b63fc..04e1fe9 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -41,7 +41,7 @@ module.exports = function(grunt) { }, xmpp: { options: { - flags: ['xmpp', 'lawchair'], + flags: ['xmpp', 'lawnchair'], }, src: ['lib/index-browserify.js'], dest: 'dist/KadOH.xmpp.js' @@ -49,7 +49,7 @@ module.exports = function(grunt) { simudp: { options: { - flags: ['simudp', 'lawchair'], + flags: ['simudp', 'lawnchair'], }, src: ['lib/index-browserify.js'], dest: 'dist/KadOH.simudp.js' From 8fa36a00e428f69ef31ef781582398e3357aa845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lache=CC=80ze=20Alexandre?= Date: Wed, 16 Oct 2013 20:37:38 +0200 Subject: [PATCH 17/18] Add build task --- Gruntfile.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Gruntfile.js b/Gruntfile.js index 04e1fe9..b5e715c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -13,6 +13,7 @@ module.exports = function(grunt) { grunt.registerTask('test:node', ['ascii', 'mochaTest:test']); // build tasks aliases + grunt.registerTask('build', ['build:xmpp', 'build:simudp']); grunt.registerTask('build:xmpp', ['ascii', 'kadohBuild:xmpp']); grunt.registerTask('build:simudp', ['ascii', 'kadohBuild:simudp']); From ae78ecbd7f6717fc4ae48f10e4cf8ab8c88f8729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lache=CC=80ze=20Alexandre?= Date: Wed, 16 Oct 2013 20:38:08 +0200 Subject: [PATCH 18/18] Replace all occurences of jake --- .gitignore | 3 --- README.md | 16 ++++++++-------- package.json | 1 - 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 205d225..cf86297 100644 --- a/.gitignore +++ b/.gitignore @@ -20,9 +20,6 @@ Gemfile.lock # hookio config.json -# jake -.jake_tasks - # jasmine-node .monitor diff --git a/README.md b/README.md index a0470cd..9cd322e 100644 --- a/README.md +++ b/README.md @@ -24,10 +24,10 @@ First you can start a little DHT based on UDP transport using this command : bin/dht udp.default ``` -Then in an other terminal, start the web-based [debug UI](/jinroh/kadoh/wiki/Debug-UI) using the following Jake command and go to `localhost:8080` : +Then in an other terminal, start the web-based [debug UI](/jinroh/kadoh/wiki/Debug-UI) using the following grunt task and go to `localhost:8080` : ```sh -jake run:udp +grunt run:udp ``` See the wiki for more informations on how to [launch your own DHT](/jinroh/kadoh/wiki/DHT-simulation) from scratch and on different environments. @@ -47,10 +47,10 @@ cd kadoh npm install ``` -You may also want to install the Jake module globally : +If not already done, you may also want to install the [grunt](gruntjs.com) command line: ``` -npm install -g jake +npm install -g grunt-cli ``` *For Linux users*, if the installation of KadOH's dependencies fails, you may need to install the `libexpat-dev` package. For Ubuntu/Debian users, run the following command : @@ -63,10 +63,10 @@ sudo apt-get install libexpat-dev #### Browser -To build the source inside the `dist` folder run one of the following Jake command : +To build the source inside the `dist` folder run one of the following grunt task : ```sh -jake build +grunt build ``` This will build two versions of KadOH supporting different transports : @@ -102,6 +102,6 @@ KadOH is built on top of many open-source libraries and projects: *For the moment, tests are not running anymore.. But we hope that will be fixed as soon as we migrate to Mocha.* ``` -jake test:node -jake test:browser +grunt test:node +grunt test:browser ``` diff --git a/package.json b/package.json index acec7d4..ee2056e 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ "connect": "~2.0", "express": "~2.5", "ifconfig.me": "https://github.com/alexstrat/ifconfig.me-node/tarball/master", - "jake": "~0.1", "klass": "~1.2", "ltx": ">= 0.2.0", "node-xmpp": "~0.3",