This repository was archived by the owner on Aug 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGruntfile.js
More file actions
210 lines (195 loc) · 5.34 KB
/
Gruntfile.js
File metadata and controls
210 lines (195 loc) · 5.34 KB
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
'use strict';
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt); // Load grunt tasks automatically
var semver = require('semver');
var jsFiles = ['Gruntfile.js', 'tasks/*.js', 'test/**/*.js'];
var currentVersion = grunt.file.readJSON('package.json').version;
// Define the configuration for all the tasks
grunt.initConfig({
bump: {
options: {
pushTo: 'origin',
tagName: '%VERSION%'
}
},
jshint: {
options: {
jshintrc: true
},
all: jsFiles
},
jscs: {
options: {
config: '.jscsrc'
},
src: jsFiles
},
maildev: {
options: {
http: {
address: '0.0.0.0'
}
},
run: {
options: {
http: {
port: 1981
},
onNewMail: function(email) {console.log(email);}
},
keepAlive: true,
open: true
},
relay: {
options: {
smtp: {
relay: {
host: 'smtp.gmail.com',
port: 465,
secure: true,
user: 'you@gmail.com',
pass: 'your secret password',
auto: [{deny: '*'}, {allow: 'xavier.priour@bubblyware.com'}]
}
},
keepAlive: true,
open: true
}
},
fail: {
options: {
onNewMail: 'rasdr'
}
},
http: {
options: {
http: {
address: '0.0.0.0',
port: 8880,
user: 'user',
password: 'secret'
}
}
},
test: {
onNewMail: function(email) {console.log(email);},
options: {
smtp: {
port: 1625
},
http: {
port: 1680
}
}
}
},
prompt: {
bump: {
options: {
questions: [
{
config: 'bump.options.setVersion',
type: 'list',
message: 'Bump version from ' + currentVersion.cyan + ' to:',
choices: [
{
value: semver.inc(currentVersion, 'patch'),
// name: 'Patch: '.yellow + semver.inc('<%= pkg.version %>', 'patch').yellow +
name: ('Patch: ' + semver.inc(currentVersion, 'patch')).yellow +
' Backwards-compatible bug fixes.'
},
{
value: semver.inc(currentVersion, 'minor'),
name: ('Minor: ' + semver.inc(currentVersion, 'minor')).yellow +
' Add functionality in a backwards-compatible manner.'
},
{
value: semver.inc(currentVersion, 'major'),
name: ('Major: ' + semver.inc(currentVersion, 'major')).yellow +
' Incompatible API changes.'
},
{
value: 'custom',
name: 'Custom: ?.?.?'.yellow +
' Specify version...'
}
]
},
{
config: 'bump.options.setVersion',
type: 'input',
message: 'What specific version would you like',
when: function(answers) {
return answers['bump.increment'] === 'custom';
},
validate: function(value) {
var valid = semver.valid(value) && true;
return valid || 'Must be a valid semver, such as 1.2.3-rc1. See ' +
'http://semver.org/'.blue.underline + ' for more details.';
}
},
{
config: 'bump.files',
type: 'checkbox',
message: 'What should get the new version:',
choices: [
{
value: 'package',
name: 'package.json' +
(!grunt.file.isFile('package.json') ? ' file not found, will create one'.grey : ''),
checked: grunt.file.isFile('package.json')
},
{
value: 'bower',
name: 'bower.json' +
(!grunt.file.isFile('bower.json') ? ' file not found, will create one'.grey : ''),
checked: grunt.file.isFile('bower.json')
},
{
value: 'git',
name: 'git tag',
checked: grunt.file.isDir('.git')
}
]
}
]
}
}
},
// Watches files for changes and runs tasks based on the changed files
watch: {
options: {
// we don't want to lose the environment
spawn: false
},
gruntfile: {
files: ['Gruntfile.js']
// no tasks, this automatically triggers a watch restart
},
js: {
files: jsFiles,
tasks: ['test']
}
}
});
grunt.loadTasks('tasks');
grunt.registerTask('build', [
]);
grunt.registerTask('test', [
'jshint',
'jscs'
]);
grunt.registerTask('serve', [
'watch'
]);
grunt.registerTask('newRelease', 'Ready everything for new release', [
'prompt:bump',
'test',
'bump',
]);
grunt.registerTask('default', [
'build',
'test',
'serve'
]);
};