This repository has been archived by the owner on Sep 24, 2020. It is now read-only.
forked from gashcrumb/hawtio-artemis
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
106 lines (95 loc) · 2.84 KB
/
gulpfile.js
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
const templateCache = require('gulp-angular-templatecache');
const clean = require('gulp-clean');
const concat = require('gulp-concat');
const gulp = require('gulp');
const hawtio = require('@hawtio/node-backend');
const ngAnnotate = require('gulp-ng-annotate');
const wiredep = require('wiredep').stream;
const pkg = require('./package.json');
const config = {
src: [
'plugins/artemis/js/jmsHeaderSchema.js',
'plugins/artemis/js/artemisPlugin.js',
'plugins/artemis/js/artemisInit.js',
'plugins/artemis/lib/artemis-console.js',
'plugins/artemis/js/artemisService.js',
'plugins/artemis/js/artemisHelpers.js',
'plugins/artemis/js/tree.js',
'plugins/artemis/js/preferences.js',
'plugins/artemis/js/address.js',
'plugins/artemis/js/addresses.js',
'plugins/artemis/js/brokerDiagram.js',
'plugins/artemis/js/browse.js',
'plugins/artemis/js/connections.js',
'plugins/artemis/js/consumers.js',
'plugins/artemis/js/producers.js',
'plugins/artemis/js/queue.js',
'plugins/artemis/js/queues.js',
'plugins/artemis/js/send.js',
'plugins/artemis/js/sessions.js',
'./templates.js'
],
templates: 'plugins/**/*.html',
js: pkg.name + '.js',
template: pkg.name + '-template.js',
templateModule: pkg.name + '-template'
};
gulp.task('bower', function () {
gulp.src('index.html')
.pipe(wiredep({}))
.pipe(gulp.dest('.'));
});
gulp.task('templates', function () {
return gulp.src(config.templates)
.pipe(templateCache({
filename: 'templates.js',
root: 'plugins/',
standalone: true,
module: config.templateModule,
templateFooter: '}]); hawtioPluginLoader.addModule("' + config.templateModule + '");'
}))
.pipe(gulp.dest('.'));
});
gulp.task('concat', ['templates'], function () {
return gulp.src(config.src)
.pipe(concat(config.js))
.pipe(ngAnnotate())
.pipe(gulp.dest('./dist/'));
});
gulp.task('clean', ['concat'], function () {
return gulp.src('./templates.js', { read: false })
.pipe(clean());
});
gulp.task('connect', function () {
gulp.watch([config.src, config.templates], ['build']);
gulp.watch(['libs/**/*.js', 'libs/**/*.css', 'index.html', 'dist/' + config.js], ['reload']);
hawtio.setConfig({
port: 2772,
staticProxies: [
{
port: 8778,
path: '/jolokia',
targetPath: '/jolokia'
}
],
staticAssets: [{
path: '/',
dir: '.'
}],
fallback: 'index.html',
liveReload: {
enabled: true
}
});
hawtio.listen(function (server) {
var host = server.address().address;
var port = server.address().port;
console.log("started from gulp file at ", host, ":", port);
});
});
gulp.task('reload', function () {
gulp.src('.')
.pipe(hawtio.reload());
});
gulp.task('build', ['templates', 'concat', 'clean']);
gulp.task('default', ['build', 'connect']);