Skip to content

Commit

Permalink
basic build, diagram improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaeverywhere committed Apr 15, 2015
1 parent 98cd0c0 commit e87d1f1
Show file tree
Hide file tree
Showing 14 changed files with 336 additions and 28 deletions.
17 changes: 15 additions & 2 deletions cache/projectTemplate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Class contains methods that return structured class data.</Description>
</Class>


<Project name="UMLExplorer" LastModified="2015-04-12 16:26:04.713512">
<Project name="UMLExplorer" LastModified="2015-04-12 19:03:12.221887">
<Items>
<ProjectItem name="UMLExplorer.Router" type="CLS"></ProjectItem>
<ProjectItem name="UMLExplorer.ClassView" type="CLS"></ProjectItem>
Expand All @@ -92,12 +92,14 @@ Class contains methods that return structured class data.</Description>
<Description>
REST interface for UMLExplorer</Description>
<Super>%CSP.REST</Super>
<TimeChanged>63653,74965.264444</TimeChanged>
<TimeChanged>63654,68682.349536</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="/Test" Method="GET" Call="Test"/>
<Route Url="/GetClassTree" Method="GET" Call="GetClassTree"/>
<Route Url="/GetClassView/:ClassName" Method="GET" Call="GetClassView"/>
Expand Down Expand Up @@ -175,5 +177,16 @@ Method to test accessibility of REST interface.</Description>
return $$$OK
]]></Implementation>
</Method>

<Method name="Index">
<Description>
Method returns user application.</Description>
<ClassMethod>1</ClassMethod>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
&html<{{replace:HTML}}>
return $$$OK
]]></Implementation>
</Method>
</Class>
</Export>
128 changes: 128 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
var gulp = require("gulp"),
fs = require("fs"),
clean = require("gulp-clean"),
concat = require("gulp-concat"),
uglify = require("gulp-uglify"),
wrap = require("gulp-wrap"),
minifyCSS = require("gulp-minify-css"),
htmlReplace = require("gulp-html-replace"),
header = require("gulp-header"),
replace = require("gulp-replace"),
pkg = require("./package.json"),
zip = require("gulp-zip"),
rename = require("gulp-rename");

var banner = [
"/** <%= pkg.name %>",
" ** <%= pkg.description %>",
" ** @author <%= pkg.author %>",
" ** @version <%= pkg.version %>",
" ** @license <%= pkg.license %>",
" ** @see https://github.com/ZitRos/CacheUMLExplorer",
" **/",
""
].join("\n");

gulp.task("clean", function () {
return gulp.src("build", {read: false})
.pipe(clean());
});

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"
])
.pipe(concat("CacheUMLExplorer.js"))
.pipe(replace(/\/\*\{\{replace:version}}\*\//, "\"" + pkg["version"] + "\""))
//.pipe(wrap("CacheUMLExplorer = (function(){<%= contents %> return CacheUMLExplorer;}());"))
.pipe(uglify({
output: {
ascii_only: true,
width: 30000,
max_line_len: 30000
}
}))
.pipe(header(banner, { pkg: pkg }))
.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(gulp.dest("build/web/css/"));
});

gulp.task("addHTMLFile", ["clean"], function () {
return gulp.src("web/index.html")
.pipe(htmlReplace({
"css": "css/CacheUMLExplorer.css",
"js": "js/CacheUMLExplorer.js"
}))
.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/"));
});

gulp.task("copyREADME", ["clean"], function (){
return gulp.src("readme.md")
.pipe(gulp.dest("build/"));
});

gulp.task("exportCacheXML", [
"clean", "gatherCSS", "addHTMLFile", "addHTMLZIPFile", "copyLICENSE", "copyREADME"
], function () {
return gulp.src("cache/projectTemplate.xml")
.pipe(
replace(/\{\{replace:HTML}}/,
fs.readFileSync("build/web/ZIPindex.html", "utf-8"))
)
.pipe(rename(function (path) { path.basename += "-v" + pkg["version"]; }))
.pipe(gulp.dest("build/Cache"));
});

gulp.task("zipRelease", ["exportCacheXML"], function () {
return gulp.src("build/**/*")
.pipe(zip("CacheUMLExplorer-v" + pkg["version"] + ".zip", {
comment: "Cach? UML explorer v" + pkg["version"] + " by Nikita Savchenko\n\n" +
"+ WEBModule folder holds packed JS/CSS files to integrate CacheUMLExplorer to any WEB " +
"application;\n" +
"+ Cache folder holds XML file to import to InterSystems Cache.\n\n" +
"For further information about installation and information, check README.md file."
}))
.pipe(gulp.dest("build"));
});

