Skip to content

Commit

Permalink
Fixes #1732. Improve deprecation message for old options for new Exec…
Browse files Browse the repository at this point in the history
…utables
  • Loading branch information
Glavin001 committed Jul 1, 2017
1 parent c87e3c3 commit 49982c6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/beautifiers/beautifier.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ module.exports = class Beautifier
deprecate: (warning) ->
atom.notifications?.addWarning(warning)

deprecateOptionForExecutable: (exeName, oldOption, newOption) ->
deprecationMessage = "The \"#{oldOption}\" configuration option has been deprecated. Please switch to using the option in section \"Executables\" (near the top) in subsection \"#{exeName}\" labelled \"#{newOption}\" in Atom-Beautify package settings."
@deprecate(deprecationMessage)

###
Create temporary file
###
Expand Down
2 changes: 1 addition & 1 deletion src/beautifiers/fortran-beautifier/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = class FortranBeautifier extends Beautifier
]

if emacs_path
@deprecate("The \"emacs_path\" has been deprecated. Please switch to using the config with path \"Executables - Emacs - Path\" in Atom-Beautify package settings now.")
@deprecateOptionForExecutable("Emacs", "emacs_path", "Path")
@run(emacs_path, args, {ignoreReturnCode: false})
.then(=>
@readFile(tempFile)
Expand Down
3 changes: 1 addition & 2 deletions src/beautifiers/php-cs-fixer.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ module.exports = class PHPCSFixer extends Beautifier

# Find php-cs-fixer.phar script
if options.cs_fixer_path
deprecationMessage = "The \"PHP - PHP-CS-Fixer Path (cs_fixer_path)\" configuration option has been deprecated. Please switch to using the option named \"Executables - PHP-CS-Fixer - Path\" in Atom-Beautify package settings now."
@deprecate(deprecationMessage)
@deprecateOptionForExecutable("PHP - PHP-CS-Fixer Path (cs_fixer_path)", "PHP-CS-Fixer", "Path")

This comment has been minimized.

Copy link
@Glavin001

Glavin001 Jul 14, 2017

Author Owner

The order is wrong!


@Promise.all([
@which(options.cs_fixer_path) if options.cs_fixer_path
Expand Down
3 changes: 1 addition & 2 deletions src/beautifiers/phpcbf.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ module.exports = class PHPCBF extends Beautifier
phpcbf = @exe('phpcbf')

if options.phpcbf_path
deprecationMessage = "The \"PHP - PHPCBF Path (phpcbf_path)\" configuration option has been deprecated. Please switch to using the option named \"Executables - PHPCBF - Path\" in Atom-Beautify package settings now."
@deprecate(deprecationMessage)
@deprecateOptionForExecutable("PHP - PHPCBF Path (phpcbf_path)", "PHPCBF", "Path")

This comment has been minimized.

Copy link
@Glavin001

Glavin001 Jul 14, 2017

Author Owner

The order is wrong!


# Find phpcbf.phar script
@Promise.all([
Expand Down

0 comments on commit 49982c6

Please sign in to comment.