forked from alexyoung/turing.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJakefile.js
More file actions
52 lines (45 loc) · 1.47 KB
/
Jakefile.js
File metadata and controls
52 lines (45 loc) · 1.47 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
var sys = require('sys'),
path = require('path'),
fs = require('fs'),
jsmin = require('jsmin').jsmin,
exec = require('child_process').exec;
desc('Builds build/turing.js.');
task('concat', [], function() {
var files = ('turing.core.js turing.oo.js turing.enumerable.js '
+ 'turing.functional.js turing.dom.js turing.plugins.js turing.events.js '
+ 'turing.net.js turing.touch.js turing.anim.js').split(' '),
filesLeft = files.length,
pathName = '.',
outFile = fs.openSync('build/turing.js', 'w+');
files.forEach(function(fileName) {
var fileName = path.join(pathName, fileName),
contents = fs.readFileSync(fileName);
sys.puts('Read: ' + contents.length + ', written: ' + fs.writeSync(outFile, contents.toString()));
});
fs.closeSync(outFile);
});
desc('Minifies!');
task('minify', [], function() {
// TODO
});
desc('Documentation');
task('docs', [], function() {
exec('dox --title Turing turing.*.js --intro docs/intro.md > docs/index.html');
});
desc('Run tests');
task('tests', [], function() {
require.paths.unshift('./test/turing-test/lib/');
fs.readdir('test', function(err, files) {
files.forEach(function(file) {
if (file.match(/^[^.](.*)test\.js$/)) {
try {
console.log('\n*** ' + file + '\n');
require('./test/' + file);
} catch(e) {
}
}
});
});
});
desc('Main build task');
task('build', ['concat', 'minify', 'docs'], function() {});