Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaeverywhere committed Apr 21, 2015
2 parents 7f96cf4 + 367a7be commit feb1487
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 43 deletions.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
# CacheUMLExplorer
An UML Class explorer for InterSystems Caché.
An UML Class explorer for InterSystems Caché. It can build UML class diagram for any class in Caché.

## Screenshots

![2015-04-21_214058](https://cloud.githubusercontent.com/assets/4989256/7260103/6c1e2a20-e870-11e4-8bf0-9832885be9ab.png)

## Installation

###### Import classes to Caché
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.

###### Set up WEB application
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.

###### Use it
Visit <code>[server domain and port]/UMLExplorer/</code> (with slash at end) to enter application.

## Build

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.

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.
107 changes: 104 additions & 3 deletions cache/projectTemplate.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Export generator="Cache" version="25" zv="Cache for Windows (x86-64) 2015.2 (Build 540)" ts="2015-04-12 16:26:04">

<Class name="UMLExplorer.ClassView">
<Description>
Class contains methods that return structured class data.</Description>
<TimeChanged>63654,59126.207802</TimeChanged>
<TimeChanged>63663,69939</TimeChanged>
<TimeCreated>63653,67019.989197</TimeCreated>

<Method name="getClassData">
Expand Down Expand Up @@ -84,6 +85,7 @@ Class contains methods that return structured class data.</Description>
<Items>
<ProjectItem name="UMLExplorer.Router" type="CLS"></ProjectItem>
<ProjectItem name="UMLExplorer.ClassView" type="CLS"></ProjectItem>
<ProjectItem name="UMLExplorer.StaticContent" type="CLS"></ProjectItem>
</Items>
</Project>

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

<XData name="UrlMap">
<Data><![CDATA[
<Routes>
<Route Url="/" Method="GET" Call="Index"/>
<Route Url="/index" Method="GET" Call="Index"/>
<Route Url="/css/CacheUMLExplorer.css" Method="GET" Call="GetCss"/>
<Route Url="/js/CacheUMLExplorer.js" Method="GET" Call="GetJs"/>
<Route Url="/Test" Method="GET" Call="Test"/>
<Route Url="/GetClassTree" Method="GET" Call="GetClassTree"/>
<Route Url="/GetClassView/:ClassName" Method="GET" Call="GetClassView"/>
Expand Down Expand Up @@ -178,15 +182,112 @@ Method to test accessibility of REST interface.</Description>
]]></Implementation>
</Method>

<Method name="GetCss">
<ClassMethod>1</ClassMethod>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
set %response.CharSet = "utf-8"
set %response.ContentType = "text/css"
do ##class(UMLExplorer.StaticContent).WriteCSS()
return $$$OK
]]></Implementation>
</Method>

<Method name="GetJs">
<ClassMethod>1</ClassMethod>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
set %response.CharSet = "utf-8"
set %response.ContentType = "text/javascript"
do ##class(UMLExplorer.StaticContent).WriteJS()
return $$$OK
]]></Implementation>
</Method>

<Method name="Index">
<Description>
Method returns user application.</Description>
<ClassMethod>1</ClassMethod>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
&html<{{replace:HTML}}>
&html<
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Cache UML explorer</title>
<link rel="stylesheet" href="css/CacheUMLExplorer.css">
<script src="js/CacheUMLExplorer.js"></script>
</head>
<body onload="var cue = new CacheUMLExplorer(document.getElementById('treeView'), document.getElementById('classView'))">
<div class="ui-body">
<div class="ui-sideBlock">
<div id="treeView">
</div>
</div>
<div class="ui-mainBlock">
<div class="ui-ClassInfo">
<span id="className"></span>
</div>
<div id="classView">
</div>
</div>
</div>
</body>
</html>
>
return $$$OK
]]></Implementation>
</Method>
</Class>


<Class name="UMLExplorer.StaticContent">
<TimeChanged>63663,76108.945861</TimeChanged>
<TimeCreated>63663,71456.865723</TimeCreated>

<Method name="WriteCSS">
<Description>
Outputs css code for UMLExplorer application</Description>
<ClassMethod>1</ClassMethod>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
Set xdata = ##class(%Dictionary.CompiledXData).%OpenId("UMLExplorer.StaticContent||CSS").Data
set status=##class(%XML.TextReader).ParseStream(xdata, .textreader)
while textreader.Read() { if (textreader.NodeType="chars") { w textreader.Value } }
return $$$OK
]]></Implementation>
</Method>

<Method name="WriteJS">
<Description>
Outputs js code for UMLExplorer application</Description>
<ClassMethod>1</ClassMethod>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
Set xdata = ##class(%Dictionary.CompiledXData).%OpenId("UMLExplorer.StaticContent||JS").Data
set status=##class(%XML.TextReader).ParseStream(xdata, .textreader)
while textreader.Read() { if (textreader.NodeType="chars") { w textreader.Value } }
return $$$OK
]]></Implementation>
</Method>

<XData name="CSS">
<Data><![CDATA[
<data>
{{replace:css}}
</data>
]]></Data>
</XData>

