This repository has been archived by the owner on Mar 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
134 lines (125 loc) · 3.55 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
'use strict';
module.exports = function(grunt) {
require('time-grunt')(grunt);
require('load-grunt-tasks')(grunt);
// Project configuration.
grunt.initConfig({
// Task configuration.
bump: {
options: {
files: ['package.json'],
updateConfigs: [],
commit: true,
commitMessage: 'Release %VERSION%',
commitFiles: ['package.json', 'CHANGELOG.md', 'changelog/*', '\"changelog/Unreleased\"'],
createTag: true,
tagName: '%VERSION%',
tagMessage: 'Version %VERSION%',
push: true,
pushTo: 'upstream',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',
globalReplace: false,
prereleaseName: 'rc',
metadata: '',
regExp: false
}
},
watch: {
options: {
//spawn: false
},
yaml: {
files: ['**/*.yaml', '**/*.yml', '!**/node_modules/**', '!**/transformers/**'],
tasks: ['newer:yaml_validator']
},
ruby: {
files: ['**/*.rb', '!**/node_modules/**'],
tasks: ['shell:style']
}
},
// Make sure there are no obvious mistakes
yaml_validator: {
options: {
structure: [],
yaml: null
},
all: {
options: {},
src: ['**/*.yaml', '**/*.yml', '!**/node_modules/**', '!**/transformers/**', '.*.yml']
}
},
shell: {
options: {
execOptions: {
maxBuffer: 1024 * 1024 * 5 // 5 MiB
}
},
rubocop: {
command: 'bundle exec rubocop -D'
},
rspec: {
command: 'bundle exec rspec --format=documentation'
},
cucumber: {
command: 'bundle exec cucumber --fail-fast'
},
build: {
command: 'gem build keepachangelog.gemspec'
},
bump_changelog: {
command: [
"mv 'changelog/Unreleased' 'changelog/" + grunt.option('setversion') + "'",
'keepachangelog --from yaml --to md > CHANGELOG.md',
"git add 'changelog/" + grunt.option('setversion') + "'"
].join('&&')
}
},
environments: {
options: {
username: process.env.SSH_USER,
privateKey: process.env.SSH_KEY
},
download: {
options: {
host: process.env.TARGET_HOST,
local_path: 'keepachangelog-*.gem',
deploy_path: process.env.TARGET_PATH
}
}
},
'git-describe': {
options: {
// Task-specific options go here.
},
main: {
// Target-specific file lists and/or options go here.
},
}
});
// Tasks
grunt.registerTask('saveRevision', function() {
grunt.event.once('git-describe', function(rev) {
grunt.config.set('environments.options.tag', rev.tag);
});
grunt.task.run('git-describe');
});
grunt.registerTask('serve', ['watch']);
grunt.registerTask('lint', ['test:style']);
grunt.registerTask('test:style', ['yaml_validator', 'shell:rubocop']);
grunt.registerTask('test:spec', ['shell:rspec']);
grunt.registerTask('test:integration', ['shell:cucumber']);
grunt.registerTask('test', ['test:style',
'test:spec',
'test:integration']);
grunt.registerTask('build', ['shell:build']);
grunt.registerTask('release', function() {
grunt.task.run(['shell:bump_changelog']);
grunt.task.run('bump');
});
grunt.registerTask('publish', function() {
grunt.task.run('saveRevision');
grunt.task.run(['ssh_deploy:download']);
});
// Default task.
grunt.registerTask('default', ['serve']);
};