forked from moxiecode/plupload
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJakefile.js
executable file
·150 lines (121 loc) · 3.81 KB
/
Jakefile.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
var fs = require("fs");
var wrench = require("wrench");
var path = require("path");
var exec = require('child_process').exec;
var tools = require('./build/BuildTools');
var uglify = tools.uglify;
var less = tools.less;
var yuidoc = tools.yuidoc;
var jshint = tools.jshint;
var zip = tools.zip;
var wiki = require('./build/wiki');
function exit(message) {
if (message) {
console.info(message);
}
complete();
process.exit(arguments[1] || 0);
}
desc("Default build task");
task("default", ["minifyjs", "yuidoc"], function (params) {});
desc("Build release package");
task("release", ["default", "package"], function (params) {});
desc("Build mOxie");
task("moxie", [], function (params) {
var moxieDir = "src/moxie";
exec("cd " + moxieDir + "; jake lib; cd ../..;", function(error, stdout, stderr) {
if (!error) {
complete();
} else {
exit("mOxie: Build process failed.", 1);
}
});
}, true);
desc("Minify JS files");
task("minifyjs", ["moxie"], function (params) {
var targetDir = "./js", moxieDir = "src/moxie";
// Clear previous versions
if (path.existsSync(targetDir)) {
tools.rmDir(targetDir);
}
fs.mkdirSync(targetDir, 0755);
// Include Plupload source
tools.copySync('./src/plupload.js', "js/plupload.js");
// Copy compiled moxie files
tools.copySync(moxieDir + "/bin/flash/Moxie.swf", "js/Moxie.swf");
tools.copySync(moxieDir + "/bin/silverlight/Moxie.xap", "js/Moxie.xap");
tools.copySync(moxieDir + "/bin/js/moxie.min.js", "js/moxie.min.js");
tools.copySync(moxieDir + "/bin/js/moxie.js", "js/moxie.js");
// Copy UI Plupload
wrench.copyDirSyncRecursive("./src/jquery.ui.plupload", targetDir + "/jquery.ui.plupload", {});
uglify([
'jquery.ui.plupload.js'
], targetDir + "/jquery.ui.plupload/jquery.ui.plupload.min.js", {
sourceBase: targetDir + "/jquery.ui.plupload/"
});
// Copy Queue Plupload
wrench.copyDirSyncRecursive("./src/jquery.plupload.queue", targetDir + "/jquery.plupload.queue", {});
uglify([
'jquery.plupload.queue.js'
], targetDir + "/jquery.plupload.queue/jquery.plupload.queue.min.js", {
sourceBase: targetDir + "/jquery.plupload.queue/"
});
// Minify Plupload and combine with mOxie
uglify([
'plupload.js'
], targetDir + "/plupload.min.js", {
sourceBase: 'src/'
});
var releaseInfo = tools.getReleaseInfo("./changelog.txt");
tools.addReleaseDetailsTo(targetDir + "/plupload.js", releaseInfo);
tools.addReleaseDetailsTo(targetDir + "/plupload.min.js", releaseInfo);
var code = "";
code += fs.readFileSync(targetDir + "/moxie.min.js") + "\n";
code += fs.readFileSync(targetDir + "/plupload.min.js");
fs.writeFileSync(targetDir + "/plupload.full.min.js", code);
});
desc("Generate documentation using YUIDoc");
task("yuidoc", [], function (params) {
yuidoc("src", "docs", {
norecurse: true
});
});
desc("Generate wiki pages");
task("wiki", [], function() {
wiki("git@github.com:moxiecode/plupload.wiki.git", "wiki", "docs");
});
desc("Runs JSHint on source files");
task("jshint", [], function (params) {
jshint("src", {
curly: true
});
});
desc("Package library");
task("package", [], function (params) {
var releaseInfo = tools.getReleaseInfo("./changelog.txt");
var tmpDir = "./tmp";
if (path.existsSync(tmpDir)) {
wrench.rmdirSyncRecursive(tmpDir);
}
fs.mkdirSync(tmpDir, 0755);
// User package
zip([
"js",
"examples",
["readme.md", "readme.txt"],
"changelog.txt",
"license.txt"
], path.join(tmpDir, "plupload_" + releaseInfo.fileVersion + ".zip"));
// Development package
zip([
"src",
"js",
"examples",
"tests",
"build",
"Jakefile.js",
["readme.md", "readme.txt"],
"changelog.txt",
"license.txt"
], path.join(tmpDir, "plupload_" + releaseInfo.fileVersion + "_dev.zip"));
});