From dfaaffcff431485ce956764c638d6e5080c0dd3e Mon Sep 17 00:00:00 2001 From: "Fedor A. Fetisov" Date: Sun, 12 Nov 2017 02:20:45 +0300 Subject: [PATCH] Add new gulp tasks New tasks intends to automate the process of release uploading to CDN --- src/gulpfile.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/gulpfile.js b/src/gulpfile.js index 617ebd2c..b7efd49c 100644 --- a/src/gulpfile.js +++ b/src/gulpfile.js @@ -43,6 +43,7 @@ var config = { i18nPath: 'i18n', i18nPrefix: 'mibew-i18n-', releasePath: 'release', + uploadPath: 'upload', compiledTemplatesHeader: fs.readFileSync('tools/compiled_templates_header.txt'), getComposerUrl: 'https://getcomposer.org/installer', phpBin: 'php -d "suhosin.executor.include.whitelist = phar" -d "memory_limit=512M"', @@ -377,6 +378,25 @@ gulp.task('pack-i18n', function(callback) { }); +gulp.task('prepare-for-upload', function(callback) { + gulp.src(config.releasePath + '/mibew-' + config.package.version + '.*') + .pipe(gulp.dest(config.uploadPath + '/core/' + config.package.version + '/')); + + gulp.src(config.releasePath + '/mibew-i18n-translation-' + config.package.version + '-*.pot') + .pipe(gulp.dest(config.uploadPath + '/i18n/_pot/' + config.package.version + '/')); + + return getChildDirs(config.i18nPath + '/translations') + .then(function (dirs) { + return Promise.all(dirs.map(function (dir) { + return new Promise(function(resolve, reject) { + gulp.src(config.releasePath + '/mibew-i18n-' + dir + '-' + config.package.version + '-*.*') + .pipe(gulp.dest(config.uploadPath + '/i18n/' + dir + '/' + config.package.version + '/')) + .on('error', reject) + .on('end', resolve); + }); + })); + }); +}); gulp.task('clean-tmp-po', function() { return del([config.releasePath + '/translation.po']); @@ -390,6 +410,15 @@ gulp.task('clean-tmp-i18n-files', function() { ]); }); +gulp.task('clean-upload', function(callback) { + return del([config.uploadPath], callback); +}); + +gulp.task('clean-all', function(callback) { + runSequence( ['clean', 'clean-upload'], + callback ); +}); + gulp.task('prepare-i18n-release', function(callback) { runSequence( 'clean-tmp-po', 'generate-pos', @@ -489,6 +518,16 @@ gulp.task('prepare-release', function(callback) { ); }); +gulp.task('prepare-all', function(callback) { + runSequence( + 'clean-all', + 'prepare-release', + 'prepare-i18n-release', + 'prepare-for-upload', + callback + ); +}); + // Prepares ready to use development version of Mibew without packing or // validating it. gulp.task('rebuild', function(callback) {