forked from openiap/opencore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
90 lines (80 loc) · 3.67 KB
/
Copy pathgulpfile.js
File metadata and controls
90 lines (80 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
var fs = require("fs");
var gulp = require("gulp");
var shell = require("gulp-shell");
var replace = require('gulp-replace');
var OpenFlowFiles = ["./OpenFlow/src/public/**/*.html", "./OpenFlow/src/public/**/*.css", "./OpenFlow/src/public/**/*.js", "./OpenFlow/src/public/**/*.json",
"./OpenFlow/src/public/**/*.ico", "./OpenFlow/src/public/**/*.eot", "./OpenFlow/src/public/**/*.svg", "./OpenFlow/src/public/**/*.ttf",
"./OpenFlow/src/public/**/*.woff", "./OpenFlow/src/public/**/*.png"];
var NodeREDHTMLFiles = ["./OpenFlowNodeRED/src/nodered/nodes/**/*.html"]
var destination = "./dist/public";
var version = "0.0.1";
if (fs.existsSync("../VERSION")) {
version = fs.readFileSync("../VERSION", "utf8");
} else if (fs.existsSync("VERSION")) {
version = fs.readFileSync("VERSION", "utf8");
}
gulp.task("copyfiles1", function () {
console.log("copyfiles1");
return gulp.src(OpenFlowFiles)
.pipe(gulp.dest(destination));
});
gulp.task("copyfiles2", function () {
console.log("copyfiles2");
return gulp.src(NodeREDHTMLFiles)
.pipe(gulp.dest("OpenFlowNodeRED/dist/nodered/nodes"));
});
gulp.task("watch", function () {
gulp.watch(OpenFlowFiles, gulp.series("copyfiles1"));
return gulp.watch(NodeREDHTMLFiles, gulp.series("copyfiles2"));
});
// gulp.task("compose", shell.task([
// 'cd OpenFlowNodeRED && tsc -p tsconfig.json && docker build -t cloudhack/openflownodered:edge .',
// 'cd OpenFlowNodeRED && tsc -p tsconfig.json && docker build -t cloudhack/openflownodered:edge .',
// 'docker tag cloudhack/openflownodered:edge cloudhack/openflownodered:' + version,
// 'docker push cloudhack/openflownodered',
// 'gulp copyfiles',
// 'tsc -p OpenFlow/tsconfig.json',
// 'docker build -t cloudhack/openflow:edge .',
// 'docker tag cloudhack/openflow:edge cloudhack/openflow:' + version,
// 'docker push cloudhack/openflow'
// ]));
gulp.task("compose", shell.task([
'gulp copyfiles1',
'gulp copyfiles2',
'echo "compile OpenFlowNodeRED"',
'cd OpenFlowNodeRED && tsc -p tsconfig.json',
'echo "Build cloudhack/openflownodered"',
'cd OpenFlowNodeRED && docker build -t cloudhack/openflownodered:edge .',
'docker tag cloudhack/openflownodered:edge cloudhack/openflownodered:' + version,
'echo "Push cloudhack/openflownodered"',
'docker push cloudhack/openflownodered:' + version,
'echo "compile OpenFlow"',
'tsc -p OpenFlow/tsconfig.json',
'echo "Build cloudhack/openflow"',
'docker build -t cloudhack/openflow:edge .',
'docker tag cloudhack/openflow:edge cloudhack/openflow:' + version,
'echo "Push cloudhack/openflow"',
'docker push cloudhack/openflow:' + version
]));
gulp.task("bumpflow", function () {
console.log('cloudhack/openflow:' + version);
return gulp.src(["config/**/controllers.yml"])
.pipe(replace(/openflow:\d+(\.\d+)+/g, 'openflow:' + version))
.pipe(gulp.dest("config"));
});
gulp.task("bumpnodered", function () {
console.log('cloudhack/openflownodered:' + version);
return gulp.src(["config/**/controllers.yml"])
.pipe(replace(/openflownodered:\d+(\.\d+)+/g, 'openflownodered:' + version))
.pipe(gulp.dest("config"));
});
gulp.task("bumpaiotfrontend", function () {
var version = "0.0.1";
version = fs.readFileSync("../aiot-frontend/VERSION", "utf8");
console.log('cloudhack/aiot-frontend:' + version);
return gulp.src(["config/**/controllers.yml"])
.pipe(replace(/aiot-frontend:\d+(\.\d+)+/g, 'aiot-frontend:' + version))
.pipe(gulp.dest("config"));
});
gulp.task("bump", gulp.series("bumpflow", "bumpnodered", "bumpaiotfrontend"));
gulp.task("default", gulp.series("copyfiles1", "copyfiles2", "watch"));