forked from polimediaupv/paella-opencast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
90 lines (66 loc) · 2.63 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
"use strict"
var gulp = require('gulp');
var clean = require('gulp-clean');
var spawn = require('child_process').spawn;
var mergeStream = require('merge-stream');
var connect = require('gulp-connect');
var serveStatic = require('serve-static');
var httpProxy = require('http-proxy');
var proxy = httpProxy.createProxyServer({secure:false});
gulp.task('paella-opencast:clean', function () {
return gulp.src('build', {read: false}).pipe(clean());
});
gulp.task('paella-opencast:prepare:source', function(){
var s1 = gulp.src('node_modules/paellaplayer/**').pipe(gulp.dest('build/paella'));
var s2 = gulp.src('paella-opencast/plugins/**').pipe(gulp.dest('build/paella/plugins'));
return mergeStream(s1,s2);
});
gulp.task('paella-opencast:prepare', ['paella-opencast:prepare:source'], function(cb){
var cmd_npm = spawn('npm', ['install'], {cwd: 'build/paella', stdio: 'inherit'});
cmd_npm.on('close', function (code) {
cb(code);
});
});
gulp.task('paella-opencast:compile.debug', ['paella-opencast:prepare'], function(cb){
var cmd_npm = spawn('node', ['node_modules/gulp/bin/gulp.js', 'build.debug'], {cwd: 'build/paella'/*, stdio: 'inherit'*/});
cmd_npm.on('close', function (code) {
cb(code);
});
});
gulp.task('paella-opencast:compile.release', ['paella-opencast:prepare'], function(cb){
var cmd_npm = spawn('node', ['node_modules/gulp/bin/gulp.js', 'build.release'], {cwd: 'build/paella'/*, stdio: 'inherit'*/});
cmd_npm.on('close', function (code) {
cb(code);
});
});
gulp.task('paella-opencast:build', ["paella-opencast:compile.debug"], function(){
return gulp.src([
'build/paella/build/player/**',
'paella-opencast/ui/**'
]).pipe(gulp.dest('build/paella-opencast'));
});
gulp.task('paella-opencast:server:rebuild', ['paella-opencast:build'], function(){
return connect.reload();
});
gulp.task('paella-opencast:server:watch', function () {
return gulp.watch(['paella-opencast/plugins/**'], ['paella-opencast:server:rebuild']);
});
gulp.task('paella-opencast:server:run', function() {
return connect.server({
port: 8000,
middleware: function(connect, opt) {
return [
[ "/paella/ui", serveStatic('build/paella-opencast', {'index': ['index.html']}) ],
[ "/", function(req, res, next) {
//proxy.web(req, res, { target: 'http://engage.opencast.org/' });
proxy.web(req, res, { target: 'http://engage.videoapuntes.upv.es:8080/' });
//proxy.web(req, res, { target: 'https://opencast-dev.uni-koeln.de/' });
}
]
]
},
livereload: true
});
});
gulp.task('paella-opencast:server', ['paella-opencast:server:run', 'paella-opencast:server:watch']);
gulp.task('default', ['paella-opencast:build']);