-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathgulpfile.js
More file actions
97 lines (87 loc) · 2.24 KB
/
gulpfile.js
File metadata and controls
97 lines (87 loc) · 2.24 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
91
92
93
94
95
96
97
/*eslint-env node*/
'use strict';
// Gulp plugins
var gulp = require('gulp'),
gutil = require('gulp-util'),
ping = require('ping'),
watcher = require('./lib/file-watch'),
perl = require('./lib/perl'),
config = require('./config');
/**
* File watch and trigger build of:
* * JavaScript
* * CSS/LESS
* * Perl
* * HTML
*/
gulp.task('watch', config['watch-tasks']);
/**
* CSS/LESS
*/
gulp.task('styles', ['is-online'], function () {
return watcher(['/**/Data/Public/**/*.css', '/**/Data/Public/**/*.less'], function (file, copyToShared) {
copyToShared();
}, function (file, removeFromShared) {
removeFromShared();
}, function (file, addToShared) {
addToShared();
});
});
/**
* Javascript
*/
gulp.task('scripts', ['is-online'], function () {
return watcher('/**/Data/Public/**/*.js', function (file, copyToShared) {
copyToShared();
}, function (file, removeFromShared) {
removeFromShared();
}, function (file, addToShared) {
addToShared();
});
});
/**
* Perl
*/
gulp.task('perl', ['is-online'], function () {
return watcher(['/**/*.pm', '/**/*.pl', '/**/*.t'], function (source) {
return perl.lint(source.replace(config['cartridges-local'], config['cartridges-remote']));
});
});
/**
* Html
*/
gulp.task('html', ['is-online'], function () {
return watcher('/**/*.html', function (source) {
return perl.tle(source.replace(config['cartridges-local'], config['cartridges-remote']));
});
});
/**
* epages 6 controls
*/
gulp.task('is-online', function (done) {
ping.sys.probe(config['vm-domain'], function (isAlive) {
if (isAlive) {
gutil.log(gutil.colors.green('VM ' + config['vm-domain'] + ' is online'));
return done();
}
gutil.log(gutil.colors.red('VM ' + config['vm-domain'] + ' seems to be offline'));
});
});
gulp.task('reinstall', ['is-online'], function (done) {
perl.reinstall(function () {
done();
process.exit(0);
});
});
gulp.task('build', ['is-online'], function (done) {
perl.build(function () {
done();
process.exit(0);
});
});
/**
* Default task including:
* * build
* * watch
*/
gulp.task('default', ['watch']);