-
Notifications
You must be signed in to change notification settings - Fork 112
/
Gruntfile.js
121 lines (116 loc) · 4.44 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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: '<%= grunt.util.linefeed %><%= grunt.util.linefeed %>',
},
preUMD: {
src: 'src/*.js',
dest: 'dist/<%= pkg.simpleName %>.js',
},
postUMD: {
options: {
banner: '// <%= pkg.simpleName %><%= grunt.util.linefeed %>// version: <%= pkg.version %><%= grunt.util.linefeed %>// (c) 2013 - <%= grunt.template.today("yyyy")%> <%= pkg.author.name %> <%= grunt.util.linefeed %>// <%= pkg.homepage %> <%= grunt.util.linefeed %>',
},
src: 'dist/<%= pkg.simpleName %>.js',
dest: 'dist/<%= pkg.simpleName %>.js',
}
},
umd: {
all: {
options: {
template: 'templates/umd-buckets.hbs',
src: 'dist/<%= pkg.simpleName %>.js',
objectToExport: '<%= pkg.simpleName %>', // optional, internal object that will be exported
}
}
},
uglify: {
options: {
banner: '/*! <%= pkg.simpleName %> - version: <%= pkg.version %> - (c) 2013 - <%= grunt.template.today("yyyy")%> <%= pkg.author.name %> - <%= pkg.homepage %>*/',
sourceMap: true
},
dist: {
files: {
'dist/<%= pkg.simpleName %>.min.js': ['dist/<%= pkg.simpleName %>.js']
}
}
},
jasmine: {
pivotal: {
src: 'dist/<%= pkg.simpleName %>.min.js',
options: {
specs: 'test/*.js',
summary: true,
}
}
},
shell: {
jsdoc: {
command: 'node node_modules/jsdoc2/app/run.js ./dist/<%= pkg.simpleName %>.js -d=doc/ -s -D=\"noGlobal:true\" -D=\"title:Buckets\" -t=templates/jsdoc-buckets'
}
},
jsbeautifier: {
files: ['dist/<%= pkg.simpleName %>.js', 'src/*.js', 'test/*.js'],
options: {
js: {
jslintHappy: true,
}
}
},
bump: {
options: {
files: ['package.json', 'bower.json', 'dist/buckets.js', 'dist/buckets.min.js'],
updateConfigs: [],
commit: true,
commitMessage: 'Release v%VERSION%',
commitFiles: ['package.json', 'bower.json', 'dist/buckets.js', 'dist/buckets.min.js'],
createTag: true,
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
push: true,
pushTo: 'origin',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',
globalReplace: false,
prereleaseName: false,
metadata: '',
regExp: false
}
},
'gh-pages': {
options: {
base: 'doc',
repo: 'https://' + process.env.GH_TOKEN + '@' + process.env.GH_REF,
message: 'Lastest jsdoc on successful travis build ' + process.env.TRAVIS_BUILD_NUMBER + ' auto-pushed to gh-pages',
silent: true, // Hide GH_TOKEN from log messages
user: {
name: 'travis-ci',
email: 'travis@travis-ci.org'
}
},
src: ['**/*']
}
});
require("load-grunt-tasks")(grunt);
//////////////////////////
// Declare all the available tasks
//////////////////////////
grunt.registerTask('publish-docs', function() {
grunt.task.run('doc');
// Only publish under these conditions
if (process.env.TRAVIS === 'true' &&
process.env.TRAVIS_SECURE_ENV_VARS === 'true' &&
process.env.TRAVIS_PULL_REQUEST === 'false') {
grunt.log.writeln('Publishing documentation...');
grunt.task.run('gh-pages');
}
else {
grunt.log.writeln('Skipped doc publishing');
}
});
grunt.registerTask('build', ['concat:preUMD', 'umd:all', 'concat:postUMD', 'uglify', 'jsbeautifier']);
grunt.registerTask('test', ['jasmine']);
grunt.registerTask('doc', ['shell:jsdoc']);
grunt.registerTask('default', ['build', 'test', 'doc']);
};