Skip to content

Commit d363a69

Browse files
Sources to UDL, build system update
1 parent 0d9b807 commit d363a69

34 files changed

+674
-790
lines changed

cache/projectTemplate.xml

-739
This file was deleted.

gulpfile.js

+49-42
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ var gulp = require("gulp"),
1414
autoprefixer = require('autoprefixer-core'),
1515
pkg = require("./package.json"),
1616
zip = require("gulp-zip"),
17-
rename = require("gulp-rename");
17+
rename = require("gulp-rename"),
18+
preprocess = require("gulp-preprocess");
19+
20+
var INSTALLER_CLASS_NAME = "ClassExplorer.Installer";
1821

1922
var banner = [
2023
"",
@@ -26,7 +29,12 @@ var banner = [
2629
" ** @see https://github.com/ZitRos/CacheClassExplorer",
2730
" **/",
2831
""
29-
].join("\n");
32+
].join("\n"),
33+
context = {
34+
context: {
35+
package: pkg
36+
}
37+
};
3038

3139
var specialReplace = function () {
3240
return replace(/[^\s]+\/\*build\.replace:(.*)\*\//g, function (part, match) {
@@ -42,12 +50,12 @@ gulp.task("clean", function () {
4250

4351
gulp.task("gatherLibs", ["clean"], function () {
4452
return gulp.src([
45-
"web/jsLib/jquery.min.js",
46-
"web/jsLib/lodash.min.js",
47-
"web/jsLib/backbone-min.js",
48-
"web/jsLib/joint.js",
49-
"web/jsLib/joint.shapes.uml.js",
50-
"web/jsLib/ImageExporter.js"
53+
"src/web/jsLib/jquery.min.js",
54+
"src/web/jsLib/lodash.min.js",
55+
"src/web/jsLib/backbone-min.js",
56+
"src/web/jsLib/joint.js",
57+
"src/web/jsLib/joint.shapes.uml.js",
58+
"src/web/jsLib/ImageExporter.js"
5159
])
5260
.pipe(uglify({
5361
output: {
@@ -58,18 +66,18 @@ gulp.task("gatherLibs", ["clean"], function () {
5866
preserveComments: "some"
5967
}))
6068
.pipe(addsrc.append([
61-
"web/jsLib/joint.layout.DirectedGraph.min.js"
69+
"src/web/jsLib/joint.layout.DirectedGraph.min.js"
6270
]))
6371
.pipe(stripComments({ safe: true }))
64-
.pipe(concat("CacheClassExplorer.js"))
72+
.pipe(concat("index.js"))
6573
.pipe(replace(/ /g, "\\x0B"))
6674
.pipe(replace(/\x1b/g, "\\x1B"))
6775
.pipe(gulp.dest("build/web/js/"));
6876
});
6977

7078
gulp.task("gatherScripts", ["clean", "gatherLibs"], function () {
71-
return gulp.src("web/js/*.js")
72-
.pipe(concat("CacheClassExplorer.js"))
79+
return gulp.src("src/web/js/*.js")
80+
.pipe(concat("index.js"))
7381
.pipe(specialReplace())
7482
.pipe(wrap("CacheClassExplorer = (function(){<%= contents %> return CacheClassExplorer;}());"))
7583
.pipe(uglify({
@@ -81,25 +89,25 @@ gulp.task("gatherScripts", ["clean", "gatherLibs"], function () {
8189
preserveComments: "some"
8290
}))
8391
.pipe(header(banner, { pkg: pkg }))
84-
.pipe(addsrc.prepend("build/web/js/CacheClassExplorer.js"))
85-
.pipe(concat("CacheClassExplorer.js"))
92+
.pipe(addsrc.prepend("build/web/js/index.js"))
93+
.pipe(concat("index.js"))
8694
.pipe(replace(/\x1b/g, "\\x1B"))
8795
.pipe(gulp.dest("build/web/js/"));
8896
});
8997

9098
gulp.task("gatherCSS", ["clean"], function () {
91-
return gulp.src("web/css/*.css")
92-
.pipe(concat("CacheClassExplorer.css"))
99+
return gulp.src("src/web/css/*.css")
100+
.pipe(concat("index.css"))
93101
.pipe(postcss([ autoprefixer({ browsers: ["last 3 version"] }) ]))
94102
.pipe(minifyCSS({ keepSpecialComments: 0 }))
95103
.pipe(gulp.dest("build/web/css/"));
96104
});
97105

98106
gulp.task("addHTMLFile", ["clean"], function () {
99-
return gulp.src("web/index.html")
107+
return gulp.src("src/web/index.html")
100108
.pipe(htmlReplace({
101-
"css": "css/CacheClassExplorer.css",
102-
"js": "js/CacheClassExplorer.js"
109+
"css": "css/index.css",
110+
"js": "js/index.js"
103111
}))
104112
.pipe(gulp.dest("build/web/"));
105113
});
@@ -114,33 +122,32 @@ gulp.task("copyREADME", ["clean"], function () {
114122
.pipe(gulp.dest("build/"));
115123
});
116124

117-
gulp.task("exportCacheXML", [
118-
"clean", "gatherCSS", "gatherScripts", "addHTMLFile", "copyLICENSE", "copyREADME"
119-
], function () {
120-
return gulp.src("cache/projectTemplate.xml")
121-
.pipe(specialReplace())
122-
.pipe(replace(
123-
/\{\{replace:css}}/,
124-
function () { return fs.readFileSync("build/web/css/CacheClassExplorer.css", "utf-8"); }
125-
))
126-
.pipe(replace(
127-
/\{\{replace:js}}/,
128-
function () { return fs.readFileSync("build/web/js/CacheClassExplorer.js", "utf-8"); }
129-
))
130-
.pipe(replace(
131-
/\{\{replace:html}}/,
132-
function () { return fs.readFileSync("build/web/index.html", "utf-8"); }
133-
))
134-
.pipe(rename(function (path) { path.basename = "CacheClassExplorer-v" + pkg["version"]; }))
135-
.pipe(gulp.dest("build/Cache"));
125+
gulp.task("pre-cls", ["clean"], function () {
126+
return gulp.src(["src/cls/**/*.cls"])
127+
.pipe(rename(function (f) {
128+
f.basename = (f.dirname === "." ? "" : f.dirname + ".") + f.basename;
129+
f.dirname = ".";
130+
if (f.basename !== INSTALLER_CLASS_NAME)
131+
context.context.compileAfter +=
132+
(context.context.compileAfter ? "," : "") + f.basename;
133+
}))
134+
.pipe(gulp.dest("build/cls/"));
135+
});
136+
137+
gulp.task("cls", ["pre-cls", "copyLICENSE", "copyREADME", "addHTMLFile", "gatherScripts",
138+
"gatherCSS"], function () {
139+
return gulp.src(["build/cls/**/*.cls"])
140+
.pipe(preprocess(context))
141+
.pipe(gulp.dest("build/cls"));
136142
});
137143

138-
gulp.task("zipRelease", ["exportCacheXML"], function () {
139-
return gulp.src(["build/**/*", "!build/web/**/*"])
144+
gulp.task("zipRelease", function () {
145+
return gulp.src(["build/**/*", "!build/web/**/*.*", "!build/cls/**/*.*"])
140146
.pipe(zip("CacheClassExplorer-v" + pkg["version"] + ".zip", {
141147
comment: "Cache UML explorer v" + pkg["version"] + " by Nikita Savchenko\n\n" +
142148
"+ Cache folder holds XML file to import to InterSystems Cache.\n\n" +
143-
"For further information about installation and information, check README.md file."
149+
"For further information about installation and information, check README.md file.\n\n"
150+
+ "See https://github.com/intersystems-ru/UMLExplorer"
144151
}))
145152
.pipe(gulp.dest("build"));
146153
});
@@ -150,4 +157,4 @@ gulp.task("desktop", ["default"], function () {
150157
.pipe(gulp.dest("C:/Users/ZitRo/Desktop"));
151158
});
152159

153-
gulp.task("default", ["zipRelease"]);
160+
gulp.task("default", ["cls"]);

import.bat

+13-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,19 @@
22
:: the project. Replace the path below to your Caché installation and build & import application to
33
:: Caché using only one command.
44

5-
:: CHANGE THIS PATH TO YOUR CACHÉ INSTALLATION PATH ON WINDOWS
5+
:: Latest NodeJS & Caché 2016.2+ IS REQUIRED TO PROCEED
6+
@echo off
7+
8+
:: CHANGE THIS PATH TO YOUR CACHÉ INSTALLATION PATH ON WINDOWS (folder that contains bin, CSP, mgr and other folders)
69
set CACHE_DIR=C:\Program Files\InterSystems\Ensemble
7-
:: NAMESPACE IMPORTING TO
10+
:: NAMESPACE TO IMPORT PACKAGE TO
811
set NAMESPACE=USER
12+
:: Other variables
13+
set BUILD_DIR=build\cls
14+
:: Export
15+
set XML_EXPORT_DIR=build
16+
set PACKAGE_NAME=ClassExplorer
917

10-
npm run gulp & echo w "OK:"_$system.OBJ.ImportDir("%~dp0build\Cache",,"ck") halt | "%CACHE_DIR%\bin\cache.exe" -s "%CACHE_DIR%\mgr" -U %NAMESPACE%
18+
npm run gulp && ^
19+
echo s st = $system.Status.GetErrorText($system.OBJ.ImportDir("%~dp0%BUILD_DIR%",,"ck")) w "IMPORT STATUS: "_$case(st="",1:"OK",:st) halt | "%CACHE_DIR%\bin\cache.exe" -s "%CACHE_DIR%\mgr" -U %NAMESPACE% && ^
20+
echo s st = $system.Status.GetErrorText($system.OBJ.ExportPackage("%PACKAGE_NAME%", "%~dp0%XML_EXPORT_DIR%\%PACKAGE_NAME%-v"_##class(%PACKAGE_NAME%.Installer).#VERSION_".xml")) w $c(13,10)_"EXPORT STATUS: "_$case(st="",1:"OK",:st) halt | "%CACHE_DIR%\bin\cache.exe" -s "%CACHE_DIR%\mgr" -U %NAMESPACE%

package.json

+25-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
22
"name": "CacheClassExplorer",
3-
"version": "1.20.1",
3+
"version": "1.21.0",
44
"description": "Class Explorer for InterSystems Caché",
5-
"directories": { "test": "test" },
5+
"directories": {
6+
"test": "test"
7+
},
68
"dependencies": {},
79
"devDependencies": {
810
"autoprefixer-core": "^6.0.1",
@@ -14,18 +16,35 @@
1416
"gulp-html-replace": "^1.6.2",
1517
"gulp-minify-css": "^1.2.4",
1618
"gulp-postcss": "^6.4.0",
19+
"gulp-preprocess": "^2.0.0",
1720
"gulp-rename": "^1.2.0",
1821
"gulp-replace": "^0.5.3",
1922
"gulp-strip-comments": "^2.4.5",
2023
"gulp-uglify": "^2.1.2",
2124
"gulp-wrap": "^0.13.0",
2225
"gulp-zip": "^4.0.0"
2326
},
24-
"scripts": { "gulp": "gulp" },
25-
"repository": { "type": "git", "url": "https://github.com/ZitRos/CacheUMLExplorer" },
26-
"keywords": [ "UMLExplorer", "Caché", "UML", "diagram" ],
27+
"scripts": {
28+
"gulp": "gulp",
29+
"zip": "gulp zipRelease"
30+
},
31+
"repository": {
32+
"type": "git",
33+
"url": "https://github.com/ZitRos/CacheUMLExplorer"
34+
},
35+
"keywords": [
36+
"UMLExplorer",
37+
"Caché",
38+
"Class",
39+
"Explorer",
40+
"UML",
41+
"diagram",
42+
"builder"
43+
],
2744
"author": "ZitRo",
2845
"license": "MIT",
29-
"bugs": { "url": "https://github.com/ZitRos/CacheUMLExplorer/issues" },
46+
"bugs": {
47+
"url": "https://github.com/ZitRos/CacheUMLExplorer/issues"
48+
},
3049
"homepage": "https://github.com/ZitRos/CacheUMLExplorer"
3150
}

0 commit comments

Comments
 (0)