Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
generated/
node_modules/
22 changes: 22 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
License (The MIT License)
-------
Copyright (c) 2015 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.

Binary file added Word Doc/HTML Assignment-1.docx
Binary file not shown.
23 changes: 23 additions & 0 deletions build/config/build_command.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) 2012 Titanium I.T. LLC. All rights reserved. See LICENSE.txt for details.

// A cross-platform mechanism for determining how to run the build.
// There's no Quixote-specific configuration in this file.

(function() {
"use strict";

var UNIX_BUILD_COMMAND = "./jake.sh run";
var UNIX_Test_COMMAND = "./jake.sh loose=true ";
var WINDOWS_BUILD_COMMAND = "jake.bat run";
var WINDOWS_Test_COMMAND = "jake loose=true";

var os = require("os");

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

}());
67 changes: 67 additions & 0 deletions build/config/jshint.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Copyright (c) 2015 Titanium I.T. LLC. All rights reserved. For license, see "README" or "LICENSE" file.

// Configuration options for JSHint. Change this to match your preferences.
// There's no Quixote-specific configuration in this file.

(function() {
"use strict";

var merge = require("object-merge");

var universalOptions = {
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,
globalstrict: true, // "global" stricts are okay when using CommonJS modules
trailing: true
};

exports.nodeOptions = merge(universalOptions, {
node: true
});

exports.clientOptions = merge(universalOptions, {
browser: true
});

var universalGlobals = {
// Mocha
before: false,
after: false,
beforeEach: false,
afterEach: false,
describe: false,
it: false
};

exports.nodeGlobals = merge(universalGlobals, {
// Jake
jake: false,
desc: false,
task: false,
directory: false,
complete: false,
fail: false
});

exports.clientGlobals = merge(universalGlobals, {
// CommonJS
exports: false,
require: false,
module: false,

// Browser
console: false
});

}());
75 changes: 75 additions & 0 deletions build/config/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Karma configuration
// Quixote-specific configuration starts with "QUIXOTE:"

(function() {
"use strict";

var paths = require("./paths.js");

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

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

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

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

// QUIXOTE: Serve the CSS file so we can load it in our tests
// Mark it `included: false` so Karma doesn't load it automatically
{ pattern: 'src/screen.css', included: false }
],

// list of files to exclude
exclude: [],

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'src/**/*.js': ['commonjs'],
'vendor/**/*.js': ['commonjs']
},

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

// 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
});
};

}());
22 changes: 22 additions & 0 deletions build/config/paths.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) 2015 Titanium I.T. LLC. All rights reserved. For license, see "README" or "LICENSE" file.

// Lists commonly-used directories. They're all relative to the project root.
// There's no Quixote-specific configuration in this file.

(function() {
"use strict";

module.exports = {
generatedDir: "generated",
testDir: "generated/test",
distDir: "generated/dist",
clientDistDir: "generated/dist/client",
vendortDir: "vendor",

buildDir: "build",
clientDir: "src",
clientEntryPoint: "src/toggle.js",
clientDistBundle: "generated/dist/client/bundle.js"
};

}());
17 changes: 17 additions & 0 deletions build/config/tested_browsers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) 2014 Titanium I.T. LLC. All rights reserved. For license, see "README" or "LICENSE" file.
(function() {
"use strict";

// Uncomment and modify the following list to cause the build to fail unless these browsers are tested.
// There's no Quixote-specific configuration in this file.

module.exports = [
//"IE 10.0.0 (Windows 7 0.0.0)",
//"Firefox 41.0.0 (Mac OS X 10.10.0)",
//"Chrome 46.0.2490 (Mac OS X 10.10.5)",
//"Safari 9.0.1 (Mac OS X 10.10.5)",
//"Mobile Safari 8.0.0 (iOS 8.4.0)",
//"Chrome Mobile 44.0.2403 (Android 6.0.0)"
];

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

// Main build file. Contains all tasks needed for normal development.
// There's no Quixote-specific configuration in this file.

(function() {
"use strict";

var startTime = Date.now();

var shell = require("shelljs");
var jshint = require("simplebuild-jshint");
var karma = require("simplebuild-karma");
var browserify = require("../util/browserify_runner.js");

var browsers = require("../config/tested_browsers.js");
var jshintConfig = require("../config/jshint.conf.js");
var paths = require("../config/paths.js");

var KARMA_CONFIG = "./build/config/karma.conf.js";

var strict = !process.env.loose;


//*** GENERAL

desc("Lint and test");
task("default", [ "lint", "test" ], function() {
var elapsedSeconds = (Date.now() - startTime) / 1000;
console.log("\n\nBUILD OK (" + elapsedSeconds.toFixed(2) + "s)");
});

desc("Start server (for manual testing)");
task("run", [ "build" ], function() {
jake.exec("node ./node_modules/http-server/bin/http-server " + paths.clientDistDir, { interactive: true }, complete);
}, { async: true });

desc("Delete generated files");
task("clean", function() {
shell.rm("-rf", paths.generatedDir);
});


//*** LINT

desc("Lint everything");
task("lint", ["lintNode", "lintClient"]);

task("lintNode", function() {
process.stdout.write("Linting Node.js code: ");
jshint.checkFiles({
files: [ paths.buildDir + "/**/*.js" ],
options: jshintConfig.nodeOptions,
globals: jshintConfig.nodeGlobals
}, complete, fail);
}, { async: true });

task("lintClient", function() {
process.stdout.write("Linting browser code: ");
jshint.checkFiles({
files: [ paths.clientDir + "/**/*.js" ],
options: jshintConfig.clientOptions,
globals: jshintConfig.clientGlobals
}, complete, fail);
}, { async: true });


//*** TEST

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

desc("Run tests");
task("test", function() {
console.log("Testing browser code: ");

var browsersToCapture = process.env.capture ? process.env.capture.split(",") : [];
karma.run({
configFile: KARMA_CONFIG,
expectedBrowsers: browsers,
strict: strict,
capture: browsersToCapture
}, complete, fail);
}, { async: true });


//*** BUILD

desc("Build distribution package");
task("build", [ "prepDistDir", "buildClient" ]);

task("prepDistDir", function() {
shell.rm("-rf", paths.distDir);
});

task("buildClient", [ paths.clientDistDir, "bundleClientJs" ], function() {
console.log("Copying client code: .");
shell.cp(
paths.clientDir + "/*.html",
paths.clientDir + "/*.css",
paths.clientDir + "/*.svg",
paths.clientDistDir
);
});

task("bundleClientJs", [ paths.clientDistDir ], function() {
console.log("Bundling browser code with Browserify: .");
browserify.bundle({
entry: paths.clientEntryPoint,
outfile: paths.clientDistBundle,
options: {
standalone: "toggle",
debug: true
}
}, complete, fail);
}, { async: true });


//*** CREATE DIRECTORIES

directory(paths.testDir);
directory(paths.clientDistDir);

}());
7 changes: 7 additions & 0 deletions build/scripts/run_jake.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off
REM Runs Jake from node_modules directory, preventing it from needing to be installed globally
REM Also ensures node modules have been installed
REM There's no Quixote-specific configuration in this file.

if not exist node_modules\.bin\jake.cmd call npm install
node_modules\.bin\jake %*
6 changes: 6 additions & 0 deletions build/scripts/run_jake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Runs Jake from node_modules directory, preventing it from needing to be installed globally
# Also ensures node modules have been installed
# There's no Quixote-specific configuration in this file.

[ ! -f node_modules/.bin/jake ] && echo "Installing npm modules:" && npm install
node_modules/.bin/jake $*
Loading