Skip to content

Commit e87d1f1

Browse files
basic build, diagram improvements
1 parent 98cd0c0 commit e87d1f1

14 files changed

+336
-28
lines changed

cache/projectTemplate.xml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Class contains methods that return structured class data.</Description>
8080
</Class>
8181

8282

83-
<Project name="UMLExplorer" LastModified="2015-04-12 16:26:04.713512">
83+
<Project name="UMLExplorer" LastModified="2015-04-12 19:03:12.221887">
8484
<Items>
8585
<ProjectItem name="UMLExplorer.Router" type="CLS"></ProjectItem>
8686
<ProjectItem name="UMLExplorer.ClassView" type="CLS"></ProjectItem>
@@ -92,12 +92,14 @@ Class contains methods that return structured class data.</Description>
9292
<Description>
9393
REST interface for UMLExplorer</Description>
9494
<Super>%CSP.REST</Super>
95-
<TimeChanged>63653,74965.264444</TimeChanged>
95+
<TimeChanged>63654,68682.349536</TimeChanged>
9696
<TimeCreated>63648,30450.187229</TimeCreated>
9797

9898
<XData name="UrlMap">
9999
<Data><![CDATA[
100100
<Routes>
101+
<Route Url="/" Method="GET" Call="Index"/>
102+
<Route Url="/index" Method="GET" Call="Index"/>
101103
<Route Url="/Test" Method="GET" Call="Test"/>
102104
<Route Url="/GetClassTree" Method="GET" Call="GetClassTree"/>
103105
<Route Url="/GetClassView/:ClassName" Method="GET" Call="GetClassView"/>
@@ -175,5 +177,16 @@ Method to test accessibility of REST interface.</Description>
175177
return $$$OK
176178
]]></Implementation>
177179
</Method>
180+
181+
<Method name="Index">
182+
<Description>
183+
Method returns user application.</Description>
184+
<ClassMethod>1</ClassMethod>
185+
<ReturnType>%Status</ReturnType>
186+
<Implementation><![CDATA[
187+
&html<{{replace:HTML}}>
188+
return $$$OK
189+
]]></Implementation>
190+
</Method>
178191
</Class>
179192
</Export>

gulpfile.js

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
var gulp = require("gulp"),
2+
fs = require("fs"),
3+
clean = require("gulp-clean"),
4+
concat = require("gulp-concat"),
5+
uglify = require("gulp-uglify"),
6+
wrap = require("gulp-wrap"),
7+
minifyCSS = require("gulp-minify-css"),
8+
htmlReplace = require("gulp-html-replace"),
9+
header = require("gulp-header"),
10+
replace = require("gulp-replace"),
11+
pkg = require("./package.json"),
12+
zip = require("gulp-zip"),
13+
rename = require("gulp-rename");
14+
15+
var banner = [
16+
"/** <%= pkg.name %>",
17+
" ** <%= pkg.description %>",
18+
" ** @author <%= pkg.author %>",
19+
" ** @version <%= pkg.version %>",
20+
" ** @license <%= pkg.license %>",
21+
" ** @see https://github.com/ZitRos/CacheUMLExplorer",
22+
" **/",
23+
""
24+
].join("\n");
25+
26+
gulp.task("clean", function () {
27+
return gulp.src("build", {read: false})
28+
.pipe(clean());
29+
});
30+
31+
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+
])
38+
.pipe(concat("CacheUMLExplorer.js"))
39+
.pipe(replace(/\/\*\{\{replace:version}}\*\//, "\"" + pkg["version"] + "\""))
40+
//.pipe(wrap("CacheUMLExplorer = (function(){<%= contents %> return CacheUMLExplorer;}());"))
41+
.pipe(uglify({
42+
output: {
43+
ascii_only: true,
44+
width: 30000,
45+
max_line_len: 30000
46+
}
47+
}))
48+
.pipe(header(banner, { pkg: pkg }))
49+
.pipe(gulp.dest("build/web/js/"));
50+
});
51+
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+
63+
gulp.task("gatherCSS", ["clean"], function () {
64+
return gulp.src("web/css/*.css")
65+
.pipe(concat("CacheUMLExplorer.css"))
66+
.pipe(minifyCSS())
67+
.pipe(gulp.dest("build/web/css/"));
68+
});
69+
70+
gulp.task("addHTMLFile", ["clean"], function () {
71+
return gulp.src("web/index.html")
72+
.pipe(htmlReplace({
73+
"css": "css/CacheUMLExplorer.css",
74+
"js": "js/CacheUMLExplorer.js"
75+
}))
76+
.pipe(gulp.dest("build/web/"));
77+
});
78+
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+
89+
gulp.task("copyLICENSE", ["clean"], function (){
90+
return gulp.src("LICENSE")
91+
.pipe(gulp.dest("build/"));
92+
});
93+
94+
gulp.task("copyREADME", ["clean"], function (){
95+
return gulp.src("readme.md")
96+
.pipe(gulp.dest("build/"));
97+
});
98+
99+
gulp.task("exportCacheXML", [
100+
"clean", "gatherCSS", "addHTMLFile", "addHTMLZIPFile", "copyLICENSE", "copyREADME"
101+
], function () {
102+
return gulp.src("cache/projectTemplate.xml")
103+
.pipe(
104+
replace(/\{\{replace:HTML}}/,
105+
fs.readFileSync("build/web/ZIPindex.html", "utf-8"))
106+
)
107+
.pipe(rename(function (path) { path.basename += "-v" + pkg["version"]; }))
108+
.pipe(gulp.dest("build/Cache"));
109+
});
110+
111+
gulp.task("zipRelease", ["exportCacheXML"], function () {
112+
return gulp.src("build/**/*")
113+
.pipe(zip("CacheUMLExplorer-v" + pkg["version"] + ".zip", {
114+
comment: "Cach? UML explorer v" + pkg["version"] + " by Nikita Savchenko\n\n" +
115+
"+ WEBModule folder holds packed JS/CSS files to integrate CacheUMLExplorer to any WEB " +
116+
"application;\n" +
117+
"+ Cache folder holds XML file to import to InterSystems Cache.\n\n" +
118+
"For further information about installation and information, check README.md file."
119+
}))
120+
.pipe(gulp.dest("build"));
121+
});
122+
123+
gulp.task("desktop", ["default"], function () {
124+
return gulp.src("build/Cache/*")
125+
.pipe(gulp.dest("C:/Users/ZitRo/Desktop"));
126+
});
127+
128+
gulp.task("default", ["zipRelease"]);

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "CacheUMLExplorer",
3-
"version": "0.0.1",
3+
"version": "0.1.1",
44
"description": "An UML Class explorer for InterSystems Caché",
55
"directories": {
66
"test": "test"
@@ -10,7 +10,8 @@
1010
},
1111
"devDependencies": {
1212
"express": "^5.0.0-alpha.1",
13-
"gulp": "^3.8.10",
13+
"gulp": "^3.8.11",
14+
"gulp-header": "^1.2.2",
1415
"gulp-clean": "^0.3.1",
1516
"gulp-concat": "^2.4.1",
1617
"gulp-html-replace": "^1.4.1",

web/css/classView.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,19 @@
1212

1313
text {
1414
font-family: monospace;
15+
}
16+
17+
.centralText {
18+
display: table;
19+
position: absolute;
20+
left: 0;
21+
top: 0;
22+
width: 100%;
23+
height: 100%;
24+
text-align: center;
25+
}
26+
27+
.centralText > div {
28+
display: table-cell;
29+
vertical-align: middle;
1530
}

web/css/interface.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,18 @@ html, body {
2323
position: relative;
2424
margin-left: 300px;
2525
height: 100%;
26+
}
27+
28+
.ui-ClassInfo {
29+
position: absolute;
30+
top: 0;
31+
left: 0;
32+
width: 100%;
33+
padding: .5em;
34+
font-weight: 600;
35+
font-size: 18pt;
36+
}
37+
38+
#className {
39+
text-shadow: 1px 1px 0 white, -1px -1px 0 white, 1px -1px 0 white, -1px 1px 0 white;
2640
}

