Skip to content

Commit 37ec372

Browse files
normalized export task for building project
1 parent efcaf8d commit 37ec372

File tree

3 files changed

+35
-39
lines changed

3 files changed

+35
-39
lines changed

cache/projectTemplate.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Export generator="Cache" version="25" zv="Cache for Windows (x86-64) 2015.2 (Build 540)" ts="2015-04-12 16:26:04">
3+
4+
<CSP name="CacheUMLExplorer.css" application="">
5+
<![CDATA[{{replace:css}}]]>
6+
</CSP>
7+
8+
<CSP name="CacheUMLExplorer.js" application="">
9+
<![CDATA[{{replace:js}}]]>
10+
</CSP>
11+
312
<Class name="UMLExplorer.ClassView">
413
<Description>
514
Class contains methods that return structured class data.</Description>
@@ -184,7 +193,9 @@ Method returns user application.</Description>
184193
<ClassMethod>1</ClassMethod>
185194
<ReturnType>%Status</ReturnType>
186195
<Implementation><![CDATA[
187-
&html<{{replace:HTML}}>
196+
&html<
197+
{{replace:HTML}}
198+
>
188199
return $$$OK
189200
]]></Implementation>
190201
</Method>

gulpfile.js

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var gulp = require("gulp"),
44
concat = require("gulp-concat"),
55
uglify = require("gulp-uglify"),
66
wrap = require("gulp-wrap"),
7+
addsrc = require('gulp-add-src'),
78
minifyCSS = require("gulp-minify-css"),
89
htmlReplace = require("gulp-html-replace"),
910
header = require("gulp-header"),
@@ -29,15 +30,10 @@ gulp.task("clean", function () {
2930
});
3031

3132
gulp.task("gatherScripts", ["clean"], function () {
32-
return gulp.src([
33-
"web/jsLib/joint.min.js",
34-
"web/jsLib/joint.shapes.uml.js",
35-
"web/jsLib/joint.layout.DirectedGraph.min.js",
36-
"web/js/*.js"
37-
])
33+
return gulp.src("web/js/*.js")
3834
.pipe(concat("CacheUMLExplorer.js"))
3935
.pipe(replace(/\/\*\{\{replace:version}}\*\//, "\"" + pkg["version"] + "\""))
40-
//.pipe(wrap("CacheUMLExplorer = (function(){<%= contents %> return CacheUMLExplorer;}());"))
36+
.pipe(wrap("CacheUMLExplorer = (function(){<%= contents %> return CacheUMLExplorer;}());"))
4137
.pipe(uglify({
4238
output: {
4339
ascii_only: true,
@@ -46,24 +42,19 @@ gulp.task("gatherScripts", ["clean"], function () {
4642
}
4743
}))
4844
.pipe(header(banner, { pkg: pkg }))
45+
.pipe(addsrc.prepend([
46+
"web/jsLib/joint.min.js",
47+
"web/jsLib/joint.shapes.uml.js",
48+
"web/jsLib/joint.layout.DirectedGraph.min.js"
49+
]))
50+
.pipe(concat("CacheUMLExplorer.js"))
4951
.pipe(gulp.dest("build/web/js/"));
5052
});
5153

52-
//gulp.task("concatScripts", ["gatherScripts"], function () {
53-
// return gulp.src([
54-
// "web/jsLib/joint.min.js",
55-
// "web/jsLib/joint.layout.DirectedGraph.min.js",
56-
// "web/jsLib/joint.shapes.uml.js",
57-
// "build/web/js/CacheUMLExplorer.js"
58-
// ])
59-
// .pipe(concat("CacheUMLExplorer.js"))
60-
// .pipe(gulp.dest("build/web/js/"));
61-
//});
62-
6354
gulp.task("gatherCSS", ["clean"], function () {
6455
return gulp.src("web/css/*.css")
6556
.pipe(concat("CacheUMLExplorer.css"))
66-
.pipe(minifyCSS())
57+
.pipe(minifyCSS({ keepSpecialComments: 0 }))
6758
.pipe(gulp.dest("build/web/css/"));
6859
});
6960

@@ -76,16 +67,6 @@ gulp.task("addHTMLFile", ["clean"], function () {
7667
.pipe(gulp.dest("build/web/"));
7768
});
7869

79-
gulp.task("addHTMLZIPFile", ["clean", "gatherScripts", "gatherCSS"], function () {
80-
var jsRepl = "<script type='text/javascript'>" + fs.readFileSync("build/web/js/CacheUMLExplorer.js", "utf-8") + "</script>",
81-
cssRepl = "<style type='text/css'>" + fs.readFileSync("build/web/css/CacheUMLExplorer.css") + "</style>";
82-
return gulp.src("web/index.html")
83-
.pipe(concat("ZIPindex.html"))
84-
.pipe(replace(/<!\-\- build:js \-\->(.|\r|\n)*<!\-\- endbuild \-\->/, function () { return jsRepl; }))
85-
.pipe(replace(/<!\-\- build:css \-\->(.|\r|\n)*<!\-\- endbuild \-\->/, function () { return cssRepl; }))
86-
.pipe(gulp.dest("build/web"));
87-
});
88-
8970
gulp.task("copyLICENSE", ["clean"], function (){
9071
return gulp.src("LICENSE")
9172
.pipe(gulp.dest("build/"));
@@ -97,13 +78,18 @@ gulp.task("copyREADME", ["clean"], function (){
9778
});
9879

9980
gulp.task("exportCacheXML", [
100-
"clean", "gatherCSS", "addHTMLFile", "addHTMLZIPFile", "copyLICENSE", "copyREADME"
81+
"clean", "gatherCSS", "gatherScripts", "addHTMLFile", "copyLICENSE", "copyREADME"
10182
], function () {
10283
return gulp.src("cache/projectTemplate.xml")
103-
.pipe(
104-
replace(/\{\{replace:HTML}}/,
105-
fs.readFileSync("build/web/ZIPindex.html", "utf-8"))
106-
)
84+
.pipe(replace(/\{\{replace:HTML}}/, fs.readFileSync("build/web/index.html", "utf-8")))
85+
.pipe(replace(
86+
/\{\{replace:css}}/,
87+
fs.readFileSync("build/web/css/CacheUMLExplorer.css", "utf-8")
88+
))
89+
.pipe(replace(
90+
/\{\{replace:js}}/,
91+
fs.readFileSync("build/web/js/CacheUMLExplorer.js", "utf-8")
92+
))
10793
.pipe(rename(function (path) { path.basename += "-v" + pkg["version"]; }))
10894
.pipe(gulp.dest("build/Cache"));
10995
});

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55
"directories": {
66
"test": "test"
77
},
8-
"dependencies": {
9-
10-
},
8+
"dependencies": {},
119
"devDependencies": {
1210
"express": "^5.0.0-alpha.1",
1311
"gulp": "^3.8.11",
14-
"gulp-header": "^1.2.2",
12+
"gulp-add-src": "^0.2.0",
1513
"gulp-clean": "^0.3.1",
1614
"gulp-concat": "^2.4.1",
15+
"gulp-header": "^1.2.2",
1716
"gulp-html-replace": "^1.4.1",
1817
"gulp-minify-css": "^0.3.11",
1918
"gulp-rename": "^1.2.0",

0 commit comments

Comments
 (0)