forked from maksimr/vim-jsbeautify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
95 lines (88 loc) · 2.57 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
84
85
86
87
88
89
90
91
92
93
94
95
/**
* Project configuration.
* @param {Object} grunt The global object.
*
* 2012-06-30
*/
module.exports = function(grunt) {
grunt.initConfig({
urchin: {
args: ['-f', 'test']
},
uglify: {
options: {
compress: false,
mangle: false
},
dist: {
files: {
'plugin/beautify.min.js': ['plugin/beautify.js']
}
}
},
nodeunit: {
all: ['test/javascript/*_test.js'],
node: ['test/javascript/beautify_test.js']
},
lint: {
files: ['grunt.js', 'plugin/*js', '<config:test.files>']
},
watch: {
vim: {
files: ['plugin/*.vim', 'test/vim/**/*'],
tasks: 'urchin'
},
javascript: {
files: ['plugin/*.js', 'test/javascript/**/*.js'],
tasks: 'test'
}
},
jshint: {
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true,
node: true
},
globals: {
exports: true,
module: false
}
}
});
grunt.registerTask('urchin', 'Urchin is a test framework for shell. It currently supports bash on GNU/Linux and Mac.', function() {
var data = grunt.config('urchin');
var util = grunt.util;
var args = data.args;
var log = grunt.log;
var done = this.async();
util.spawn({
cmd: './urchin',
args: args
}, function(err, result) {
err = err || result.stdout.match(/\n[^0]\d* tests failed/g);
if (!err) {
log.writeln(result);
return done(null);
}
// error handling
log.writeln(result);
done(false);
});
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
// Default task.
grunt.registerTask('test', ['nodeunit:all', 'urchin']);
grunt.registerTask('default', ['nodeunit:all', 'urchin']);
grunt.registerTask('build', ['jshint', 'nodeunit:all', 'urchin', 'uglify']);
};