gulp.task("desktop", ["default"], function () {
return gulp.src("build/Cache/*")
.pipe(gulp.dest("C:/Users/ZitRo/Desktop"));
});

gulp.task("default", ["zipRelease"]);
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "CacheUMLExplorer",
"version": "0.0.1",
"version": "0.1.1",
"description": "An UML Class explorer for InterSystems Caché",
"directories": {
"test": "test"
Expand All @@ -10,7 +10,8 @@
},
"devDependencies": {
"express": "^5.0.0-alpha.1",
"gulp": "^3.8.10",
"gulp": "^3.8.11",
"gulp-header": "^1.2.2",
"gulp-clean": "^0.3.1",
"gulp-concat": "^2.4.1",
"gulp-html-replace": "^1.4.1",
Expand Down
15 changes: 15 additions & 0 deletions web/css/classView.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,19 @@

text {
font-family: monospace;
}

.centralText {
display: table;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
text-align: center;
}

.centralText > div {
display: table-cell;
vertical-align: middle;
}
14 changes: 14 additions & 0 deletions web/css/interface.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,18 @@ html, body {
position: relative;
margin-left: 300px;
height: 100%;
}

.ui-ClassInfo {
position: absolute;
top: 0;
left: 0;
width: 100%;
padding: .5em;
font-weight: 600;
font-size: 18pt;
}

#className {
text-shadow: 1px 1px 0 white, -1px -1px 0 white, 1px -1px 0 white, -1px 1px 0 white;
}
13 changes: 10 additions & 3 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@
<head lang="en">
<meta charset="UTF-8">
<title>Caché UML explorer</title>
<!-- build:css -->
<link rel="stylesheet" href="css/interface.css"/>
<link rel="stylesheet" href="css/treeView.css"/>
<link rel="stylesheet" href="css/extras.css"/>
<link rel="stylesheet" href="css/classView.css"/>
<link rel="stylesheet" href="css/joint.min.css"/>
<script type="text/javascript" src="js/joint.min.js"></script>
<script type="text/javascript" src="js/joint.shapes.uml.js"></script>
<script type="text/javascript" src="js/joint.layout.DirectedGraph.min.js"></script>
<!-- endbuild -->
<!-- build:js -->
<script type="text/javascript" src="jsLib/joint.min.js"></script>
<script type="text/javascript" src="jsLib/joint.shapes.uml.js"></script>
<script type="text/javascript" src="jsLib/joint.layout.DirectedGraph.min.js"></script>
<script type="text/javascript" src="js/ClassView.js"></script>
<script type="text/javascript" src="js/Lib.js"></script>
<script type="text/javascript" src="js/CacheUMLExplorer.js"></script>
<script type="text/javascript" src="js/ClassTree.js"></script>
<script type="text/javascript" src="js/Source.js"></script>
<!-- endbuild -->
</head>
<body onload="var cue = new CacheUMLExplorer(document.getElementById('treeView'), document.getElementById('classView'))">
<div class="ui-body">
Expand All @@ -25,6 +29,9 @@
</div>
</div>
<div class="ui-mainBlock">
<div class="ui-ClassInfo">
<span id="className"></span>
</div>
<div id="classView">

</div>
Expand Down
8 changes: 7 additions & 1 deletion web/js/CacheUMLExplorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@
*/
var CacheUMLExplorer = function (treeViewContainer, classViewContainer) {

this.elements = {
className: document.getElementById("className"),
treeViewContainer: treeViewContainer,
classViewContainer: classViewContainer
};

this.source = new Source();
this.classTree = new ClassTree(this, treeViewContainer);
this.classView = new ClassView(classViewContainer);
this.classView = new ClassView(this, classViewContainer);

this.init();

Expand Down
10 changes: 3 additions & 7 deletions web/js/ClassTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,11 @@ ClassTree.prototype.classSelected = function (element, className) {

if (!element.classList.contains("selected")) {
element.classList.add("selected");
this.cacheUMLExplorer.source.getClassView(className, function (err, data) {
if (err) {
console.error(err);
} else {
self.cacheUMLExplorer.classView.render(data);
}
});
this.cacheUMLExplorer.classView.loadClass(className);
}

this.cacheUMLExplorer.elements.className.textContent = className;

};

ClassTree.prototype.updateTree = function (treeObject) {
Expand Down
Loading

0 comments on commit e87d1f1

Please sign in to comment.