This repository has been archived by the owner on Mar 4, 2021. It is now read-only.
forked from outaTiME/grunt-replace
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
134 lines (121 loc) · 2.52 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
125
126
127
128
129
130
131
132
133
134
/*
* grunt-replace-regex
*
* Copyright (c) 2016 outaTiME
* Licensed under the MIT license.
* https://github.com/outaTiME/grunt-replace/blob/master/LICENSE-MIT
*/
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
jshint: {
options: {
jshintrc: '.jshintrc'
},
gruntfile: {
src: 'Gruntfile.js'
},
tasks: {
src: ['tasks/**/*.js']
},
test: {
src: ['test/**/*.js']
}
},
clean: {
test: ['tmp']
},
replace: {
simple: {
options: {
variables: {
key: 'value'
}
},
files: [
{expand: true, flatten: true, src: ['test/fixtures/simple.txt'],
dest: 'tmp/'}
]
},
verbose: {
options: {
variables: {
key: 'value'
}
},
files: [
{expand: true, flatten: true, src: ['test/fixtures/verbose.txt'],
dest: 'tmp/'}
]
},
warning: {
options: {
patterns: [
{
match: 'key',
replacement: 'value'
},
{
match: 'undefined-key',
replacement: 'value'
}
]
},
files: [
{expand: true, flatten: true, src: ['test/fixtures/warning.txt'],
dest: 'tmp/'}
]
},
fail: {
options: {
pedantic: true,
patterns: [
{
match: 'key',
replacement: 'value'
},
{
match: 'undefined-key',
replacement: 'value'
}
]
},
files: [
{expand: true, flatten: true, src: ['test/fixtures/fail.txt'],
dest: 'tmp/'}
]
},
'built-in': {
options: {
// pass
},
files: [
{expand: true, flatten: true, src: ['test/fixtures/built-in_*.txt'],
dest: 'tmp/'}
]
}
},
mochaTest: {
test: {
options: {
reporter: 'spec'
},
src: '<%= jshint.test.src %>'
}
}
});
grunt.loadTasks('tasks');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.registerTask('test', [
'clean',
'replace:simple',
'replace:built-in',
'mochaTest'
]);
grunt.registerTask('default', [
'jshint',
'test'
]);
};