-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathGruntfile.js
More file actions
99 lines (89 loc) · 3.45 KB
/
Gruntfile.js
File metadata and controls
99 lines (89 loc) · 3.45 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
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
bower: grunt.file.readJSON('bower.json'),
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>; \n*/\n',
concat: {
options: {
separator: ';'
},
dist: {
src: ['public/js/backbone-command/**/*.js'],
dest: '<%= pkg.name %>.js'
}
},
uglify: {
dist: {
files: {
'<%= pkg.name %>.min.js': '<%= pkg.name %>.js'
},
options: {
banner: '<%= banner %>'
}
}
},
copy: {
backboneCommand: {
src: ['<%= pkg.name %>.js', '<%= pkg.name %>.min.js'],
dest: 'public/js/dist/'
}
},
watch: {
files: ['public/js/*.js'],
tasks: ['concat:dist', 'uglify:dist', 'copy:backboneCommand']
},
bump: {
options: {
files: ['package.json', 'bower.json'],
updateConfigs: ["pkg", "banner"],
commit: true,
commitMessage: 'Release v%VERSION%',
commitFiles: ['package.json', 'bower.json', '<%= pkg.name %>.min.js', '<%= pkg.name %>.js', 'public/js/dist/<%= pkg.name %>.min.js', 'public/js/dist/<%= pkg.name %>.js'], // '-a' for all files
createTag: true,
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
push: true,
pushTo: 'origin master',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d' // options to use with '$ git describe'
}
},
jasmine: {
components: {
src: [
'public/js/backbone-command/*js'
],
options: {
specs: 'spec/*Spec.js',
keepRunner: true,
vendor: [
'public/js/vendors/jquery/jquery.min.js',
'public/js/vendors/underscore/underscore-min.js',
'public/js/vendors/backbone/backbone-min.js',
'public/js/vendors/injector.js/injector-js.min.js'
]
}
}
}
});
// plugins
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-bump');
// tasks
grunt.registerTask('default', ['concat', 'uglify', 'copy']);
grunt.registerTask('release', ['default', 'bump-commit']);
grunt.registerTask('release:patch', ['bump-only:patch', 'release']);
grunt.registerTask('release:minor', ['bump-only:minor', 'release']);
grunt.registerTask('release:major', ['bump-only:major', 'release']);
// travis!
grunt.registerTask('travis', 'Testing specs on Travis-CI', [
// 'jshint', TODO maybe implement jshint for strict coding?
'jasmine'
]);
};