-
Notifications
You must be signed in to change notification settings - Fork 7
/
Gruntfile.js
65 lines (58 loc) · 1.4 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
* grunt-bumpup
* https://github.com/Darsain/grunt-bumpup
*
* Licensed under the MIT license.
* http://www.opensource.org/licenses/MIT
*/
'use strict';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('test/v.json'),
jshint: {
options: {
jshintrc: '.jshintrc',
},
all: [
'Gruntfile.js',
'tasks/*.js',
],
},
// Configuration to be run.
bumpup: {
options: {
dateformat: 'YYYY-MM-DD HH:mm',
normalize: true,
updateProps: {
pkg: 'test/v.json'
}
},
setters: {
timestamp: function () {
return +new Date();
}
},
files: ['test/v.json', 'test/d.json', 'test/vd.json'],
}
});
// Actually load this plugin's task(s).
grunt.loadTasks('tasks');
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-jshint');
// Registering the testing task.
grunt.registerTask('test', function (type, build) {
var bumpParts = ['bumpup'];
if (type) { bumpParts.push(type); }
if (build) { bumpParts.push(build); }
grunt.task.run('logver');
grunt.task.run(bumpParts.join(':'));
grunt.task.run('logver');
});
// Registering the testing task.
grunt.registerTask('logver', function () {
grunt.log.writeln('version: ' + grunt.config.process('<%= pkg.version %>'));
});
// By default, lint and run all tests.
grunt.registerTask('default', ['jshint', 'bumpup']);
};