From a62ca65a2373643ccd0a92f6cfa79c774bed32bd Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Mon, 14 May 2018 13:21:14 -0300 Subject: [PATCH 1/2] Fix Docker Executable with optional Executable, PHP-CS-Fixer --- src/beautifiers/executable.coffee | 36 +++++++++++++++++++++-------- src/beautifiers/php-cs-fixer.coffee | 2 +- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/beautifiers/executable.coffee b/src/beautifiers/executable.coffee index a401860..f685bb3 100644 --- a/src/beautifiers/executable.coffee +++ b/src/beautifiers/executable.coffee @@ -49,6 +49,7 @@ class Executable .then(() => @) .catch((error) => if not @.required + @verbose("Not required") @ else Promise.reject(error) @@ -366,6 +367,7 @@ class HybridExecutable extends Executable constructor: (options) -> super(options) + @verbose("HybridExecutable Options", options) if options.docker? @dockerOptions = Object.assign({}, @dockerOptions, options.docker) @docker = @constructor.dockerExecutable() @@ -389,18 +391,32 @@ class HybridExecutable extends Executable super() .catch((error) => return Promise.reject(error) if not @docker? - @docker.init() - .then(=> @runImage(@versionArgs, @versionRunOptions)) - .then((text) => @saveVersion(text)) - .then(() => @installedWithDocker = true) - .then(=> @) - .catch((dockerError) => - @debug(dockerError) - Promise.reject(error) - ) + return @ + ) + .then(() => + shouldTryWithDocker = not @isInstalled and @docker? + @verbose("Executable shouldTryWithDocker", shouldTryWithDocker, @isInstalled, @docker?) + if shouldTryWithDocker + return @initDocker() + return @ + ) + + initDocker: () -> + @docker.init() + .then(=> @runImage(@versionArgs, @versionRunOptions)) + .then((text) => @saveVersion(text)) + .then(() => @installedWithDocker = true) + .then(=> @) + .catch((dockerError) => + @debug(dockerError) + Promise.reject(error) ) run: (args, options = {}) -> + @verbose("Running HybridExecutable") + @verbose("installedWithDocker", @installedWithDocker) + @verbose("docker", @docker) + @verbose("docker.isInstalled", @docker and @docker.isInstalled) if @installedWithDocker and @docker and @docker.isInstalled return @runImage(args, options) super(args, options) @@ -430,7 +446,7 @@ class HybridExecutable extends Executable image, newArgs ], - options + Object.assign({}, options, { cmd: undefined }) ) ) diff --git a/src/beautifiers/php-cs-fixer.coffee b/src/beautifiers/php-cs-fixer.coffee index fc77677..02fdc58 100644 --- a/src/beautifiers/php-cs-fixer.coffee +++ b/src/beautifiers/php-cs-fixer.coffee @@ -105,7 +105,7 @@ module.exports = class PHPCSFixer extends Beautifier isPhpScript = (finalPhpCsFixerPath.indexOf(".phar") isnt -1) or (finalPhpCsFixerPath.indexOf(".php") isnt -1) @verbose('isPhpScript', isPhpScript) - if finalPhpCsFixerPath and isPhpScript + if not phpCsFixer.isInstalled and finalPhpCsFixerPath and isPhpScript php.run([finalPhpCsFixerPath, phpCsFixerOptions, tempFile], runOptions) .then(=> @readFile(tempFile) From efabda3b39b148e76226f6ad6e9c9b47607cc227 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Mon, 14 May 2018 13:32:35 -0300 Subject: [PATCH 2/2] Update CHANGELOG for v0.32.3 --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78cd99e..2db50ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Next + +# v0.32.3 (2018-05-14) - Issue [#448](https://github.com/Glavin001/atom-beautify/issues/448) Add support for Laravel Blade templates (beta) +- Fix Docker Executable with optional Executable, PHP-CS-Fixer ([#2129](https://github.com/Glavin001/atom-beautify/pull/2129)) # v0.32.2 (2018-03-10) - Revert fix package.json repository field (#2062)