forked from canjs/canjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
grunt.js
107 lines (102 loc) · 3.17 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
95
96
97
98
99
100
101
102
103
104
105
106
107
module.exports = function (grunt) {
var _ = grunt.utils._;
var outFiles = {
edge : '<%= meta.out %>/edge/**/*.js',
latest : '<%= meta.out %>/<%= pkg.version %>/**/*.js'
};
grunt.initConfig({
pkg : '<json:package.json>',
meta : {
out : "dist/",
beautifier : {
options : {
indentSize : 1,
indentChar : "\t"
},
exclude : [/\.min\./, /qunit\.js/]
},
banner : '/*!\n* <%= 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 %>\n' +
'* Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n*/'
},
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
}
},
docco : {
edge : {
src : '<%= meta.out %>/edge/**/*.js',
docco : {
output : '<%= meta.out %>/edge/docs'
}
},
latest : {
src : '<%= meta.out %>/<%= pkg.version %>/**/*.js',
docco : {
output : '<%= meta.out %>/<%= pkg.version %>/docs'
}
},
_options : {
exclude : [/\.min\./, /amd\//, /qunit\.js/]
}
},
strip : outFiles,
bannerize : outFiles
});
grunt.loadTasks("../build/tasks");
grunt.registerTask("edge", "build:edge build:edgePlugins strip:edge beautify:dist docco:edge bannerize:edge");
grunt.registerTask("latest", "build:latest build:latestPlugins strip:latest beautify:dist bannerize:latest docco:latest");
grunt.registerTask("ghpages", "shell:cleanup shell:getGhPages shell:copyLatest shell:updateGhPages shell:cleanup");
grunt.registerTask("deploy", "latest ghpages shell:bundleLatest");
};