Skip to content

Commit

Permalink
Initial commit (based on 'automatopia' repository)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesshore committed Sep 24, 2013
0 parents commit 1247cc9
Show file tree
Hide file tree
Showing 3,538 changed files with 797,740 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.DS_Store
.idea/workspace.xml
.bin
node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build
node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/builderror.log
node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build
node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/builderror.log
node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/rsa/RSAKey.as
node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom
node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/location.js
node_modules/karma-phantomjs-launcher/node_modules/phantomjs/tmp
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/8_automatopia.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/jsLibraryMappings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/libraries/sass_stdlib.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/scopes/scope_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

105 changes: 105 additions & 0 deletions Jakefile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
// Copyright (c) 2012 Titanium I.T. LLC. All rights reserved. See LICENSE.txt for details.
/*global desc, task, jake, fail, complete, directory, require, console, process */
(function () {
"use strict";

// Uncomment and modify the following list to cause the build to fail unless these browsers are tested.
var REQUIRED_BROWSERS = [
// "IE 8.0.0 (Windows XP)",
// "IE 9.0.0 (Windows 7)",
// "Firefox 23.0.0 (Mac OS X 10.8)",
// "Chrome 29.0.1547 (Mac OS X 10.8.5)",
// "Safari 6.0.5 (Mac OS X 10.8.5)",
// "Mobile Safari 6.0.0 (iOS 6.1)"
];

var lint = require("./build/util/lint_runner.js");
var nodeunit = require("./build/util/nodeunit_runner.js");
var karma = require("./build/util/karma_runner.js");

desc("Lint and test");
task("default", ["lint", "test"], function() {
console.log("\n\nOK");
});

desc("Start Karma server -- run this first");
task("karma", function() {
karma.serve(complete, fail);
}, {async: true});

desc("Lint everything");
task("lint", [], function () {
var passed = lint.validateFileList(nodeFilesToLint(), nodeLintOptions(), {});
passed = lint.validateFileList(browserFilesToLint(), browserLintOptions(), {}) && passed;
if (!passed) fail("Lint failed");
});

desc("Test everything");
task("test", ["testServer", "testClient"]);

desc("Test node.js code");
task("testServer", function() {
nodeunit.runTests(nodeFilesToTest(), complete, fail);
}, {async: true});

desc("Test browser code");
task("testClient", function() {
karma.runTests(REQUIRED_BROWSERS, complete, fail);
}, {async: true});

function nodeFilesToTest() {
var testFiles = new jake.FileList();
testFiles.include("src/_*_test.js");
testFiles.include("src/server/**/_*_test.js");
testFiles.exclude("node_modules");
var tests = testFiles.toArray();
return tests;
}

function nodeFilesToLint() {
var files = new jake.FileList();
files.include("src/*.js");
files.include("src/server/**/*.js");
files.include("build/util/**/*.js");
files.include("Jakefile.js");
return files.toArray();
}

function browserFilesToLint() {
var files = new jake.FileList();
files.include("src/client/**/*.js");
return files.toArray();
}

function globalLintOptions() {
return {
bitwise:true,
curly:false,
eqeqeq:true,
forin:true,
immed:true,
latedef:false,
newcap:true,
noarg:true,
noempty:true,
nonew:true,
regexp:true,
undef:true,
strict:true,
trailing:true
};
}

function nodeLintOptions() {
var options = globalLintOptions();
options.node = true;
return options;
}

function browserLintOptions() {
var options = globalLintOptions();
options.browser = true;
return options;
}

}());
21 changes: 21 additions & 0 deletions LICENSE.TXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
License (The MIT License)
-------
Copyright (c) 2012-2013 Titanium I.T. LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: node src/run.js $PORT
68 changes: 68 additions & 0 deletions build/config/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Karma configuration
// Generated on Tue Sep 24 2013 14:33:42 GMT-0700 (PDT)

