WIP on pure JS revamp

This commit is contained in:
deadprogram 2014-02-27 06:44:53 -08:00
parent b614d85650
commit b27756abfc
37 changed files with 124 additions and 151 deletions

17
Makefile Normal file
View File

@ -0,0 +1,17 @@
BIN := ./node_modules/.bin
TEST_FILES := test/support/globals.js $(shell find test/specs -type f -name "*.js")
# Our 'phony' make targets (don't involve any file changes)
.PHONY: test bdd lint
# Run Mocha, with standard reporter.
test:
@$(BIN)/mocha -r cylon --colors $(TEST_FILES)
# Run Mocha, with more verbose BDD reporter.
bdd:
@$(BIN)/mocha -r cylon --colors -R spec $(TEST_FILES)
# Run JSHint
lint:
@$(BIN)/jshint ./lib

50
dist/test/loopback.js vendored
View File

@ -1,50 +0,0 @@
/*
* Loopback adaptor
* cylonjs.com
*
* Copyright (c) 2013 The Hybrid Group
* Licensed under the Apache 2.0 license.
*/
(function() {
'use strict';
var namespace,
__slice = [].slice,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
namespace = require('node-namespace');
module.exports = {
adaptor: function() {
var args;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return (function(func, args, ctor) {
ctor.prototype = func.prototype;
var child = new ctor, result = func.apply(child, args);
return Object(result) === result ? result : child;
})(Cylon.Adaptors.Loopback, args, function(){});
}
};
namespace('Cylon.Adaptors', function() {
var _ref;
return this.Loopback = (function(_super) {
__extends(Loopback, _super);
function Loopback() {
_ref = Loopback.__super__.constructor.apply(this, arguments);
return _ref;
}
Loopback.prototype.commands = function() {
return ['ping'];
};
return Loopback;
})(Cylon.Adaptor);
});
}).call(this);

54
dist/test/ping.js vendored
View File

@ -1,54 +0,0 @@
/*
* Ping driver
* cylonjs.com
*
* Copyright (c) 2013 The Hybrid Group
* Licensed under the Apache 2.0 license.
*/
(function() {
'use strict';
var namespace,
__slice = [].slice,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
namespace = require('node-namespace');
module.exports = {
driver: function() {
var args;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return (function(func, args, ctor) {
ctor.prototype = func.prototype;
var child = new ctor, result = func.apply(child, args);
return Object(result) === result ? result : child;
})(Cylon.Drivers.Ping, args, function(){});
}
};
namespace('Cylon.Drivers', function() {
var _ref;
return this.Ping = (function(_super) {
__extends(Ping, _super);
function Ping() {
_ref = Ping.__super__.constructor.apply(this, arguments);
return _ref;
}
Ping.prototype.commands = function() {
return ['ping'];
};
Ping.prototype.ping = function() {
return "pong";
};
return Ping;
})(Cylon.Driver);
});
}).call(this);

View File

@ -1,47 +0,0 @@
/*
* Test adaptor
* cylonjs.com
*
* Copyright (c) 2013 The Hybrid Group
* Licensed under the Apache 2.0 license.
*/
(function() {
'use strict';
var namespace,
__slice = [].slice,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
namespace = require('node-namespace');
module.exports = {
adaptor: function() {
var args;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return (function(func, args, ctor) {
ctor.prototype = func.prototype;
var child = new ctor, result = func.apply(child, args);
return Object(result) === result ? result : child;
})(Cylon.Adaptors.TestAdaptor, args, function(){});
}
};
namespace('Cylon.Adaptors', function() {
return this.TestAdaptor = (function(_super) {
__extends(TestAdaptor, _super);
function TestAdaptor(opts) {
if (opts == null) {
opts = {};
}
TestAdaptor.__super__.constructor.apply(this, arguments);
}
return TestAdaptor;
})(Cylon.Adaptor);
});
}).call(this);

35
lib/test/loopback.js Normal file
View File

@ -0,0 +1,35 @@
/*
* Loopback adaptor
* cylonjs.com
*
* Copyright (c) 2013-2014 The Hybrid Group
* Licensed under the Apache 2.0 license.
*/
"use strict";
var namespace = require('node-namespace');
module.exports = {
adaptor: function(opts) {
return new Cylon.Adaptors.Loopback(opts);
}
};
namespace("Cylon.Adaptors", function() {
this.Loopback = (function(klass) {
subclass(Loopback, klass);
function Loopback() {
_ref = Loopback.__super__.constructor.apply(this, arguments);
return _ref;
}
Loopback.prototype.commands = function() {
return ['ping'];
};
return Loopback;
})(Cylon.Adaptor);
});

39
lib/test/ping.js Normal file
View File

@ -0,0 +1,39 @@
/*
* Ping driver
* cylonjs.com
*
* Copyright (c) 2013-2014 The Hybrid Group
* Licensed under the Apache 2.0 license.
*/
'use strict';
var namespace = require('node-namespace');
module.exports = {
driver: function(opts) {
return new Cylon.Drivers.Ping(opts);
}
};
namespace("Cylon.Drivers", function() {
this.Ping = (function(klass) {
subclass(Ping, klass);
function Ping() {
_ref = Ping.__super__.constructor.apply(this, arguments);
return _ref;
}
Ping.prototype.commands = function() {
return ['ping'];
};
Ping.prototype.ping = function() {
return "pong";
};
return Ping;
})(Cylon.Driver);
});

33
lib/test/test-adaptor.js Normal file
View File

@ -0,0 +1,33 @@
/*
* Test adaptor
* cylonjs.com
*
* Copyright (c) 2013-2014 The Hybrid Group
* Licensed under the Apache 2.0 license.
*/
"use strict";
var namespace = require('node-namespace');
module.exports = {
adaptor: function(opts) {
return new Cylon.Adaptors.TestAdaptor(opts);
}
};
namespace("Cylon.Adaptors", function() {
this.TestAdaptor = (function(klass) {
subclass(TestAdaptor, klass);
function TestAdaptor(opts) {
if (opts == null) {
opts = {};
}
TestAdaptor.__super__.constructor.apply(this, arguments);
}
return TestAdaptor;
})(Cylon.Adaptor);
});