-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
62 lines (46 loc) · 2.16 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
var NwBuilder = require('node-webkit-builder');
var gulp = require('gulp');
var gutil = require('gulp-util');
var zip = require('gulp-zip');
var platforms = [];
// Which platforms should we build
if (process.argv.indexOf('--win32') > -1) platforms.push('win32');
if (process.argv.indexOf('--win64') > -1) platforms.push('win64');
if (process.argv.indexOf('--osx32') > -1) platforms.push('osx32');
if (process.argv.indexOf('--osx64') > -1) platforms.push('osx64');
if (process.argv.indexOf('--linux32') > -1) platforms.push('linux32');
if (process.argv.indexOf('--linux64') > -1) platforms.push('linux64');
// Build for All platforms
if (process.argv.indexOf('--all') > -1 || platforms.length===0) platforms = [ 'win32', 'win64', 'osx32', 'osx64', 'linux32', 'linux64' ];
gutil.log("Building Tyle for: "+platforms.join(", "));
// Read package.json
var package = require('./package.json');
gulp.task('nw', function () {
// Find out which modules to include
var modules = Object.keys(package.dependencies).map(function(m) { return './node_modules/'+m+'/**/*'; });
var nw = new NwBuilder({
version: '0.12.2', // override version so it stops trying to download the latest
files: [ './css/**/*', './html/**/*', './img/**/*', './js/**/*', './views/**/*', './index.html', './package.json'].concat(modules),
platforms: platforms,
buildDir: './build',
cacheDir: './build/cache',
//winIco: './img/tile.png'
});
// Log stuff you want
nw.on('log', function (msg) {
gutil.log('node-webkit-builder', msg);
});
// Build returns a promise, return it so the task isn't called in parallel
return nw.build().catch(function (err) {
gutil.log('node-webkit-builder', err);
});
});
platforms.forEach(function(platform){
gulp.task('copyTest_'+platform, ['nw'], function(){
return gulp.src(['./test/**/*.xml']).pipe(gulp.dest('./build/tyle/'+platform+'/test'));
});
gulp.task('zip_'+platform, ['copyTest_'+platform], function () {
return gulp.src('./build/tyle/'+platform+'/**/*').pipe(zip('tyle-explorer-'+platform+'.zip')).pipe(gulp.dest('./build/tyle'));
});
});
gulp.task('default', platforms.map(function(p){return "zip_"+p;}));