<XData name="JS">
<Data><![CDATA[
<data><![CDATA[
{{replace:js}}
]]]]><![CDATA[></data>
]]></Data>
</XData>
</Class>
</Export>
54 changes: 20 additions & 34 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var gulp = require("gulp"),
concat = require("gulp-concat"),
uglify = require("gulp-uglify"),
wrap = require("gulp-wrap"),
addsrc = require('gulp-add-src'),
minifyCSS = require("gulp-minify-css"),
htmlReplace = require("gulp-html-replace"),
header = require("gulp-header"),
Expand All @@ -29,15 +30,10 @@ gulp.task("clean", function () {
});

gulp.task("gatherScripts", ["clean"], function () {
return gulp.src([
"web/jsLib/joint.min.js",
"web/jsLib/joint.shapes.uml.js",
"web/jsLib/joint.layout.DirectedGraph.min.js",
"web/js/*.js"
])
return gulp.src("web/js/*.js")
.pipe(concat("CacheUMLExplorer.js"))
.pipe(replace(/\/\*\{\{replace:version}}\*\//, "\"" + pkg["version"] + "\""))
//.pipe(wrap("CacheUMLExplorer = (function(){<%= contents %> return CacheUMLExplorer;}());"))
.pipe(wrap("CacheUMLExplorer = (function(){<%= contents %> return CacheUMLExplorer;}());"))
.pipe(uglify({
output: {
ascii_only: true,
Expand All @@ -46,24 +42,19 @@ gulp.task("gatherScripts", ["clean"], function () {
}
}))
.pipe(header(banner, { pkg: pkg }))
.pipe(addsrc.prepend([
"web/jsLib/joint.min.js",
"web/jsLib/joint.shapes.uml.js",
"web/jsLib/joint.layout.DirectedGraph.min.js"
]))
.pipe(concat("CacheUMLExplorer.js"))
.pipe(gulp.dest("build/web/js/"));
});

//gulp.task("concatScripts", ["gatherScripts"], function () {
// return gulp.src([
// "web/jsLib/joint.min.js",
// "web/jsLib/joint.layout.DirectedGraph.min.js",
// "web/jsLib/joint.shapes.uml.js",
// "build/web/js/CacheUMLExplorer.js"
// ])
// .pipe(concat("CacheUMLExplorer.js"))
// .pipe(gulp.dest("build/web/js/"));
//});

gulp.task("gatherCSS", ["clean"], function () {
return gulp.src("web/css/*.css")
.pipe(concat("CacheUMLExplorer.css"))
.pipe(minifyCSS())
.pipe(minifyCSS({ keepSpecialComments: 0 }))
.pipe(gulp.dest("build/web/css/"));
});

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

gulp.task("addHTMLZIPFile", ["clean", "gatherScripts", "gatherCSS"], function () {
var jsRepl = "<script type='text/javascript'>" + fs.readFileSync("build/web/js/CacheUMLExplorer.js", "utf-8") + "</script>",
cssRepl = "<style type='text/css'>" + fs.readFileSync("build/web/css/CacheUMLExplorer.css") + "</style>";
return gulp.src("web/index.html")
.pipe(concat("ZIPindex.html"))
.pipe(replace(/<!\-\- build:js \-\->(.|\r|\n)*<!\-\- endbuild \-\->/, function () { return jsRepl; }))
.pipe(replace(/<!\-\- build:css \-\->(.|\r|\n)*<!\-\- endbuild \-\->/, function () { return cssRepl; }))
.pipe(gulp.dest("build/web"));
});

gulp.task("copyLICENSE", ["clean"], function (){
return gulp.src("LICENSE")
.pipe(gulp.dest("build/"));
Expand All @@ -97,13 +78,18 @@ gulp.task("copyREADME", ["clean"], function (){
});

gulp.task("exportCacheXML", [
"clean", "gatherCSS", "addHTMLFile", "addHTMLZIPFile", "copyLICENSE", "copyREADME"
"clean", "gatherCSS", "gatherScripts", "addHTMLFile", "copyLICENSE", "copyREADME"
], function () {
return gulp.src("cache/projectTemplate.xml")
.pipe(
replace(/\{\{replace:HTML}}/,
fs.readFileSync("build/web/ZIPindex.html", "utf-8"))
)
.pipe(replace(/\{\{replace:HTML}}/, fs.readFileSync("build/web/index.html", "utf-8")))
.pipe(replace(
/\{\{replace:css}}/,
function () { return fs.readFileSync("build/web/css/CacheUMLExplorer.css", "utf-8"); }
))
.pipe(replace(
/\{\{replace:js}}/,
function () { return fs.readFileSync("build/web/js/CacheUMLExplorer.js", "utf-8"); }
))
.pipe(rename(function (path) { path.basename += "-v" + pkg["version"]; }))
.pipe(gulp.dest("build/Cache"));
});
Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
{
"name": "CacheUMLExplorer",
"version": "0.1.1",
"version": "0.2",
"description": "An UML Class explorer for InterSystems Caché",
"directories": {
"test": "test"
},
"dependencies": {

},
"dependencies": {},
"devDependencies": {
"express": "^5.0.0-alpha.1",
"gulp": "^3.8.11",
"gulp-header": "^1.2.2",
"gulp-add-src": "^0.2.0",
"gulp-clean": "^0.3.1",
"gulp-concat": "^2.4.1",
"gulp-header": "^1.2.2",
"gulp-html-replace": "^1.4.1",
"gulp-minify-css": "^0.3.11",
"gulp-rename": "^1.2.0",
Expand Down

0 comments on commit feb1487

Please sign in to comment.