-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
74 lines (59 loc) · 2.22 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
var gulp = require('gulp');
var shell = require('gulp-shell');
var prompt = require("gulp-prompt");
var gulpif = require('gulp-if');
var minimist = require('minimist');
var path = require('path');
var headlessTemplate = 'gnustep-headless-debian-8-x64.json';
var guiTemplate = 'gnustep-gui-debian-8-x64.json';
var knownOptions = {
string: [ 'docker-hub-email' ],
boolean: [ 'parallel', 'noninteractive' ],
default: {
'docker-hub-email': process.env.DOCKER_HUB_EMAIL || '',
parallel: false,
noninteractive: false
}
};
var options = minimist(process.argv.slice(2), knownOptions);
var parallelOpt = '';
if (!options.parallel) {
parallelOpt = '-parallel=false'
}
var shellParameters = {
maxBuffer: (64 * 1024 * 1024),
templateData: {
parallelOpt: parallelOpt,
dockerHubEmail: options['docker-hub-email']
}
}
process.env.TMPDIR = path.join(process.cwd(), '.tmp');
gulp.task('docker_cfg', function() {
return gulp.src(headlessTemplate, {read: false})
.pipe(gulpif((!options.noninteractive && !process.env.DOCKER_HUB_PASSWORD),
prompt.prompt([{
type: 'password',
name: 'pass',
message: 'Please enter your docker hub password'
}], function (r) { process.env.DOCKER_HUB_PASSWORD = r.pass; })))
});
gulp.task('headless_dev', ['docker_cfg'], function() {
return gulp.src(headlessTemplate, { read: false })
.pipe(shell('packer build -force <%= parallelOpt %> -var \'docker_hub_email=<%= dockerHubEmail %>\' -var \'container_flavour=dev\' <%= file.path %>',
shellParameters
))
});
gulp.task('headless_docker_rt', ['headless_dev'], function() {
return gulp.src(headlessTemplate, { read: false })
.pipe(shell('packer build -force <%= parallelOpt %> -var \'docker_hub_email=<%= dockerHubEmail %>\' -var \'container_flavour=rt\' -only=docker <%= file.path %>',
shellParameters
))
});
gulp.task('headless', ['headless_docker_rt']);
gulp.task('gui', [ 'headless_dev' ], function() {
return gulp.src(guiTemplate, { read: false })
.pipe(shell('packer build <%= parallelOpt %> <%= file.path %>',
shellParameters
))
});
gulp.task('default', ['gui', 'headless']);