Skip to content

Commit 207bc31

Browse files
merge conflict resolving
2 parents 8b7dc3c + e87d1f1 commit 207bc31

20 files changed

Lines changed: 1526 additions & 0 deletions

LICENSE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
The MIT License (MIT)
22

3+
<<<<<<< HEAD
34
Copyright (c) 2015 InterSystems Corp.
5+
=======
6+
Copyright (c) 2015 Nikita
7+
>>>>>>> upstream/master
48

59
Permission is hereby granted, free of charge, to any person obtaining a copy
610
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# CacheUMLExplorer
2+
An UML Class explorer for InterSystems Caché.

cache/projectTemplate.xml

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Export generator="Cache" version="25" zv="Cache for Windows (x86-64) 2015.2 (Build 540)" ts="2015-04-12 16:26:04">
3+
<Class name="UMLExplorer.ClassView">
4+
<Description>
5+
Class contains methods that return structured class data.</Description>
6+
<TimeChanged>63654,59126.207802</TimeChanged>
7+
<TimeCreated>63653,67019.989197</TimeCreated>
8+
9+
<Method name="getClassData">
10+
<ClassMethod>1</ClassMethod>
11+
<FormalSpec>classDefinition:%Dictionary.ClassDefinition</FormalSpec>
12+
<ReturnType>%ZEN.proxyObject</ReturnType>
13+
<Implementation><![CDATA[
14+
set oClass = ##class(%ZEN.proxyObject).%New()
15+
set oProperties = ##class(%ZEN.proxyObject).%New()
16+
set oClass.super = classDefinition.Super
17+
set oClass.properties = oProperties
18+
set count = classDefinition.Properties.Count()
19+
for i = 1:1:count {
20+
set oProp = ##class(%ZEN.proxyObject).%New()
21+
do oProperties.%DispatchSetProperty(classDefinition.Properties.GetAt(i).Name, oProp)
22+
do oProp.%DispatchSetProperty("private", classDefinition.Properties.GetAt(i).Private)
23+
do oProp.%DispatchSetProperty("readOnly", classDefinition.Properties.GetAt(i).ReadOnly)
24+
do oProp.%DispatchSetProperty("type", classDefinition.Properties.GetAt(i).Type)
25+
}
26+
27+
set oMethods = ##class(%ZEN.proxyObject).%New()
28+
set oClass.methods = oMethods
29+
set count = classDefinition.Methods.Count()
30+
for i = 1:1:count {
31+
set oMeth = ##class(%ZEN.proxyObject).%New()
32+
do oMethods.%DispatchSetProperty(classDefinition.Methods.GetAt(i).Name, oMeth)
33+
do oMeth.%DispatchSetProperty("private", classDefinition.Methods.GetAt(i).Private)
34+
do oMeth.%DispatchSetProperty("returns", classDefinition.Methods.GetAt(i).ReturnType)
35+
}
36+
37+
return oClass
38+
]]></Implementation>
39+
</Method>
40+
41+
<Method name="collectInheritance">
42+
<ClassMethod>1</ClassMethod>
43+
<FormalSpec>oData:%ZEN.proxyObject,baseClassDefinition:%Dictionary.ClassDefinition</FormalSpec>
44+
<ReturnType>%Status</ReturnType>
45+
<Implementation><![CDATA[
46+
set superParts = $LISTFROMSTRING(baseClassDefinition.Super, ",")
47+
if (oData.inheritance.%DispatchGetProperty(baseClassDefinition.Name) = "") {
48+
do oData.inheritance.%DispatchSetProperty(baseClassDefinition.Name, ##class(%ZEN.proxyObject).%New())
49+
}
50+
set oInherit = oData.inheritance.%DispatchGetProperty(baseClassDefinition.Name)
51+
for i=1:1:$LISTLENGTH(superParts) {
52+
set className = $LISTGET(superParts, i)
53+
do oInherit.%DispatchSetProperty(className, 1)
54+
if (oData.classes.%DispatchGetProperty(className) = "") {
55+
set cdef = ##class(%Dictionary.ClassDefinition).%OpenId(className)
56+
if (cdef '= "") {
57+
do oData.classes.%DispatchSetProperty(className, ..getClassData(cdef))
58+
do ..collectInheritance(oData, cdef)
59+
}
60+
}
61+
}
62+
return $$$OK
63+
]]></Implementation>
64+
</Method>
65+
66+
<Method name="getClassView">
67+
<ClassMethod>1</ClassMethod>
68+
<FormalSpec>baseClassDefinition:%Dictionary.ClassDefinition</FormalSpec>
69+
<Implementation><![CDATA[
70+
set oData = ##class(%ZEN.proxyObject).%New()
71+
set oData.classes = ##class(%ZEN.proxyObject).%New()
72+
set oData.inheritance = ##class(%ZEN.proxyObject).%New()
73+
do oData.classes.%DispatchSetProperty(baseClassDefinition.Name, ..getClassData(baseClassDefinition))
74+
75+
do ..collectInheritance(oData, baseClassDefinition)
76+
77+
return oData
78+
]]></Implementation>
79+
</Method>
80+
</Class>
81+
82+
83+
<Project name="UMLExplorer" LastModified="2015-04-12 19:03:12.221887">
84+
<Items>
85+
<ProjectItem name="UMLExplorer.Router" type="CLS"></ProjectItem>
86+
<ProjectItem name="UMLExplorer.ClassView" type="CLS"></ProjectItem>
87+
</Items>
88+
</Project>
89+
90+
91+
<Class name="UMLExplorer.Router">
92+
<Description>
93+
REST interface for UMLExplorer</Description>
94+
<Super>%CSP.REST</Super>
95+
<TimeChanged>63654,68682.349536</TimeChanged>
96+
<TimeCreated>63648,30450.187229</TimeCreated>
97+
98+
<XData name="UrlMap">
99+
<Data><![CDATA[
100+
<Routes>
101+
<Route Url="/" Method="GET" Call="Index"/>
102+
<Route Url="/index" Method="GET" Call="Index"/>
103+
<Route Url="/Test" Method="GET" Call="Test"/>
104+
<Route Url="/GetClassTree" Method="GET" Call="GetClassTree"/>
105+
<Route Url="/GetClassView/:ClassName" Method="GET" Call="GetClassView"/>
106+
</Routes>
107+
]]></Data>
108+
</XData>
109+
110+
<Method name="GetClassTree">
111+
<Description>
112+
Method returns whole class tree visible in the current namespace.</Description>
113+
<ClassMethod>1</ClassMethod>
114+
<ReturnType>%Status</ReturnType>
115+
<Implementation><![CDATA[
116+
set resp = ##class(%ZEN.proxyObject).%New()
117+
set classes = ##class(%ResultSet).%New("%Dictionary.ClassDefinition:Summary")
118+
set objects = ##class(%Library.ArrayOfObjects).%New()
119+
set lastParts = $LB()
120+
121+
set level = 1
122+
do objects.SetAt(resp, level)
123+
124+
do classes.Execute()
125+
While (classes.Next()) {
126+
set name = classes.Data("Name")
127+
set parts = $LISTFROMSTRING(name, ".")
128+
set i = 0
129+
while (i < $LISTLENGTH(parts)) && ($LISTGET(lastParts, i + 1) = $LISTGET(parts, i + 1)) {
130+
set i = i + 1
131+
}
132+
set level = i + 1
133+
set resp = objects.GetAt(level)
134+
while ($LISTLENGTH(parts) > level) {
135+
set level = level + 1
136+
set resp = ##class(%ZEN.proxyObject).%New()
137+
do objects.GetAt(level - 1).%DispatchSetProperty($LISTGET(parts, level - 1), resp)
138+
do objects.SetAt(resp, level)
139+
}
140+
if ($LISTLENGTH(parts) = level) {
141+
do resp.%DispatchSetProperty($LISTGET(parts, level), classes.Data("Hidden"))
142+
}
143+
set lastParts = parts
144+
}
145+
146+
do objects.GetAt(1).%ToJSON(, "ou")
147+
return $$$OK
148+
]]></Implementation>
149+
</Method>
150+
151+
<Method name="GetClassView">
152+
<Description>
153+
Returns classTree by given class name</Description>
154+
<ClassMethod>1</ClassMethod>
155+
<FormalSpec>className:%String</FormalSpec>
156+
<ReturnType>%Status</ReturnType>
157+
<Implementation><![CDATA[
158+
set cdef = ##class(%Dictionary.ClassDefinition).%OpenId(className)
159+
if (cdef = "") quit ..Http404()
160+
set classData = ##class(UMLExplorer.ClassView).getClassView(cdef)
161+
do classData.%ToJSON(, "ou")
162+
return $$$OK
163+
]]></Implementation>
164+
</Method>
165+
166+
<Method name="Test">
167+
<Description>
168+
Method to test accessibility of REST interface.</Description>
169+
<ClassMethod>1</ClassMethod>
170+
<ReturnType>%Status</ReturnType>
171+
<Implementation><![CDATA[
172+
set resp = ##class(%ZEN.proxyObject).%New()
173+
set resp2 = ##class(%ZEN.proxyObject).%New()
174+
set resp2.Status = "OK"
175+
set resp.obj = resp2
176+
do resp.%ToJSON(, "o")
177+
return $$$OK
178+
]]></Implementation>
179+
</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>
191+
</Class>
192+
</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: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "CacheUMLExplorer",
3+
"version": "0.1.1",
4+
"description": "An UML Class explorer for InterSystems Caché",
5+
"directories": {
6+
"test": "test"
7+
},
8+
"dependencies": {
9+
10+
},
11+
"devDependencies": {
12+
"express": "^5.0.0-alpha.1",
13+
"gulp": "^3.8.11",
14+
"gulp-header": "^1.2.2",
15+
"gulp-clean": "^0.3.1",
16+
"gulp-concat": "^2.4.1",
17+
"gulp-html-replace": "^1.4.1",
18+
"gulp-minify-css": "^0.3.11",
19+
"gulp-rename": "^1.2.0",
20+
"gulp-replace": "^0.5.0",
21+
"gulp-uglify": "^1.0.1",
22+
"gulp-wrap": "^0.5.0",
23+
"gulp-zip": "^2.0.2"
24+
},
25+
"scripts": {
26+
"test": "node test/testServer"
27+
},
28+
"repository": {
29+
"type": "git",
30+
"url": "https://github.com/ZitRos/CacheUMLExplorer"
31+
},
32+
"keywords": [
33+
"UMLExplorer",
34+
"Caché",
35+
"UML",
36+
"diagram"
37+
],
38+
"author": "ZitRo",
39+
"license": "MIT",
40+
"bugs": {
41+
"url": "https://github.com/ZitRos/CacheUMLExplorer/issues"
42+
},
43+
"homepage": "https://github.com/ZitRos/CacheUMLExplorer"
44+
}

test/testServer.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
var express = require("express"),
2+
app = express();
3+
4+
app.use(express.static(__dirname + "/../web"));
5+
6+
app.listen(80);
7+
8+
console.info("Server ready on port 80.");

0 commit comments

Comments
 (0)