-
Notifications
You must be signed in to change notification settings - Fork 8
/
Gruntfile.js
48 lines (45 loc) · 1.14 KB
/
Gruntfile.js
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
/*jslint node:true */
module.exports = function (grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
all: ['src/*.js', 'spec/*.js']
},
mochaTest: {
test: {
options: {
reporter: 'spec',
quiet: false
},
src: ['spec/**.js']
}
},
publish: {
ip2country: {
src: [
'./'
]
}
}
});
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-bump');
grunt.loadNpmTasks('grunt-publish');
grunt.registerTask('build', 'Rebuild ip2country.js', function () {
var build = require('./src/build'),
done = this.async();
build.getMap(grunt.option('verbose')).then(function (map) {
var output = require('fs').createWriteStream('ip2country.js');
return build.buildOutput(map, output);
}).then(function() {
done(true);
}, function (err) {
console.error(err);
done(false);
});
});
grunt.registerTask('test', ['jshint', 'mochaTest']);
grunt.registerTask('default', ['build', 'test']);
};