forked from jamesshore/object_playground
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJakefile.js
More file actions
109 lines (93 loc) · 2.58 KB
/
Jakefile.js
File metadata and controls
109 lines (93 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// 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";
var TESTED_BROWSERS = [
// "IE 8.0 (Windows)", // DOES NOT WORK -- no SVG support
// "IE 9.0 (Windows)", // DOES NOT WORK -- no Int32Array support and shim causes 'Out of memory' error
"IE 10.0 (Windows)",
"Firefox 25.0 (Mac)",
"Chrome 31.0 (Mac)",
"Safari 6.1 (Mac)",
"Safari 7.0 (iOS)"
];
var NODE_VERSION = "v0.10.21";
var lint = require("./build/util/lint_runner.js");
var karma = require("./build/util/karma_runner.js");
var version = require("./build/util/version_checker.js");
desc("Lint and test");
task("default", ["lint", "test"], function() {
console.log("\n\nBUILD OK");
});
desc("Start Karma server -- run this first");
task("karma", function() {
karma.serve(complete, fail);
}, {async: true});
desc("Lint everything");
task("lint", ["nodeVersion"], function () {
var passed = lint.validateFileList(nodeFilesToLint(), nodeLintOptions(), {});
passed = lint.validateFileList(browserFilesToLint(), browserLintOptions(), browserLintGlobals()) && passed;
if (!passed) fail("Lint failed");
});
desc("Test browser code");
task("test", function() {
karma.runTests(TESTED_BROWSERS, complete, fail);
}, {async: true});
// desc("Ensure installed version of Node is same as known-good version");
task("nodeVersion", [], function() {
var installedVersion = process.version;
version.check("Node", !process.env.loose, NODE_VERSION, installedVersion, fail);
});
function nodeFilesToLint() {
var files = new jake.FileList();
files.include("build/util/**/*.js");
files.include("Jakefile.js");
return files.toArray();
}
function browserFilesToLint() {
var files = new jake.FileList();
files.include("src/*.js");
return files.toArray();
}
function sharedLintOptions() {
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 = sharedLintOptions();
options.node = true;
return options;
}
function browserLintOptions() {
var options = sharedLintOptions();
options.browser = true;
return options;
}
function browserLintGlobals() {
return {
jdls: true,
console: false,
mocha: false,
describe: false,
it: false,
expect: false,
dump: false,
beforeEach: false,
afterEach: false
};
}
}());