web/index.html

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,23 @@
33
<head lang="en">
44
<meta charset="UTF-8">
55
<title>Caché UML explorer</title>
6+
<!-- build:css -->
67
<link rel="stylesheet" href="css/interface.css"/>
78
<link rel="stylesheet" href="css/treeView.css"/>
89
<link rel="stylesheet" href="css/extras.css"/>
910
<link rel="stylesheet" href="css/classView.css"/>
1011
<link rel="stylesheet" href="css/joint.min.css"/>
11-
<script type="text/javascript" src="js/joint.min.js"></script>
12-
<script type="text/javascript" src="js/joint.shapes.uml.js"></script>
13-
<script type="text/javascript" src="js/joint.layout.DirectedGraph.min.js"></script>
12+
<!-- endbuild -->
13+
<!-- build:js -->
14+
<script type="text/javascript" src="jsLib/joint.min.js"></script>
15+
<script type="text/javascript" src="jsLib/joint.shapes.uml.js"></script>
16+
<script type="text/javascript" src="jsLib/joint.layout.DirectedGraph.min.js"></script>
1417
<script type="text/javascript" src="js/ClassView.js"></script>
1518
<script type="text/javascript" src="js/Lib.js"></script>
1619
<script type="text/javascript" src="js/CacheUMLExplorer.js"></script>
1720
<script type="text/javascript" src="js/ClassTree.js"></script>
1821
<script type="text/javascript" src="js/Source.js"></script>
22+
<!-- endbuild -->
1923
</head>
2024
<body onload="var cue = new CacheUMLExplorer(document.getElementById('treeView'), document.getElementById('classView'))">
2125
<div class="ui-body">
@@ -25,6 +29,9 @@
2529
</div>
2630
</div>
2731
<div class="ui-mainBlock">
32+
<div class="ui-ClassInfo">
33+
<span id="className"></span>
34+
</div>
2835
<div id="classView">
2936

3037
</div>

web/js/CacheUMLExplorer.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@
88
*/
99
var CacheUMLExplorer = function (treeViewContainer, classViewContainer) {
1010

11+
this.elements = {
12+
className: document.getElementById("className"),
13+
treeViewContainer: treeViewContainer,
14+
classViewContainer: classViewContainer
15+
};
16+
1117
this.source = new Source();
1218
this.classTree = new ClassTree(this, treeViewContainer);
13-
this.classView = new ClassView(classViewContainer);
19+
this.classView = new ClassView(this, classViewContainer);
1420

1521
this.init();
1622

web/js/ClassTree.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,11 @@ ClassTree.prototype.classSelected = function (element, className) {
4545

4646
if (!element.classList.contains("selected")) {
4747
element.classList.add("selected");
48-
this.cacheUMLExplorer.source.getClassView(className, function (err, data) {
49-
if (err) {
50-
console.error(err);
51-
} else {
52-
self.cacheUMLExplorer.classView.render(data);
53-
}
54-
});
48+
this.cacheUMLExplorer.classView.loadClass(className);
5549
}
5650

51+
this.cacheUMLExplorer.elements.className.textContent = className;
52+
5753
};
5854

5955
ClassTree.prototype.updateTree = function (treeObject) {

0 commit comments

Comments
 (0)