Skip to content

Commit

Permalink
Sources to UDL, build system update
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaeverywhere committed Jul 6, 2017
1 parent 0d9b807 commit d363a69
Show file tree
Hide file tree
Showing 34 changed files with 674 additions and 790 deletions.
739 changes: 0 additions & 739 deletions cache/projectTemplate.xml

This file was deleted.

91 changes: 49 additions & 42 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ var gulp = require("gulp"),
autoprefixer = require('autoprefixer-core'),
pkg = require("./package.json"),
zip = require("gulp-zip"),
rename = require("gulp-rename");
rename = require("gulp-rename"),
preprocess = require("gulp-preprocess");

var INSTALLER_CLASS_NAME = "ClassExplorer.Installer";

var banner = [
"",
Expand All @@ -26,7 +29,12 @@ var banner = [
" ** @see https://github.com/ZitRos/CacheClassExplorer",
" **/",
""
].join("\n");
].join("\n"),
context = {
context: {
package: pkg
}
};

var specialReplace = function () {
return replace(/[^\s]+\/\*build\.replace:(.*)\*\//g, function (part, match) {
Expand All @@ -42,12 +50,12 @@ gulp.task("clean", function () {

gulp.task("gatherLibs", ["clean"], function () {
return gulp.src([
"web/jsLib/jquery.min.js",
"web/jsLib/lodash.min.js",
"web/jsLib/backbone-min.js",
"web/jsLib/joint.js",
"web/jsLib/joint.shapes.uml.js",
"web/jsLib/ImageExporter.js"
"src/web/jsLib/jquery.min.js",
"src/web/jsLib/lodash.min.js",
"src/web/jsLib/backbone-min.js",
"src/web/jsLib/joint.js",
"src/web/jsLib/joint.shapes.uml.js",
"src/web/jsLib/ImageExporter.js"
])
.pipe(uglify({
output: {
Expand All @@ -58,18 +66,18 @@ gulp.task("gatherLibs", ["clean"], function () {
preserveComments: "some"
}))
.pipe(addsrc.append([
"web/jsLib/joint.layout.DirectedGraph.min.js"
"src/web/jsLib/joint.layout.DirectedGraph.min.js"
]))
.pipe(stripComments({ safe: true }))
.pipe(concat("CacheClassExplorer.js"))
.pipe(concat("index.js"))
.pipe(replace(/ /g, "\\x0B"))
.pipe(replace(/\x1b/g, "\\x1B"))
.pipe(gulp.dest("build/web/js/"));
});

gulp.task("gatherScripts", ["clean", "gatherLibs"], function () {
return gulp.src("web/js/*.js")
.pipe(concat("CacheClassExplorer.js"))
return gulp.src("src/web/js/*.js")
.pipe(concat("index.js"))
.pipe(specialReplace())
.pipe(wrap("CacheClassExplorer = (function(){<%= contents %> return CacheClassExplorer;}());"))
.pipe(uglify({
Expand All @@ -81,25 +89,25 @@ gulp.task("gatherScripts", ["clean", "gatherLibs"], function () {
preserveComments: "some"
}))
.pipe(header(banner, { pkg: pkg }))
.pipe(addsrc.prepend("build/web/js/CacheClassExplorer.js"))
.pipe(concat("CacheClassExplorer.js"))
.pipe(addsrc.prepend("build/web/js/index.js"))
.pipe(concat("index.js"))
.pipe(replace(/\x1b/g, "\\x1B"))
.pipe(gulp.dest("build/web/js/"));
});

gulp.task("gatherCSS", ["clean"], function () {
return gulp.src("web/css/*.css")
.pipe(concat("CacheClassExplorer.css"))
return gulp.src("src/web/css/*.css")
.pipe(concat("index.css"))
.pipe(postcss([ autoprefixer({ browsers: ["last 3 version"] }) ]))
.pipe(minifyCSS({ keepSpecialComments: 0 }))
.pipe(gulp.dest("build/web/css/"));
});

gulp.task("addHTMLFile", ["clean"], function () {
return gulp.src("web/index.html")
return gulp.src("src/web/index.html")
.pipe(htmlReplace({
"css": "css/CacheClassExplorer.css",
"js": "js/CacheClassExplorer.js"
"css": "css/index.css",
"js": "js/index.js"
}))
.pipe(gulp.dest("build/web/"));
});
Expand All @@ -114,33 +122,32 @@ gulp.task("copyREADME", ["clean"], function () {
.pipe(gulp.dest("build/"));
});

gulp.task("exportCacheXML", [
"clean", "gatherCSS", "gatherScripts", "addHTMLFile", "copyLICENSE", "copyREADME"
], function () {
return gulp.src("cache/projectTemplate.xml")
.pipe(specialReplace())
.pipe(replace(
/\{\{replace:css}}/,
function () { return fs.readFileSync("build/web/css/CacheClassExplorer.css", "utf-8"); }
))
.pipe(replace(
/\{\{replace:js}}/,
function () { return fs.readFileSync("build/web/js/CacheClassExplorer.js", "utf-8"); }
))
.pipe(replace(
/\{\{replace:html}}/,
function () { return fs.readFileSync("build/web/index.html", "utf-8"); }
))
.pipe(rename(function (path) { path.basename = "CacheClassExplorer-v" + pkg["version"]; }))
.pipe(gulp.dest("build/Cache"));
gulp.task("pre-cls", ["clean"], function () {
return gulp.src(["src/cls/**/*.cls"])
.pipe(rename(function (f) {
f.basename = (f.dirname === "." ? "" : f.dirname + ".") + f.basename;
f.dirname = ".";
if (f.basename !== INSTALLER_CLASS_NAME)
context.context.compileAfter +=
(context.context.compileAfter ? "," : "") + f.basename;
}))
.pipe(gulp.dest("build/cls/"));
});

gulp.task("cls", ["pre-cls", "copyLICENSE", "copyREADME", "addHTMLFile", "gatherScripts",
"gatherCSS"], function () {
return gulp.src(["build/cls/**/*.cls"])
.pipe(preprocess(context))
.pipe(gulp.dest("build/cls"));
});

gulp.task("zipRelease", ["exportCacheXML"], function () {
return gulp.src(["build/**/*", "!build/web/**/*"])
gulp.task("zipRelease", function () {
return gulp.src(["build/**/*", "!build/web/**/*.*", "!build/cls/**/*.*"])
.pipe(zip("CacheClassExplorer-v" + pkg["version"] + ".zip", {
comment: "Cache UML explorer v" + pkg["version"] + " by Nikita Savchenko\n\n" +
"+ Cache folder holds XML file to import to InterSystems Cache.\n\n" +
"For further information about installation and information, check README.md file."
"For further information about installation and information, check README.md file.\n\n"
+ "See https://github.com/intersystems-ru/UMLExplorer"
}))
.pipe(gulp.dest("build"));
});
Expand All @@ -150,4 +157,4 @@ gulp.task("desktop", ["default"], function () {
.pipe(gulp.dest("C:/Users/ZitRo/Desktop"));
});

gulp.task("default", ["zipRelease"]);
gulp.task("default", ["cls"]);
16 changes: 13 additions & 3 deletions import.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,19 @@
:: the project. Replace the path below to your Caché installation and build & import application to
:: Caché using only one command.

:: CHANGE THIS PATH TO YOUR CACHÉ INSTALLATION PATH ON WINDOWS
:: Latest NodeJS & Caché 2016.2+ IS REQUIRED TO PROCEED
@echo off

:: CHANGE THIS PATH TO YOUR CACHÉ INSTALLATION PATH ON WINDOWS (folder that contains bin, CSP, mgr and other folders)
set CACHE_DIR=C:\Program Files\InterSystems\Ensemble
:: NAMESPACE IMPORTING TO
:: NAMESPACE TO IMPORT PACKAGE TO
set NAMESPACE=USER
:: Other variables
set BUILD_DIR=build\cls
:: Export
set XML_EXPORT_DIR=build
set PACKAGE_NAME=ClassExplorer

npm run gulp & echo w "OK:"_$system.OBJ.ImportDir("%~dp0build\Cache",,"ck") halt | "%CACHE_DIR%\bin\cache.exe" -s "%CACHE_DIR%\mgr" -U %NAMESPACE%
npm run gulp && ^
echo s st = $system.Status.GetErrorText($system.OBJ.ImportDir("%~dp0%BUILD_DIR%",,"ck")) w "IMPORT STATUS: "_$case(st="",1:"OK",:st) halt | "%CACHE_DIR%\bin\cache.exe" -s "%CACHE_DIR%\mgr" -U %NAMESPACE% && ^
echo s st = $system.Status.GetErrorText($system.OBJ.ExportPackage("%PACKAGE_NAME%", "%~dp0%XML_EXPORT_DIR%\%PACKAGE_NAME%-v"_##class(%PACKAGE_NAME%.Installer).#VERSION_".xml")) w $c(13,10)_"EXPORT STATUS: "_$case(st="",1:"OK",:st) halt | "%CACHE_DIR%\bin\cache.exe" -s "%CACHE_DIR%\mgr" -U %NAMESPACE%
31 changes: 25 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"name": "CacheClassExplorer",
"version": "1.20.1",
"version": "1.21.0",
"description": "Class Explorer for InterSystems Caché",
"directories": { "test": "test" },
"directories": {
"test": "test"
},
"dependencies": {},
"devDependencies": {
"autoprefixer-core": "^6.0.1",
Expand All @@ -14,18 +16,35 @@
"gulp-html-replace": "^1.6.2",
"gulp-minify-css": "^1.2.4",
"gulp-postcss": "^6.4.0",
"gulp-preprocess": "^2.0.0",
"gulp-rename": "^1.2.0",
"gulp-replace": "^0.5.3",
"gulp-strip-comments": "^2.4.5",
"gulp-uglify": "^2.1.2",
"gulp-wrap": "^0.13.0",
"gulp-zip": "^4.0.0"
},
"scripts": { "gulp": "gulp" },
"repository": { "type": "git", "url": "https://github.com/ZitRos/CacheUMLExplorer" },
"keywords": [ "UMLExplorer", "Caché", "UML", "diagram" ],
"scripts": {
"gulp": "gulp",
"zip": "gulp zipRelease"
},
"repository": {
"type": "git",
"url": "https://github.com/ZitRos/CacheUMLExplorer"
},
"keywords": [
"UMLExplorer",
"Caché",
"Class",
"Explorer",
"UML",
"diagram",
"builder"
],
"author": "ZitRo",
"license": "MIT",
"bugs": { "url": "https://github.com/ZitRos/CacheUMLExplorer/issues" },
"bugs": {
"url": "https://github.com/ZitRos/CacheUMLExplorer/issues"
},
"homepage": "https://github.com/ZitRos/CacheUMLExplorer"
}
Loading

0 comments on commit d363a69

Please sign in to comment.