Merge pull request #2129 from Glavin001/bugfix/php-cs-fixer-docker
Fix Docker Executable with optional Executable, PHP-CS-Fixer
This commit is contained in:
commit
5eb7e6d0d6
|
@ -1,5 +1,8 @@
|
||||||
# Next
|
# Next
|
||||||
|
|
||||||
|
# v0.32.3 (2018-05-14)
|
||||||
- Issue [#448](https://github.com/Glavin001/atom-beautify/issues/448) Add support for Laravel Blade templates (beta)
|
- 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)
|
# v0.32.2 (2018-03-10)
|
||||||
- Revert fix package.json repository field (#2062)
|
- Revert fix package.json repository field (#2062)
|
||||||
|
|
|
@ -49,6 +49,7 @@ class Executable
|
||||||
.then(() => @)
|
.then(() => @)
|
||||||
.catch((error) =>
|
.catch((error) =>
|
||||||
if not @.required
|
if not @.required
|
||||||
|
@verbose("Not required")
|
||||||
@
|
@
|
||||||
else
|
else
|
||||||
Promise.reject(error)
|
Promise.reject(error)
|
||||||
|
@ -366,6 +367,7 @@ class HybridExecutable extends Executable
|
||||||
|
|
||||||
constructor: (options) ->
|
constructor: (options) ->
|
||||||
super(options)
|
super(options)
|
||||||
|
@verbose("HybridExecutable Options", options)
|
||||||
if options.docker?
|
if options.docker?
|
||||||
@dockerOptions = Object.assign({}, @dockerOptions, options.docker)
|
@dockerOptions = Object.assign({}, @dockerOptions, options.docker)
|
||||||
@docker = @constructor.dockerExecutable()
|
@docker = @constructor.dockerExecutable()
|
||||||
|
@ -389,6 +391,17 @@ class HybridExecutable extends Executable
|
||||||
super()
|
super()
|
||||||
.catch((error) =>
|
.catch((error) =>
|
||||||
return Promise.reject(error) if not @docker?
|
return Promise.reject(error) if not @docker?
|
||||||
|
return @
|
||||||
|
)
|
||||||
|
.then(() =>
|
||||||
|
shouldTryWithDocker = not @isInstalled and @docker?
|
||||||
|
@verbose("Executable shouldTryWithDocker", shouldTryWithDocker, @isInstalled, @docker?)
|
||||||
|
if shouldTryWithDocker
|
||||||
|
return @initDocker()
|
||||||
|
return @
|
||||||
|
)
|
||||||
|
|
||||||
|
initDocker: () ->
|
||||||
@docker.init()
|
@docker.init()
|
||||||
.then(=> @runImage(@versionArgs, @versionRunOptions))
|
.then(=> @runImage(@versionArgs, @versionRunOptions))
|
||||||
.then((text) => @saveVersion(text))
|
.then((text) => @saveVersion(text))
|
||||||
|
@ -398,9 +411,12 @@ class HybridExecutable extends Executable
|
||||||
@debug(dockerError)
|
@debug(dockerError)
|
||||||
Promise.reject(error)
|
Promise.reject(error)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
run: (args, options = {}) ->
|
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
|
if @installedWithDocker and @docker and @docker.isInstalled
|
||||||
return @runImage(args, options)
|
return @runImage(args, options)
|
||||||
super(args, options)
|
super(args, options)
|
||||||
|
@ -430,7 +446,7 @@ class HybridExecutable extends Executable
|
||||||
image,
|
image,
|
||||||
newArgs
|
newArgs
|
||||||
],
|
],
|
||||||
options
|
Object.assign({}, options, { cmd: undefined })
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ module.exports = class PHPCSFixer extends Beautifier
|
||||||
isPhpScript = (finalPhpCsFixerPath.indexOf(".phar") isnt -1) or (finalPhpCsFixerPath.indexOf(".php") isnt -1)
|
isPhpScript = (finalPhpCsFixerPath.indexOf(".phar") isnt -1) or (finalPhpCsFixerPath.indexOf(".php") isnt -1)
|
||||||
@verbose('isPhpScript', isPhpScript)
|
@verbose('isPhpScript', isPhpScript)
|
||||||
|
|
||||||
if finalPhpCsFixerPath and isPhpScript
|
if not phpCsFixer.isInstalled and finalPhpCsFixerPath and isPhpScript
|
||||||
php.run([finalPhpCsFixerPath, phpCsFixerOptions, tempFile], runOptions)
|
php.run([finalPhpCsFixerPath, phpCsFixerOptions, tempFile], runOptions)
|
||||||
.then(=>
|
.then(=>
|
||||||
@readFile(tempFile)
|
@readFile(tempFile)
|
||||||
|
|
Loading…
Reference in New Issue