Skip to content

Commit

Permalink
Remove unused grunt tasks and helpers, add logging to the build process.
Browse files Browse the repository at this point in the history
  • Loading branch information
timrwood committed Jun 1, 2014
1 parent 91bd7ee commit ca361a5
Show file tree
Hide file tree
Showing 19 changed files with 61 additions and 757 deletions.
4 changes: 4 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ module.exports = function(grunt) {
},
jshint: {
all: 'moment-timezone.js'
},
clean: {
data: ['temp']
}
});

Expand All @@ -29,6 +32,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-clean');

grunt.registerTask('default', ['jshint', 'nodeunit']);
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
},
"devDependencies" : {
"grunt" : "0.4.4",
"grunt-contrib-clean" : "0.5.0",
"grunt-contrib-nodeunit" : "0.3.3",
"grunt-contrib-jshint" : "0.10.0",
"grunt-contrib-uglify" : "0.4.0"
Expand Down
19 changes: 0 additions & 19 deletions tasks/build-changes.js

This file was deleted.

20 changes: 0 additions & 20 deletions tasks/build-tests.js

This file was deleted.

2 changes: 2 additions & 0 deletions tasks/data-collect.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,7 @@ module.exports = function (grunt) {

grunt.file.mkdir('temp/collect');
grunt.file.write('temp/collect/' + version + '.json', JSON.stringify(data, null, 2));

grunt.log.ok('Collected data for ' + version);
});
};
2 changes: 2 additions & 0 deletions tasks/data-dedupe.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@ module.exports = function (grunt) {

grunt.file.mkdir('data/unpacked');
grunt.file.write('data/unpacked/' + version + '.json', JSON.stringify(deduped, null, 2));

grunt.log.ok('Deduped data for ' + version);
});
};
5 changes: 3 additions & 2 deletions tasks/data-download.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ module.exports = function (grunt) {
curl = path.resolve('temp/curl', version, 'data.tar.gz'),
dest = path.resolve('temp/download', version);

console.log(version, dest);

grunt.file.mkdir(path.dirname(curl));
grunt.file.mkdir(dest);

exec('curl ' + src + ' -o ' + curl + ' && cd ' + dest + ' && gzip -dc ' + curl + ' | tar -xf -', function (err) {
if (err) { throw err; }

grunt.log.ok('Downloaded ' + src);

done();
});
});
Expand Down
2 changes: 2 additions & 0 deletions tasks/data-pack.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ module.exports = function (grunt) {

grunt.file.mkdir('data/packed');
grunt.file.write('data/packed/' + version + '.json', JSON.stringify(packed, null, '\t'));

grunt.log.ok('Packed data for ' + version);
});
};
4 changes: 3 additions & 1 deletion tasks/data-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ module.exports = function (grunt) {

grunt.file.mkdir(path.dirname(dest));
grunt.file.write(dest, data);
grunt.log.ok("Created " + zone.name + " tests.");
grunt.verbose.ok("Created " + zone.name + " tests.");
});


grunt.log.ok('Created tests');
});
};

Expand Down
7 changes: 6 additions & 1 deletion tasks/data-zdump.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ module.exports = function (grunt) {
files = grunt.file.expand({ filter : 'isFile', cwd : 'temp/zic/' + version }, '**/*');

function next () {
if (!files.length) { done(); return; }
if (!files.length) {
grunt.log.ok('Dumped data for ' + version);
return done();
}

var file = files.pop(),
src = path.join(zicBase, file),
Expand All @@ -25,6 +28,8 @@ module.exports = function (grunt) {
grunt.file.mkdir(path.dirname(dest));
grunt.file.write(dest + '.zdump', stdout.replace(new RegExp(zicBase + '/', 'g'), ''));

grunt.verbose.ok('Dumped data for ' + version + ':' + file);

next();
});
}
Expand Down
23 changes: 16 additions & 7 deletions tasks/data-zic.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,28 @@ module.exports = function (grunt) {

var done = this.async(),
dest = path.resolve('temp/zic', version),
files = 'africa antarctica asia australasia backward etcetera europe northamerica pacificnew southamerica'.split(' '),
count = files.length;
files = 'africa antarctica asia australasia etcetera europe northamerica southamerica pacificnew backward'.split(' ');

grunt.file.mkdir(dest);

files.forEach(function (file) {
var src = path.resolve('temp/download', version, file);
function next () {
if (!files.length) {
grunt.log.ok('Compiled zic for ' + version);
return done();
}

var file = files.shift(),
src = path.resolve('temp/download', version, file);

exec('zic -d ' + dest + ' ' + src, function (err) {
if (err) { throw err; }
count--;
if (!count) { done(); }

grunt.verbose.ok('Compiled zic ' + version + ':' + file);

next();
});
});
}

next();
});
};
22 changes: 22 additions & 0 deletions tasks/data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"use strict";

module.exports = function (grunt) {
grunt.registerTask('data', 'Build timezone data.', function (version) {
version = version || 'latest';

grunt.task.run('clean:data');

grunt.task.run([
'data-download:' + version,
'data-zic:' + version,
'data-zdump:' + version,
'data-collect:' + version,
'data-dedupe:' + version,
'data-pack:' + version
]);

if (version === 'latest') {
grunt.task.run('data-tests');
}
});
};
33 changes: 0 additions & 33 deletions tasks/helpers/all-zones.js

This file was deleted.

41 changes: 0 additions & 41 deletions tasks/helpers/change.js

This file was deleted.

22 changes: 0 additions & 22 deletions tasks/helpers/to-base-60.js

This file was deleted.

36 changes: 0 additions & 36 deletions tasks/helpers/year.js

This file was deleted.

19 changes: 0 additions & 19 deletions tasks/helpers/zdump.js

This file was deleted.

Loading

0 comments on commit ca361a5

Please sign in to comment.