forked from lando/lando
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
145 lines (119 loc) · 3.45 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
135
136
137
138
139
140
141
142
143
144
145
'use strict';
module.exports = function(grunt) {
// loads all grunt-* tasks based on package.json definitions
require('matchdep').filterAll('grunt-*').forEach(grunt.loadNpmTasks);
// Load in common information we can use across tasks
var common = require('./tasks/common.js');
// Load in delegated responsibilities because cleanliness => godliness
var docs = require('./tasks/docs')(common);
var fs = require('./tasks/fs.js')(common);
var shell = require('./tasks/shell.js')(common);
var tests = require('./tasks/tests.js')(common);
var util = require('./tasks/util.js')(common);
// Our Grut config object
var config = {
// Linting, standards and styles tasks
jshint: tests.jshint,
jscs: tests.jscs,
// Mocha tests
mochacli: tests.unit,
// Copying tasks
copy: {
cliBuild: fs.copy.cli.build,
cliDist: fs.copy.cli.dist,
installerBuild: fs.copy.installer.build,
installerDist: fs.copy.installer.dist
},
// Copying tasks
clean: {
cliBuild: fs.clean.cli.build,
cliDist: fs.clean.cli.dist,
installerBuild: fs.clean.installer.build,
installerDist: fs.clean.installer.dist
},
// Shell tasks
shell: {
cliPkg: shell.cliPkgTask(),
gitBookBuild: shell.gitBookTask('build'),
gitBookInstall: shell.gitBookTask('install'),
gitBookServe: shell.gitBookTask('serve'),
installerPkgosx: shell.scriptTask('./scripts/build-osx.sh'),
installerPkglinux: shell.scriptTask('./scripts/build-linux.sh'),
installerPkgwin32: shell.psTask('./scripts/build-win32.ps1'),
installerosxBats: shell.batsTask(common.files.installerOsxBats),
installerlinuxBats: shell.batsTask(common.files.installerLinuxBats)
},
// JS docs tasks
jsdoc2md: docs.jsdoc2md,
// Utility tasks
bump: util.bump
};
// Load in all our task config
grunt.initConfig(config);
// Install and build our docs
grunt.registerTask('docs', [
'shell:gitBookInstall',
'shell:gitBookBuild',
'jsdoc2md'
]);
// Serve our docs
// NOTE: use this if you don't want to dogfood lando
grunt.registerTask('serve', [
'shell:gitBookInstall',
'jsdoc2md',
'shell:gitBookServe'
]);
// Check Linting, standards and styles
grunt.registerTask('test:code', [
'jshint',
'jscs'
]);
// Unit tests
grunt.registerTask('test:unit', [
'mochacli'
]);
// BATS tests
grunt.registerTask('test:bats', [
'shell:installer' + common.system.platform + 'Bats'
]);
// All tests
grunt.registerTask('test', [
'test:code',
'test:unit',
'test:bats'
]);
// Pkg the CLI binary
grunt.registerTask('pkg:cli', [
'clean:cliBuild',
'clean:cliDist',
'copy:cliBuild',
'shell:cliPkg',
'copy:cliDist'
]);
// Build the installer
//
// @NOTE: for reasons that make me want to stab my eyes out with a fucking
// spoon, you need to grun pkg:gui BEFORE pkg:cli or sass:compile will
// hang on Windows. THOU HATH BEEN WARNED.
//
grunt.registerTask('pkg', [
'clean:installerBuild',
'clean:installerDist',
'copy:installerBuild',
'pkg:cli',
'shell:installerPkg' + common.system.platform,
'copy:installerDist'
]);
// Bump our minor version
grunt.registerTask('bigrelease', [
'bump:minor'
]);
// Bump our patch version
grunt.registerTask('release', [
'bump:patch'
]);
// Do a prerelease version
grunt.registerTask('prerelease', [
'bump:prerelease'
]);
};