-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gruntfile.js
124 lines (111 loc) · 2.87 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/**
* {{prettify}} by Jon Schlinkert
* http://github.com/helpers/prettify
*
* Copyright (c) 2013 Jon Schlinkert
* MIT License
*/
'use strict';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
jshint: {
all: [
'Gruntfile.js',
'index.js',
'lib/*.js',
'test/*.js'
],
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true,
node: true,
globals: {
describe: true,
it: true
}
}
},
assemble: {
options: {
flatten: true,
helpers: ['./index.js']
},
pages: {
options: {
it: 'Should prettify the generated HTML using default settings.',
prettify: {
padcomments: true
}
},
src: 'test/fixtures/*.hbs',
dest: 'test/actual/'
},
hash_options: {
options: {
it: 'Should prettify the generated HTML using hash options.',
},
src: 'test/fixtures/hash-*.hbs',
dest: 'test/actual/hash/'
},
opts_indent4: {
options: {
it: 'Should indent the generated HTML by 4 spaces',
prettify: {indent: 4}
},
src: 'test/fixtures/opts-indent.hbs',
dest: 'test/actual/opts/indent4.html'
},
opts_indent6: {
options: {
it: 'Should indent the generated HTML by 6 spaces',
prettify: {indent: 6}
},
src: 'test/fixtures/opts-indent.hbs',
dest: 'test/actual/opts/indent6.html'
},
opts_object: {
options: {
data: 'test/opts.json',
it: 'Should pass an options object to the helper as a parameter.',
},
src: 'test/fixtures/opts-object.hbs',
dest: 'test/actual/opts-object.html'
}
},
// Run mocha tests.
mochaTest: {
tests: {
options: {
reporter: 'progress',
},
src: ['test/*_test.js']
}
},
// Before generating any new files,
// remove files from previous build.
clean: {
example: ['test/actual/**']
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-readme');
grunt.loadNpmTasks('grunt-sync-pkg');
grunt.loadNpmTasks('assemble');
// When the "test" task is run, use Assemble to build templates
// with the "prettify" helper, then run tests with mocha.
grunt.registerTask('test', ['assemble', 'mochaTest']);
// By default, lint and run all tests.
grunt.registerTask('default', ['clean', 'jshint', 'assemble', 'sync', 'readme']);
};