From fb5fd2cd08134de8fc9ff22830344fe101502f4a Mon Sep 17 00:00:00 2001 From: ColinFrick Date: Wed, 20 Feb 2019 21:20:17 +0100 Subject: [PATCH 1/2] fix(build): parse string permission to octal Closes #502 --- tasks/build/assets.js | 2 +- tasks/build/css.js | 4 ++-- tasks/build/javascript.js | 6 +++--- tasks/config/project/config.js | 2 ++ 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tasks/build/assets.js b/tasks/build/assets.js index 698d1f4adc..bfb0cf2862 100644 --- a/tasks/build/assets.js +++ b/tasks/build/assets.js @@ -21,7 +21,7 @@ var function build(src, config) { return gulp.src(src, {base: config.paths.source.themes}) - .pipe(gulpif(config.hasPermission, chmod(config.permission))) + .pipe(gulpif(config.hasPermissions, chmod(config.parsedPermissions))) .pipe(gulp.dest(config.paths.output.themes)) .pipe(print(log.created)) ; diff --git a/tasks/build/css.js b/tasks/build/css.js index 79afffc640..a34c9a9627 100644 --- a/tasks/build/css.js +++ b/tasks/build/css.js @@ -77,7 +77,7 @@ function build(src, type, compress, config, opts) { compress ? config.paths.assets.compressed : config.paths.assets.uncompressed)) .pipe(gulpif(compress, minifyCSS(settings.minify))) .pipe(gulpif(fileExtension, rename(fileExtension))) - .pipe(gulpif(config.hasPermission, chmod(config.permission))) + .pipe(gulpif(config.hasPermissions, chmod(config.parsedPermissions))) .pipe(gulp.dest(compress ? config.paths.output.compressed : config.paths.output.uncompressed)) .pipe(print(log.created)) ; @@ -104,7 +104,7 @@ function pack(type, compress) { .pipe(dedupe()) .pipe(replace(assets.uncompressed, assets.packaged)) .pipe(concatCSS(concatenatedCSS, settings.concatCSS)) - .pipe(gulpif(config.hasPermission, chmod(config.permission))) + .pipe(gulpif(config.hasPermissions, chmod(config.parsedPermissions))) .pipe(gulpif(compress, minifyCSS(settings.concatMinify))) .pipe(header(banner, settings.header)) .pipe(gulp.dest(output.packaged)) diff --git a/tasks/build/javascript.js b/tasks/build/javascript.js index 3d521d3e21..3c970100bf 100644 --- a/tasks/build/javascript.js +++ b/tasks/build/javascript.js @@ -51,14 +51,14 @@ function build(src, type, config) { .pipe(plumber()) .pipe(flatten()) .pipe(replace(comments.license.in, comments.license.out)) + .pipe(gulpif(config.hasPermissions, chmod(config.parsedPermissions))) .pipe(gulp.dest(config.paths.output.uncompressed)) - .pipe(gulpif(config.hasPermission, chmod(config.permission))) .pipe(print(log.created)) .pipe(uglify(settings.uglify)) .pipe(rename(settings.rename.minJS)) .pipe(header(banner, settings.header)) + .pipe(gulpif(config.hasPermissions, chmod(config.parsedPermissions))) .pipe(gulp.dest(config.paths.output.compressed)) - .pipe(gulpif(config.hasPermission, chmod(config.permission))) .pipe(print(log.created)) ; } @@ -79,7 +79,7 @@ function pack(type, compress) { .pipe(concat(concatenatedJS)) .pipe(gulpif(compress, uglify(settings.concatUglify))) .pipe(header(banner, settings.header)) - .pipe(gulpif(config.hasPermission, chmod(config.permission))) + .pipe(gulpif(config.hasPermissions, chmod(config.parsedPermissions))) .pipe(gulp.dest(output.packaged)) .pipe(print(log.created)) ; diff --git a/tasks/config/project/config.js b/tasks/config/project/config.js index e71a9e5ba6..b36fe579f3 100644 --- a/tasks/config/project/config.js +++ b/tasks/config/project/config.js @@ -103,11 +103,13 @@ module.exports = { if(config.permission) { config.hasPermissions = true; + config.parsedPermissions = typeof config.permission === 'string' ? parseInt(config.permission, 8) : config.permission; } else { // pass blank object to avoid causing errors config.permission = {}; config.hasPermissions = false; + config.parsedPermissions = false; } /*-------------- From 35fbb6e279f27ef28d37a93926a4e5a2b0aae4f5 Mon Sep 17 00:00:00 2001 From: ColinFrick Date: Wed, 20 Feb 2019 21:41:26 +0100 Subject: [PATCH 2/2] fix(build): set parsedPermission to empty object instead of false --- tasks/config/project/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/config/project/config.js b/tasks/config/project/config.js index b36fe579f3..49e1f18fad 100644 --- a/tasks/config/project/config.js +++ b/tasks/config/project/config.js @@ -109,7 +109,7 @@ module.exports = { // pass blank object to avoid causing errors config.permission = {}; config.hasPermissions = false; - config.parsedPermissions = false; + config.parsedPermissions = {}; } /*--------------