forked from canjs/canjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
grunt.js
94 lines (90 loc) · 2.91 KB
/
grunt.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
module.exports = function (grunt) {
var _ = grunt.utils._;
var excludes = [/\.min\./, /\/amd/, /qunit\.js/];
var outFiles = {
edge : '<%= meta.out %>/edge/**/*.js',
latest : '<%= meta.out %>/<%= pkg.version %>/**/*.js',
_options : {
exclude : excludes
}
};
grunt.initConfig({
pkg : '<json:package.json>',
meta : {
out : "dist/",
beautifier : {
options : {
indentSize : 1,
indentChar : "\t"
},
exclude : [/\.min\./, /qunit\.js/]
},
banner : '/*! <%= pkg.title || pkg.name %> - <%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'
},
beautifier : {
codebase : '<config:meta.beautifier>',
dist : '<config:meta.beautifier>'
},
beautify : {
codebase : [
'construct/**/*.js',
'control/**/*.js',
'model/**/*.js',
'observe/**/*.js',
'route/**/*.js',
'test/**/*.js',
'util/**/*.js'
],
dist : '<%= meta.out %>/**/*.js'
},
build : {
edge : {
src : "can/build/build.js",
out : 'can/<%= meta.out %>'
},
edgePlugins : {
src : "can/build/plugins.js",
out : 'can/<%= meta.out %>'
},
latest : {
src : "can/build/build.js",
version : '<%= pkg.version %>',
out : 'can/<%= meta.out %>'
},
latestPlugins : {
src : "can/build/plugins.js",
version : '<%= pkg.version %>',
out : 'can/<%= meta.out %>'
}
},
shell : {
bundleLatest : 'cd <%= meta.out %> && zip -r can.js.<%= pkg.version %>.zip <%= pkg.version %>/',
getGhPages : 'git clone -b gh-pages <%= pkg.repository.url %> build/gh-pages',
copyLatest : 'rm -rf build/gh-pages/release/<%= pkg.version %> && ' +
'cp -R <%= meta.out %>/<%= pkg.version %> build/gh-pages/release/<%= pkg.version %> && ' +
'rm -rf build/gh-pages/release/latest && ' +
'cp -R <%= meta.out %>/<%= pkg.version %> build/gh-pages/release/latest',
copyEdge : 'rm -rf build/gh-pages/release/edge && ' +
'cp -R <%= meta.out %>/edge build/gh-pages/release/edge',
updateGhPages : 'cd build/gh-pages && git add . --all && git commit -m "Updating release (latest: <%= pkg.version %>)" && ' +
'git push origin',
cleanup : 'rm -rf build/gh-pages',
_options : {
stdout : true,
failOnError : true
}
},
downloads : '<json:build/downloads.json>',
docco : outFiles,
strip : outFiles
});
grunt.loadTasks("../build/tasks");
grunt.registerTask("edge", "build:edge build:edgePlugins strip:edge beautify:dist");
grunt.registerTask("latest", "build:latest build:latestPlugins strip:latest beautify:dist docco:latest");
grunt.registerTask("ghpages", "shell:cleanup shell:getGhPages shell:copyLatest shell:updateGhPages shell:cleanup");
grunt.registerTask("deploy", "latest ghpages shell:bundleLatest downloads");
};