This repository has been archived by the owner on Aug 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
83 lines (77 loc) · 1.9 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
'use strict';
var path = require('path');
module.exports = function(grunt) {
var _ = require('lodash');
grunt.initConfig({
'pkg' : grunt.file.readJSON('package.json'),
'nodeunit' : {
'tests' : ['test/*_test.js']
},
'save_license' : _.extend(makeParams(), {
'format_text' : {
'src' : ['test/format/index.js'],
'format' : 'text',
'dest' : 'tmp/text.txt'
},
'format_js' : {
'src' : ['test/format/index.js'],
'format' : 'JavaScript',
'dest' : 'tmp/js.js'
},
'format_md' : {
'src' : ['test/format/index.js'],
'format' : 'Markdown',
'dest' : 'tmp/md.md'
},
'format_json' : {
'src' : ['test/format/index.js'],
'format' : 'JSON',
'dest' : 'tmp/json.json'
},
'format_missmatch' : {
'src' : ['test/format/index.js'],
'format' : 'JavaScript',
'dest' : 'tmp/missmatch.txt'
},
'format_autolookup' : {
'src' : ['test/format/index.js'],
'dest' : 'tmp/autolookup.txt'
},
'format_multi' : {
'src' : ['test/format/index.js'],
'dest' : ['tmp/multi.txt', 'tmp/multi.js']
}
}),
'clean' : {
'tests' : ['tmp']
},
'watch' : {
'scripts' : {
'files' : ['./tasks/*', './test/*'],
'tasks' : ['nodeunit']
}
},
'release' : {
'options' : {}
}
});
grunt.loadTasks('tasks');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-release');
grunt.registerTask('test', ['clean', 'save_license', 'nodeunit']);
grunt.registerTask('testWatch', ['test', 'watch']);
grunt.registerTask('release', ['release:patch']);
function makeParams () {
var files = grunt.file.expand('test/index/fixtures/*');
return files.reduce(function (obj, file) {
var base = path.basename(file);
obj[base] = {
'src' : [file + '/**/*.js'],
'dest' : 'tmp/' + base + '.json'
};
return obj;
}, {});
}
};