module.exports = function(config) {
config.set({

// base path, that will be used to resolve files and exclude
basePath: '../..',


// frameworks to use
frameworks: ['mocha', 'expect'],


// list of files / patterns to load in the browser
files: [
'src/client/**/*.js'
],


// list of files to exclude
exclude: [

],


// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
reporters: ['progress'],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,


// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: [],


// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,


// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false
});
};
14 changes: 14 additions & 0 deletions build/util/build_command.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) 2012 Titanium I.T. LLC. All rights reserved. See LICENSE.txt for details.
(function() {
"use strict";

var UNIX_BUILD_COMMAND = "./jake.sh";
var WINDOWS_BUILD_COMMAND = "jake";

var os = require("os");

exports.get = function() {
return os.platform() === "win32" ? WINDOWS_BUILD_COMMAND : UNIX_BUILD_COMMAND;
};

}());
62 changes: 62 additions & 0 deletions build/util/karma_runner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Copyright (c) 2012 Titanium I.T. LLC. All rights reserved. See LICENSE.txt for details.
(function() {
"use strict";

var KARMA = "node node_modules/karma/bin/karma";
var KARMA_START = KARMA + " start build/config/karma.conf.js";
var CONFIG = {};

var sh = require("./sh.js");
var runner = require("karma/lib/runner");

exports.serve = function(success, fail) {
sh.run(KARMA_START, success, function() {
fail("Could not start Karma server");
});
};

exports.runTests = function(requiredBrowsers, success, fail) {
var stdout = new CapturedStdout();

runner.run(CONFIG, function(exitCode) {
stdout.restore();

if (exitCode) fail("Client tests failed (to start server, run 'jake karma')");
var browserMissing = checkRequiredBrowsers(requiredBrowsers, stdout);
if (browserMissing && !process.env.loose) fail("Did not test all supported browsers (use 'loose=true' to suppress error)");
if (stdout.capturedOutput.indexOf("TOTAL: 0 SUCCESS") !== -1) fail("No tests were run!");

success();
});
};

function checkRequiredBrowsers(requiredBrowsers, stdout) {
var browserMissing = false;
requiredBrowsers.forEach(function(browser) {
browserMissing = lookForBrowser(browser, stdout.capturedOutput) || browserMissing;
});
return browserMissing;
}

function lookForBrowser(browser, output) {
var missing = output.indexOf(browser + ": Executed") === -1;
if (missing) console.log(browser + " was not tested!");
return missing;
}

function CapturedStdout() {
var self = this;
self.oldStdout = process.stdout.write;
self.capturedOutput = "";

process.stdout.write = function(data) {
self.capturedOutput += data;
self.oldStdout.apply(this, arguments);
};
}

CapturedStdout.prototype.restore = function() {
process.stdout.write = this.oldStdout;
};

}());
34 changes: 34 additions & 0 deletions build/util/lint_runner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) 2012 Titanium I.T. LLC. All rights reserved. See LICENSE.txt for details.
"use strict";

var jshint = require("jshint").JSHINT;
var fs = require("fs");

exports.validateSource = function(sourceCode, options, globals, description) {
description = description ? description + " " : "";
var pass = jshint(sourceCode, options, globals);
if (pass) {
console.log(description + "ok");
}
else {
console.log(description + "failed");
jshint.errors.forEach(function(error) {
console.log(error.line + ": " + error.evidence.trim());
console.log(" " + error.reason);
});
}
return pass;
};

exports.validateFile = function(filename, options, globals) {
var sourceCode = fs.readFileSync(filename, "utf8");
return exports.validateSource(sourceCode, options, globals, filename);
};

exports.validateFileList = function(fileList, options, globals) {
var pass = true;
fileList.forEach(function(filename) {
pass = exports.validateFile(filename, options, globals) && pass;
});
return pass;
};
Loading

0 comments on commit 1247cc9

Please sign in to comment.