Commit f0e2c35b2095f257321e7e6fc67e3faafb7023ed

Authored by Arthur Bikmullin
1 parent 9a8ab1f3

Added dist task

Showing 2 changed files with 64 additions and 9 deletions
  1 +var VERSION = '1.0.0-rc';
1 2 var ENVIRONMENT = 'release';
2 3
3 4 var gulp = require('gulp');
... ... @@ -6,7 +7,8 @@ var walk = require('walk').walk;
6 7 var exec = require('child_process').execFile;
7 8 var path = require('path');
8 9 var wrench = require('wrench');
9   -var merge = require('merge-stream');;
  10 +var merge = require('merge-stream');
  11 +var zip = require('gulp-zip');
10 12
11 13 var config = require('./buildconfig');
12 14 var environment = config.environment[ENVIRONMENT];
... ... @@ -303,6 +305,58 @@ gulp.task('templates', function(callback) {
303 305 });
304 306 });
305 307
  308 +gulp.task('dist', ['default'], function() {
  309 + var dest = './.output/build-' + process.platform;
  310 +
  311 + if (fs.existsSync(dest)) {
  312 + wrench.rmdirSyncRecursive(dest);
  313 + }
  314 +
  315 + wrench.copyDirSyncRecursive(
  316 + '.',
  317 + dest,
  318 + {
  319 + forceDelete: false,
  320 + whitelist: true,
  321 + filter: function(file) {
  322 + var found;
  323 +
  324 + if (file === 'gulpfile.js' || file === 'package.json' || file === 'bower.json' || file === 'settings.ini') {
  325 + return false;
  326 + } else if (file === 'node_modules' || file === 'bower_components') {
  327 + return false;
  328 + } else if (file.indexOf('.') === 0 || file.indexOf('.build') > 0) {
  329 + return false;
  330 + } else if (file.indexOf('buildconfig') === 0 || file.indexOf('config.develop') === 0) {
  331 + return false;
  332 + } else if ((file.indexOf('mserver') === 0 || file.indexOf('jentos') === 0) && file.match(/.+\.(pro\.user|user)/)) {
  333 + return false;
  334 + } else if (file === 'less' || file.match(/.+\.less/i)) {
  335 + return false;
  336 + } else if (found = file.match(/mojo\.(.+)\.(js|as|cpp|cs|java)/i)) {
  337 + if (found[1] !== 'html5' && found[1] !== 'html5.webgl' && found[1] !== 'glfw') {
  338 + return false;
  339 + }
  340 + } else if (found = file.match(/asyncimageloader\.(js|as|cpp|cs|java)/i)) {
  341 + if (found[1] !== 'js') {
  342 + return false;
  343 + }
  344 + } else if (found = file.match(/asyncsoundloader\.(js|as|cpp|cs|java)/i)) {
  345 + if (found[1] !== 'js') {
  346 + return false;
  347 + }
  348 + }
  349 +
  350 + return true
  351 + }
  352 + }
  353 + );
  354 +
  355 + return gulp.src(dest + '/**/*')
  356 + .pipe(zip('mungo-' + 'v' + VERSION + '-' + process.platform + '.zip'))
  357 + .pipe(gulp.dest('./.output'));
  358 +});
  359 +
306 360 gulp.task('transcc', buildMonkeyProject('transcc', 'transcc_' + host));
307 361 gulp.task('makedocs', environment.options.build === 'clean' ? ['transcc'] : [], buildMonkeyProject('makedocs', 'makedocs_' + host));
308 362 gulp.task('mungo', environment.options.build === 'clean' ? ['transcc'] : [], buildMonkeyProject('mungo', '../mungo', 'Desktop_Game'));
... ...
1 1 {
2   - "name": "mungo-impress",
3   - "version": "1.0.0",
4   - "devDependencies": {
5   - "gulp": "~3.8.1",
6   - "merge-stream": "~0.1.1",
7   - "wrench": "~1.5.8",
8   - "walk": "~2.3.3"
9   - }
  2 + "name": "mungo-impress",
  3 + "version": "1.0.0",
  4 + "devDependencies": {
  5 + "gulp": "~3.8.1",
  6 + "merge-stream": "~0.1.1",
  7 + "wrench": "~1.5.8",
  8 + "walk": "~2.3.3",
  9 + "gulp-zip": "~0.4.0"
  10 + }
10 11 }
... ...