forked from mde/timezone-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jakefile
87 lines (71 loc) · 2.18 KB
/
Jakefile
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
var fs = require('fs')
, path = require('path');
namespace('test', function () {
desc('Sets up tests by downloading the timezone data.');
task('init', ['updateTzData'], function () {
complete();
}, {async: true});
task('clobberTzData', function () {
console.log('Removing old timezone data.');
jake.rmRf('lib/tz');
});
desc('Downloads the newest timezone data.');
task('updateTzData', ['clobberTzData'], function () {
var cmds = [
'echo "Downloading new timezone data ..."'
, 'curl ftp://ftp.iana.org/tz/tzdata-latest.tar.gz ' +
'-o lib/tz/tzdata-latest.tar.gz'
, 'echo "Expanding archive ..."'
, 'tar -xvzf lib/tz/tzdata-latest.tar.gz -C lib/tz'
];
jake.mkdirP('lib/tz');
jake.exec(cmds, function () {
console.log('Retrieved new timezone data');
console.log('Parsing tz...');
jake.exec('node src/node-preparse.js lib/tz > lib/all_cities.json', function () {
console.log('Done parsing tz');
complete();
}, {printStdout: true, printStderr: true});
}, {printStdout: true});
}, {async: true});
task('run', function () {
//Comply to 0.8.0 and 0.6.x
var existsSync = fs.existsSync || path.existsSync;
if (!existsSync('lib/tz')) {
fail('No timezone data. Please run "jake test:init".');
}
jake.exec(['jasmine-node spec'], function () {
complete();
}, {printStdout: true});
}, {async: true});
task('cli', ['init', 'run']);
});
desc('Runs the tests.');
task('test', ['test:run'], function () {});
namespace('doc', function () {
task('generate', ['doc:clobber'], function () {
var cmd = 'docco src/date.js';
console.log('Generating docs ...');
jake.exec([cmd], function () {
console.log('Done.');
complete();
});
}, {async: true});
task('clobber', function () {
var cmd = 'rm -fr ./docs';
jake.exec([cmd], function () {
console.log('Clobbered old docs.');
complete();
});
}, {async: true});
});
desc('Generates docs.');
task('doc', ['doc:generate']);
var p = new jake.NpmPublishTask('timezone-js', [
'Jakefile'
, 'README.md'
, 'package.json'
, 'spec/*'
, 'src/*'
]);
jake.Task['npm:definePackage'].invoke();