Skip to content

Commit 2c1735f

Browse files
Moving WEB terminal into RESTful application, installer add
1 parent a8cd27f commit 2c1735f

File tree

8 files changed

+1514
-276
lines changed

8 files changed

+1514
-276
lines changed

export/template.xml

Lines changed: 1359 additions & 0 deletions
Large diffs are not rendered by default.

gulpfile.js

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
var gulp = require("gulp"),
2+
rimraf = require("gulp-rimraf"),
3+
replace = require("gulp-replace"),
4+
uglify = require("gulp-uglify"),
5+
concat = require("gulp-concat"),
6+
minifyCSS = require("gulp-minify-css"),
7+
htmlReplace = require("gulp-html-replace"),
8+
rename = require("gulp-rename"),
9+
fs = require("fs"),
10+
11+
pkg = require("./package.json"),
12+
source = "webSource",
13+
buildTo = "build2";
14+
15+
var specialReplace = function () {
16+
return replace(/[^\s]+\/\*build\.replace:(.*)\*\//g, function (part, match) {
17+
var s = match.toString();
18+
return s.replace(/pkg\.([a-zA-Z]+)/g, function (p,a) { return pkg[a]; });
19+
});
20+
};
21+
22+
gulp.task("clean", function () {
23+
return gulp.src("./" + buildTo, { read: false })
24+
.pipe(rimraf());
25+
});
26+
27+
gulp.task("copy-html", ["clean"], function () {
28+
return gulp.src("./" + source + "/index.html")
29+
.pipe(htmlReplace({
30+
"css": "css/terminal.css",
31+
"js": "js/terminal.js"
32+
}))
33+
.pipe(gulp.dest("./" + buildTo + "/web"));
34+
});
35+
36+
gulp.task("copy-js", ["clean"], function () {
37+
return gulp.src("./" + source + "/js/**/*.js")
38+
.pipe(concat("terminal.js"))
39+
.pipe(specialReplace())
40+
.pipe(uglify({
41+
output: {
42+
ascii_only: true,
43+
width: 25000,
44+
max_line_len: 25000
45+
},
46+
preserveComments: "some"
47+
}))
48+
.pipe(replace(/ /g, "\\x0B"))
49+
.pipe(replace(/\x1b/g, "\\x1B"))
50+
.pipe(gulp.dest("./" + buildTo + "/web/js/"));
51+
});
52+
53+
gulp.task("copy-css-basic", ["clean"], function () {
54+
return gulp.src([
55+
"./" + source + "/css/base.css",
56+
"./" + source + "/css/terminal.css",
57+
"./" + source + "/css/terminal-extra.css",
58+
"./" + source + "/css/terminal-graphic.css"
59+
]).pipe(concat("terminal.css"))
60+
.pipe(minifyCSS({ keepSpecialComments: 0 }))
61+
.pipe(gulp.dest("./" + buildTo + "/web/css/"));
62+
});
63+
64+
gulp.task("copy-css-themes", ["clean"], function () {
65+
return gulp.src([
66+
"./" + source + "/css/terminal-theme-cache.css"
67+
]).pipe(minifyCSS({ keepSpecialComments: 0 }))
68+
.pipe(gulp.dest("./" + buildTo + "/web/css/"));
69+
});
70+
71+
gulp.task("export", ["copy-html", "copy-js", "copy-css-themes", "copy-css-basic" ], function () {
72+
return gulp.src("export/template.xml")
73+
.pipe(specialReplace())
74+
.pipe(replace(
75+
/\{\{replace:css}}/,
76+
function () {
77+
return fs.readFileSync("./" + buildTo + "/web/css/terminal.css", "utf-8");
78+
}
79+
))
80+
.pipe(replace(
81+
/\{\{replace:js}}/,
82+
function () {
83+
return fs.readFileSync("./" + buildTo + "/web/js/terminal.js", "utf-8");
84+
}
85+
))
86+
.pipe(replace(
87+
/\{\{replace:html}}/,
88+
function () { return fs.readFileSync("./" + buildTo + "/web/index.html", "utf-8"); }
89+
))
90+
.pipe(rename(function (path) { path.basename = "CacheWebTerminal-v" + pkg["version"]; }))
91+
.pipe(gulp.dest("./" + buildTo));
92+
});
93+
94+
gulp.task("default", ["export"]);

