Permalink
Browse files

rename to tv

  • Loading branch information...
hueniverse committed Feb 11, 2013
1 parent 60804d6 commit b0a4f97b962a5839c3e146cb6968c349bffcee51
Showing with 36 additions and 36 deletions.
  1. +2 −2 README.md
  2. BIN images/helmet.png
  3. BIN images/tv.png
  4. +5 −5 lib/index.js
  5. +4 −4 package.json
  6. +25 −25 test/index.js
View
@@ -1,9 +1,9 @@
<a href="https://github.com/walmartlabs/blammo"><img src="https://raw.github.com/walmartlabs/blammo/master/images/from.png" align="right" /></a>
-![helmet Logo](/images/helmet.png)
+![tv Logo](https://raw.github.com/walmartlabs/tv/master/images/tv.png)
Interactive debug console for [**hapi**](https://github.com/walmartlabs/hapi)
-[![Build Status](https://secure.travis-ci.org/walmartlabs/helmet.png)](http://travis-ci.org/walmartlabs/helmet)
+[![Build Status](https://secure.travis-ci.org/walmartlabs/tv.png)](http://travis-ci.org/walmartlabs/tv)
The debug console is a simple web page in which developers can subscribe to a debug id (or * for all), and then include that
debug id as an extra query parameter with each request. The server will use WebSocket to stream the subscribed request logs to
View
Binary file not shown.
View
Binary file not shown.
View
10 lib/index.js 100644 → 100755
@@ -12,12 +12,12 @@ var Defaults = require('./defaults');
var internals = {};
-exports = module.exports = internals.Helmet = function (config) {
+exports = module.exports = internals.Tv = function (config) {
- Hoek.assert(this.constructor === internals.Helmet, 'Helmet must be instantiated using new');
+ Hoek.assert(this.constructor === internals.Tv, 'Tv must be instantiated using new');
var self = this;
- this.settings = Hoek.applyToDefaults(Defaults, config);
+ this.settings = Hoek.applyToDefaults(Defaults, config || {});
this._subscribers = {}; // Map: debug session -> [ subscriber ]
var indexTemplateSource = this.settings.indexTemplate || Fs.readFileSync(this.settings.indexTemplatePath, 'utf8');
@@ -40,7 +40,7 @@ exports = module.exports = internals.Helmet = function (config) {
};
-internals.Helmet.prototype.report = function (session, event) {
+internals.Tv.prototype.report = function (session, event) {
var self = this;
@@ -74,7 +74,7 @@ internals.Helmet.prototype.report = function (session, event) {
};
-internals.Helmet.prototype.getMarkup = function () {
+internals.Tv.prototype.getMarkup = function () {
var host = (this.settings.host !== '0.0.0.0') ? this.settings.host : Os.hostname();
var port = this.settings.websocketPort;
View
@@ -1,14 +1,14 @@
{
- "name": "hapi-helmet",
+ "name": "tv",
"description": "Interactive debug console for hapi",
- "version": "0.0.5",
+ "version": "0.0.1",
"author": "Eran Hammer <eran@hueniverse.com> (http://hueniverse.com)",
"contributors":[
"Wyatt Preul <wpreul@gmail.com>",
"Van Nguyen <the.gol.effect@gmail.com>",
"Ben Nguyen <benobviate@gmail.com>"
],
- "repository": "git://github.com/walmartlabs/helmet",
+ "repository": "git://github.com/walmartlabs/tv",
"main": "index",
"keywords": [
"debug",
@@ -33,7 +33,7 @@
"licenses": [
{
"type": "BSD",
- "url": "http://github.com/walmartlabs/helmet/raw/master/LICENSE"
+ "url": "http://github.com/walmartlabs/tv/raw/master/LICENSE"
}
]
}
View
@@ -2,7 +2,7 @@
var Chai = require('chai');
var Websocket = require('ws');
-var Helmet = process.env.TEST_COV ? require('../lib-cov') : require('../lib');
+var Tv = process.env.TEST_COV ? require('../lib-cov') : require('../lib');
// Declare internals
@@ -15,15 +15,15 @@ var internals = {};
var expect = Chai.expect;
-describe('Helmet', function() {
+describe('Tv', function() {
describe('#constructor', function() {
it('cannot be constructed without new', function(done) {
var fn = function() {
- var helmet = Helmet();
+ var tv = Tv();
};
expect(fn).to.throw(Error);
@@ -34,35 +34,35 @@ describe('Helmet', function() {
var fn = function() {
- var helmet = new Helmet({websocketPort: 3001});
+ var tv = new Tv({websocketPort: 3001});
};
expect(fn).to.not.throw(Error);
done();
});
- it('uses the helmet defaults when no config is passed in', function(done) {
+ it('uses the tv defaults when no config is passed in', function(done) {
- var helmet = new Helmet();
+ var tv = new Tv();
- expect(helmet.settings.host).to.equal('0.0.0.0');
- expect(helmet.settings.websocketPort).to.equal(3000);
+ expect(tv.settings.host).to.equal('0.0.0.0');
+ expect(tv.settings.websocketPort).to.equal(3000);
done();
});
it('uses the passed in config', function(done) {
- var helmet = new Helmet({host: 'localhost', websocketPort: 3002});
+ var tv = new Tv({host: 'localhost', websocketPort: 3002});
- expect(helmet.settings.host).to.equal('localhost');
- expect(helmet.settings.websocketPort).to.equal(3002);
+ expect(tv.settings.host).to.equal('localhost');
+ expect(tv.settings.websocketPort).to.equal(3002);
done();
});
it('adds message to subscribers list when receiving message', function(done) {
var config = {host: 'localhost', websocketPort: 3010}
- var helmet = new Helmet(config);
+ var tv = new Tv(config);
var ws = new Websocket("ws://" + config.host + ':' + config.websocketPort);
ws.readyState = Websocket.OPEN;
@@ -72,7 +72,7 @@ describe('Helmet', function() {
ws.send("test1");
setTimeout(function(){
- expect(helmet._subscribers["test1"]).to.exist;
+ expect(tv._subscribers["test1"]).to.exist;
done();
}, 1000);
});
@@ -83,8 +83,8 @@ describe('Helmet', function() {
it('sends the data to all subscribers when session is null', function(done) {
- var helmet = new Helmet({websocketPort: 3003});
- helmet._subscribers['*'] = [{
+ var tv = new Tv({websocketPort: 3003});
+ tv._subscribers['*'] = [{
readyState: Websocket.OPEN,
send: function(message) {
@@ -94,21 +94,21 @@ describe('Helmet', function() {
}
}];
- helmet.report(null, 'test');
+ tv.report(null, 'test');
});
it('only sends a message to the appropriate subscribers', function(done) {
- var helmet = new Helmet({websocketPort: 3004});
- helmet._subscribers['*'] = [{
+ var tv = new Tv({websocketPort: 3004});
+ tv._subscribers['*'] = [{
readyState: Websocket.OPEN,
send: function(message) {
expect(message).to.not.exist;
}
}];
- helmet._subscribers['test'] = [{
+ tv._subscribers['test'] = [{
readyState: Websocket.OPEN,
send: function(message) {
@@ -118,21 +118,21 @@ describe('Helmet', function() {
}
}];
- helmet.report('test', 'test');
+ tv.report('test', 'test');
});
it('only sends a message when the websocket exists', function(done) {
- var helmet = new Helmet({websocketPort: 3005});
- helmet._subscribers['*'] = [{
+ var tv = new Tv({websocketPort: 3005});
+ tv._subscribers['*'] = [{
readyState: 'none',
send: function(message) {
expect(message).to.not.exist;
}
}];
- helmet.report(null, 'test');
+ tv.report(null, 'test');
done();
});
});
@@ -141,9 +141,9 @@ describe('Helmet', function() {
it('includes the hostname and port in the source', function(done) {
- var helmet = new Helmet({host: 'localhost', websocketPort: 3006});
+ var tv = new Tv({host: 'localhost', websocketPort: 3006});
- var html = helmet.getMarkup();
+ var html = tv.getMarkup();
expect(html).to.contain('localhost');
expect(html).to.contain('3006');

0 comments on commit b0a4f97

Please sign in to comment.