Comparing version 0.0.1 to 0.0.2
@@ -1,5 +0,14 @@ | ||
var redisLib = require('redis') | ||
var events = require('events') | ||
, util = require('util') | ||
, redisLib = require('redis') | ||
exports.SEP = '\x01' | ||
exports.io = null | ||
exports.redis = null | ||
function Events() { events.EventEmitter.call(this) } | ||
util.inherits(Events, events.EventEmitter) | ||
exports.events = new Events() | ||
exports.setup = function(config) { | ||
@@ -6,0 +15,0 @@ exports.config = config |
@@ -54,2 +54,3 @@ var async = require('async') | ||
if (options.full) data.results = results | ||
global.events.emit('test', data) | ||
callback(null, data) | ||
@@ -56,0 +57,0 @@ }) |
@@ -55,3 +55,15 @@ var express = require('express') | ||
var io = global.io = require('socket.io').listen(app) | ||
app.configure('production', function() { | ||
io.set('log level', 1) | ||
}) | ||
io.sockets.on('connection', function (socket) { | ||
global.events.on('test', function(data) { | ||
socket.broadcast.emit('test', data) | ||
}) | ||
}) | ||
return app | ||
} |
@@ -30,3 +30,2 @@ var async = require('async') | ||
for (var name in suites) { | ||
var suite = suites[name] | ||
global.redis.zadd('test/' + name, time, time + global.SEP + JSON.stringify(suites[name])) | ||
@@ -33,0 +32,0 @@ } |
var global = require('./global') | ||
, helper = require('./helper') | ||
, ntf = require('ntf') | ||
@@ -11,5 +12,3 @@ module.exports = function(app) { | ||
if (!cacheControl) { | ||
return timeout | ||
} | ||
if (!cacheControl) return timeout | ||
@@ -20,2 +19,16 @@ var ageAge = cacheControl.match(/max-age=([\d]+)/) | ||
var formatTestName = function(desc) { | ||
desc = desc.split(ntf.utils.SEP) | ||
var html = '<a href="' + desc[0] + '">' + desc[0] + '</a>' | ||
if (desc[0].match(/^https?:\/\//)) { | ||
html = desc[1] + ' ' + html | ||
} | ||
html += ' – ' + desc[desc.length-1] | ||
return html | ||
} | ||
var render = function(req, res, template, data) { | ||
@@ -28,3 +41,3 @@ var callback = req.query.callback | ||
} else if (req.accepts('html')) { | ||
res.render(template, { data: data, noJquery: true, noSocketIo: true }) | ||
res.render(template, { data: data, formatTestName: formatTestName }) | ||
} else if (req.accepts('json')) { | ||
@@ -41,5 +54,16 @@ res.json(data) | ||
app.get('/', function(req, res) { | ||
res.render('index.html', {}) | ||
}) | ||
app.get('/test', function(req, res) { | ||
var data = Object.keys(module) | ||
data.sort() | ||
data = data.map(function(name) { return { name: name, url: '/test/' + name } }) | ||
render(req, res, 'test.html', data) | ||
}) | ||
app.get('/test/all', function(req, res) { | ||
helper.runTests(module, { full: true, maxAge: maxAge(req) }, function(err, data) { | ||
render(req, res, 'test.html', data) | ||
render(req, res, 'test_all.html', data) | ||
}) | ||
@@ -46,0 +70,0 @@ }) |
{ | ||
"name": "ntfd", | ||
"description": "Network Testing Framework Daemon", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"engines": { "node": ">= 0.4" }, | ||
@@ -14,4 +14,5 @@ "dependencies": { | ||
"nomnom": ">= 1.5.1", | ||
"ntf": ">= 0.0.1", | ||
"redis": ">= 0.6.7" | ||
"ntf": ">= 0.0.3", | ||
"redis": ">= 0.6.7", | ||
"socket.io": ">= 0.8.7" | ||
}, | ||
@@ -18,0 +19,0 @@ "repository": { |
@@ -15,6 +15,8 @@ ntfd | ||
# install library | ||
Install ntfd | ||
npm install -g ntfd | ||
# create config file | ||
Create configuration file | ||
cat << EOF > ntfd.conf | ||
@@ -25,2 +27,7 @@ [http] | ||
[redis] | ||
host = 127.0.0.1 | ||
port = 6379 | ||
database = 0 | ||
[test] | ||
@@ -31,3 +38,4 @@ module = ntfd | ||
# run daemon | ||
Run ntfd | ||
ntfd -c ntfd.conf | ||
@@ -34,0 +42,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16401
20
341
45
10
+ Addedsocket.io@>= 0.8.7
+ Added@socket.io/component-emitter@3.1.2(transitive)
+ Added@types/cookie@0.4.1(transitive)
+ Added@types/cors@2.8.17(transitive)
+ Added@types/node@22.7.4(transitive)
+ Addedaccepts@1.3.8(transitive)
+ Addedbase64id@2.0.0(transitive)
+ Addedcookie@0.4.2(transitive)
+ Addedcors@2.8.5(transitive)
+ Addedengine.io@6.6.1(transitive)
+ Addedengine.io-parser@5.2.3(transitive)
+ Addednegotiator@0.6.3(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedsocket.io@4.8.0(transitive)
+ Addedsocket.io-adapter@2.5.5(transitive)
+ Addedsocket.io-parser@4.2.4(transitive)
+ Addedundici-types@6.19.8(transitive)
+ Addedws@8.17.1(transitive)
Updatedntf@>= 0.0.3