package.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@
33
"title": "Cache WEB Terminal",
44
"description": "Web-based terminal emulator for Caché administering.",
55
"author": "ZitRo",
6-
"version": "2.0.0-beta.8",
6+
"version": "3.0.0-alpha.1",
77
"releaseNumber": "10",
88
"repository": {
99
"type": "git",
1010
"url": "https://github.com/intersystems-ru/webterminal.git"
1111
},
1212
"devDependencies": {
13-
"grunt": ">=0.4.5",
14-
"grunt-contrib-clean": ">=0.6.0",
15-
"grunt-contrib-concat": ">=0.5.0",
16-
"grunt-contrib-copy": "^0.7.0",
17-
"grunt-contrib-uglify": ">=0.6.0",
18-
"grunt-preprocess": "^4.1.0"
13+
"express": "^4.13.3",
14+
"gulp-concat": "^2.6.0",
15+
"gulp-html-replace": "^1.5.5",
16+
"gulp-minify-css": "^1.2.2",
17+
"gulp-rename": "^1.2.2",
18+
"gulp-replace": "^0.5.4",
19+
"gulp-rimraf": "^0.2.0",
20+
"gulp-uglify": "^1.5.1"
1921
}
2022
}

webSource/index.html

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
<meta name="mobile-web-app-capable" content="yes"/>
1313
<meta name="apple-mobile-web-app-capable" content="yes"/>
1414
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon"/>
15-
<!-- @ifdef DEBUG -->
15+
<!-- build:css -->
1616
<link rel="stylesheet" href="css/base.css"/>
1717
<link rel="stylesheet" href="css/terminal.css"/>
1818
<link rel="stylesheet" href="css/terminal-extra.css"/>
1919
<link rel="stylesheet" href="css/terminal-graphic.css"/>
20+
<!-- endbuild -->
21+
<!-- build:js -->
2022
<script type="text/javascript" src="js/Globals.js"></script>
2123
<script type="text/javascript" src="js/CacheWebTerminalServer.js"></script>
2224
<script type="text/javascript" src="js/CacheTracing.js"></script>
@@ -40,12 +42,7 @@
4042
<script type="text/javascript" src="js/TerminalTheme.js"></script>
4143
<script type="text/javascript" src="js/TerminalIndicator.js"></script>
4244
<script type="text/javascript" src="js/TerminalSettings.js"></script>
43-
<!-- @endif -->
44-
<!-- @ifndef DEBUG -->
45-
<link rel="stylesheet" href="css/base.css"/>
46-
<link rel="stylesheet" href="css/terminal.css"/>
47-
<script type="text/javascript" src="js/terminal.js"></script>
48-
<!-- @endif -->
45+
<!-- endbuild -->
4946
</head>
5047
<body onload="this.terminal = createTerminal(); document.body.removeAttribute('onload');">
5148

webSource/js/CacheWebTerminalServer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var CacheWebTerminalServer = function (CONTROLLER, WS_PROTOCOL, IP, PORT) {
1818
/**
1919
* @type {string}
2020
*/
21-
this.CACHE_CLASS_NAME = "%WebTerminal.Engine.cls";
21+
this.CACHE_CLASS_NAME = "WebTerminal.Engine.cls";
2222

2323
/**
2424
* @type {string}

webSource/js/Globals.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,15 @@ var AJAX = new function() {
6464
/**
6565
* Initialization function. Exported after build.
6666
*
67-
* @param {string} authKey
67+
* @param {string} [authKey]
6868
* @param {string} namespace
6969
*/
70-
this.createTerminal = function (authKey, namespace) {
70+
window.createTerminal = function (authKey, namespace) {
7171

7272
var term;
7373

74+
console.log(authKey, namespace);
75+
7476
term = new Terminal({
7577
container: document.body,
7678
authKey: authKey || null,

webSource/js/TerminalController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var TerminalController = function (TERMINAL) {
2828
*/
2929
this.server = new CacheWebTerminalServer(
3030
this, (location.protocol === "https:" ? "wss:" : "ws:"), location.hostname,
31-
"".concat(/* @echo "location.port || 80" */) || "57773"
31+
""/*build.replace:location.port*/ || "57776"
3232
);
3333

3434
/**

0 commit comments

Comments
 (0)