Skip to content

Commit feb1487

Browse files
Merge remote-tracking branch 'upstream/master'
2 parents 7f96cf4 + 367a7be commit feb1487

File tree

4 files changed

+150
-43
lines changed

4 files changed

+150
-43
lines changed

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,23 @@
11
# CacheUMLExplorer
2-
An UML Class explorer for InterSystems Caché.
2+
An UML Class explorer for InterSystems Caché. It can build UML class diagram for any class in Caché.
3+
4+
## Screenshots
5+
6+
![2015-04-21_214058](https://cloud.githubusercontent.com/assets/4989256/7260103/6c1e2a20-e870-11e4-8bf0-9832885be9ab.png)
7+
8+
## Installation
9+
10+
###### Import classes to Caché
11+
To install Caché UML class explorer, download the [latest release](https://github.com/ZitRos/CacheUMLExplorer/releases) or build project by yourself. Then import XML file inside <code>Cache</code> directory of archive or directory.
12+
13+
###### Set up WEB application
14+
When you have imported and compiled <b>UMLExplorer package</b> in Caché, make sure the namespace is the same you have imported classes to. Then go to <code>system management portal -> administering -> security -> applications -> web applications</code> and create there a new web application. Fill the <code>name</code> field of it with <code>/UMLExplorer</code> (slash is required) and set the value of <code>dispatch class</code> to <code>UMLExplorer.Router</code>. Click save. Now your WEB application is ready.
15+
16+
###### Use it
17+
Visit <code>[server domain and port]/UMLExplorer/</code> (with slash at end) to enter application.
18+
19+
## Build
20+
21+
To build project, you need [NodeJS](https://nodejs.org) platform to be installed. Then, clone source code and run <code>npm install</code> from the root of the project. This will install all necessary modules from NPM. Also run <code>npm install -g gulp</code> if you have no gulp builder in your modules.
22+
23+
After that and each next time just run <code>gulp</code> command from the project root. This will generate <code>build</code> directory, where you will found all what you need.

cache/projectTemplate.xml

Lines changed: 104 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
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+
34
<Class name="UMLExplorer.ClassView">
45
<Description>
56
Class contains methods that return structured class data.</Description>
6-
<TimeChanged>63654,59126.207802</TimeChanged>
7+
<TimeChanged>63663,69939</TimeChanged>
78
<TimeCreated>63653,67019.989197</TimeCreated>
89

910
<Method name="getClassData">
@@ -84,6 +85,7 @@ Class contains methods that return structured class data.</Description>
8485
<Items>
8586
<ProjectItem name="UMLExplorer.Router" type="CLS"></ProjectItem>
8687
<ProjectItem name="UMLExplorer.ClassView" type="CLS"></ProjectItem>
88+
<ProjectItem name="UMLExplorer.StaticContent" type="CLS"></ProjectItem>
8789
</Items>
8890
</Project>
8991

@@ -92,14 +94,16 @@ Class contains methods that return structured class data.</Description>
9294
<Description>
9395
REST interface for UMLExplorer</Description>
9496
<Super>%CSP.REST</Super>
95-
<TimeChanged>63654,68682.349536</TimeChanged>
97+
<TimeChanged>63663,76166.562046</TimeChanged>
9698
<TimeCreated>63648,30450.187229</TimeCreated>
9799

98100
<XData name="UrlMap">
99101
<Data><![CDATA[
100102
<Routes>
101103
<Route Url="/" Method="GET" Call="Index"/>
102104
<Route Url="/index" Method="GET" Call="Index"/>
105+
<Route Url="/css/CacheUMLExplorer.css" Method="GET" Call="GetCss"/>
106+
<Route Url="/js/CacheUMLExplorer.js" Method="GET" Call="GetJs"/>
103107
<Route Url="/Test" Method="GET" Call="Test"/>
104108
<Route Url="/GetClassTree" Method="GET" Call="GetClassTree"/>
105109
<Route Url="/GetClassView/:ClassName" Method="GET" Call="GetClassView"/>
@@ -178,15 +182,112 @@ Method to test accessibility of REST interface.</Description>
178182
]]></Implementation>
179183
</Method>
180184

185+
<Method name="GetCss">
186+
<ClassMethod>1</ClassMethod>
187+
<ReturnType>%Status</ReturnType>
188+
<Implementation><![CDATA[
189+
set %response.CharSet = "utf-8"
190+
set %response.ContentType = "text/css"
191+
do ##class(UMLExplorer.StaticContent).WriteCSS()
192+
return $$$OK
193+
]]></Implementation>
194+
</Method>
195+
196+
<Method name="GetJs">
197+
<ClassMethod>1</ClassMethod>
198+
<ReturnType>%Status</ReturnType>
199+
<Implementation><![CDATA[
200+
set %response.CharSet = "utf-8"
201+
set %response.ContentType = "text/javascript"
202+
do ##class(UMLExplorer.StaticContent).WriteJS()
203+
return $$$OK
204+
]]></Implementation>
205+
</Method>
206+
181207
<Method name="Index">
182208
<Description>
183209
Method returns user application.</Description>
184210
<ClassMethod>1</ClassMethod>
185211
<ReturnType>%Status</ReturnType>
186212
<Implementation><![CDATA[
187-
&html<{{replace:HTML}}>
213+
&html<
214+
<!DOCTYPE html>
215+
<html>
216+
<head lang="en">
217+
<meta charset="UTF-8">
218+
<title>Cache UML explorer</title>
219+
<link rel="stylesheet" href="css/CacheUMLExplorer.css">
220+
<script src="js/CacheUMLExplorer.js"></script>
221+
</head>
222+
<body onload="var cue = new CacheUMLExplorer(document.getElementById('treeView'), document.getElementById('classView'))">
223+
<div class="ui-body">
224+
<div class="ui-sideBlock">
225+
<div id="treeView">
226+
227+
</div>
228+
</div>
229+
<div class="ui-mainBlock">
230+
<div class="ui-ClassInfo">
231+
<span id="className"></span>
232+
</div>
233+
<div id="classView">
234+
235+
</div>
236+
</div>
237+
</div>
238+
</body>
239+
</html>
240+
>
241+
return $$$OK
242+
]]></Implementation>
243+
</Method>
244+
</Class>
245+
246+
247+
<Class name="UMLExplorer.StaticContent">
248+
<TimeChanged>63663,76108.945861</TimeChanged>
249+
<TimeCreated>63663,71456.865723</TimeCreated>
250+
251+
<Method name="WriteCSS">
252+
<Description>
253+
Outputs css code for UMLExplorer application</Description>
254+
<ClassMethod>1</ClassMethod>
255+
<ReturnType>%Status</ReturnType>
256+
<Implementation><![CDATA[
257+
Set xdata = ##class(%Dictionary.CompiledXData).%OpenId("UMLExplorer.StaticContent||CSS").Data
258+
set status=##class(%XML.TextReader).ParseStream(xdata, .textreader)
259+
while textreader.Read() { if (textreader.NodeType="chars") { w textreader.Value } }
260+
return $$$OK
261+
]]></Implementation>
262+
</Method>
263+
264+
<Method name="WriteJS">
265+
<Description>
266+
Outputs js code for UMLExplorer application</Description>
267+
<ClassMethod>1</ClassMethod>
268+
<ReturnType>%Status</ReturnType>
269+
<Implementation><![CDATA[
270+
Set xdata = ##class(%Dictionary.CompiledXData).%OpenId("UMLExplorer.StaticContent||JS").Data
271+
set status=##class(%XML.TextReader).ParseStream(xdata, .textreader)
272+
while textreader.Read() { if (textreader.NodeType="chars") { w textreader.Value } }
188273
return $$$OK
189274
]]></Implementation>
190275
</Method>
276+
277+
<XData name="CSS">
278+
<Data><![CDATA[
279+
<data>
280+
{{replace:css}}
281+
</data>
282+
]]></Data>
283+
</XData>
284+
285+
<XData name="JS">
286+
<Data><![CDATA[
287+
<data><![CDATA[
288+
{{replace:js}}
289+
]]]]><![CDATA[></data>
290+
]]></Data>
291+
</XData>
191292
</Class>
192293
</Export>

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+
function () { return fs.readFileSync("build/web/css/CacheUMLExplorer.css", "utf-8"); }
88+
))
89+
.pipe(replace(
90+
/\{\{replace:js}}/,
91+
function () { return 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: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
{
22
"name": "CacheUMLExplorer",
3-
"version": "0.1.1",
3+
"version": "0.2",
44
"description": "An UML Class explorer for InterSystems Caché",
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)