UNPKG

2.18 kBJavaScriptView Raw
1module.exports = function(grunt) {
2 'use strict';
3
4 grunt.initConfig({
5
6 clean: {
7 test: 'test/fixtures/_*.json'
8 },
9 nodeunit: {
10 tests: 'test/release_test.js'
11 },
12 release: {
13 options: {
14 bump: true,
15 file: 'package.json',
16 changelog: 'CHANGELOG.md',
17 changelogText: '### <%= version %>\n',
18 commitMessage: 'v<%= version %>',
19 add: true,
20 commit: true,
21 tag: true,
22 push: true,
23 pushTags: true,
24 npm: true,
25 npmtag: false,
26 github: {
27 repo: 'geddski/grunt-release',
28 usernameVar: 'GITHUB_USERNAME',
29 passwordVar: 'GITHUB_PASSWORD'
30 }
31 }
32 },
33 setup: {
34 test: {
35 files: [{
36 src: 'test/fixtures/component.json',
37 dest: 'test/fixtures/_component.json'
38 },{
39 src: 'test/fixtures/bower.json',
40 dest: 'test/fixtures/_bower.json'
41 },{
42 src: 'test/fixtures/CHANGELOG.md',
43 dest: 'test/fixtures/_CHANGELOG.md'
44 }]
45 }
46 }
47 });
48
49 grunt.loadTasks('tasks');
50 grunt.loadNpmTasks('grunt-contrib-clean');
51 grunt.loadNpmTasks('grunt-contrib-nodeunit');
52
53 grunt.registerTask('test', [
54 'clean',
55 'setup',
56 'release',
57 'nodeunit',
58 'clean'
59 ]);
60
61 grunt.registerMultiTask('setup', 'Setup test fixtures', function(){
62 this.files.forEach(function(f){
63 grunt.file.copy(f.src, f.dest);
64 });
65 grunt.config.set('release.options.file', 'test/fixtures/_component.json');
66 grunt.config.set('release.options.changelog', 'test/fixtures/_CHANGELOG.md');
67 grunt.config.set('release.options.changelogText', '### <%= version %>\n');
68 grunt.config.set('release.options.add', false);
69 grunt.config.set('release.options.commit', false);
70 grunt.config.set('release.options.tag', false);
71 grunt.config.set('release.options.push', false);
72 grunt.config.set('release.options.pushTags', false);
73 grunt.config.set('release.options.npm', false);
74 grunt.config.set('release.options.github', false);
75 grunt.config.set('release.options.additionalFiles', ['test/fixtures/_bower.json']);
76 });
77};