diff --git a/README.md b/README.md
index 721d956..eafa7dd 100644
--- a/README.md
+++ b/README.md
@@ -128,7 +128,7 @@ Some of the supported beautifiers are developed for Node.js and are automaticall
| puppet-lint | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):
1. Install [puppet-lint (`puppet-lint`)](http://puppet-lint.com/) with `docker pull unibeautify/puppet-lint`
:bookmark_tabs: Manually:
1. Install [puppet-lint (`puppet-lint`)](http://puppet-lint.com/) by following http://puppet-lint.com/
|
| pybeautifier | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/guyskk/pybeautifier and follow the instructions. |
| Remark | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
-| Rubocop | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/bbatsov/rubocop and follow the instructions. |
+| Rubocop | :warning: 1 executable | :x: No Docker support | :bookmark_tabs: Manually:
1. Install [Rubocop (`rubocop`)](http://rubocop.readthedocs.io/) by following http://rubocop.readthedocs.io/en/latest/installation/
|
| Ruby Beautify | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/erniebrodeur/ruby-beautify and follow the instructions. |
| rustfmt | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/rust-lang-nursery/rustfmt and follow the instructions. |
| SassConvert | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker](https://www.docker.com/):
1. Install [SassConvert (`sass-convert`)](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) with `docker pull unibeautify/sass-convert`
:bookmark_tabs: Manually:
1. Install [SassConvert (`sass-convert`)](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax) by following http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax
|
diff --git a/docs/options.md b/docs/options.md
index aea1173..5ceec35 100644
--- a/docs/options.md
+++ b/docs/options.md
@@ -402,6 +402,23 @@ Options for Rscript executable.
2. Go into *Packages* and search for "*Atom Beautify*" package.
3. Find the option "*Rscript*" and change it to your desired configuration.
+##### [Rubocop](#rubocop)
+
+**Important**: This option is only configurable from within Atom Beautify's setting panel.
+
+**Type**: `object`
+
+**Description**:
+
+Options for Rubocop executable.
+
+**How to Configure**
+
+1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to
+*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*.
+2. Go into *Packages* and search for "*Atom Beautify*" package.
+3. Find the option "*Rubocop*" and change it to your desired configuration.
+
##### [SassConvert](#sassconvert)
**Important**: This option is only configurable from within Atom Beautify's setting panel.
diff --git a/examples/nested-jsbeautifyrc/ruby/expected/test.rb b/examples/nested-jsbeautifyrc/ruby/expected/test.rb
index 68a8bfe..402ab8a 100644
--- a/examples/nested-jsbeautifyrc/ruby/expected/test.rb
+++ b/examples/nested-jsbeautifyrc/ruby/expected/test.rb
@@ -15,6 +15,6 @@ hash = { hosts: [
],
- logger: mylog, # This enables callback logging!
+ logger: mylog, # This enables callback logging!
max_reconnect_attempts: 5 }
diff --git a/examples/nested-jsbeautifyrc/ruby/original/_test.rb b/examples/nested-jsbeautifyrc/ruby/original/test.rb
similarity index 88%
rename from examples/nested-jsbeautifyrc/ruby/original/_test.rb
rename to examples/nested-jsbeautifyrc/ruby/original/test.rb
index f0b9442..b4d529e 100644
--- a/examples/nested-jsbeautifyrc/ruby/original/_test.rb
+++ b/examples/nested-jsbeautifyrc/ruby/original/test.rb
@@ -18,7 +18,7 @@ hash = { :hosts => [
],
- :logger => mylog, # This enables callback logging!
+ :logger => mylog, # This enables callback logging!
:max_reconnect_attempts => 5,
diff --git a/package.json b/package.json
index 58c380c..3271c63 100644
--- a/package.json
+++ b/package.json
@@ -483,4 +483,4 @@
"prettydiff2"
]
}
-}
+}
\ No newline at end of file
diff --git a/src/beautifiers/rubocop.coffee b/src/beautifiers/rubocop.coffee
index 138dfb5..b72f80d 100644
--- a/src/beautifiers/rubocop.coffee
+++ b/src/beautifiers/rubocop.coffee
@@ -17,10 +17,26 @@ module.exports = class Rubocop extends Beautifier
rubocop_path: true
}
+ executables: [
+ {
+ name: "Rubocop"
+ cmd: "rubocop"
+ homepage: "http://rubocop.readthedocs.io/"
+ installation: "http://rubocop.readthedocs.io/en/latest/installation/"
+ version: {
+ parse: (text) -> text.match(/(\d+\.\d+\.\d+)/)[1]
+ }
+ }
+ ]
+
beautify: (text, language, options, context) ->
fullPath = context.filePath or ""
[projectPath, _relativePath] = atom.project.relativizePath(fullPath)
+ # Deprecate options.rubocop_path
+ if options.rubocop_path
+ @deprecateOptionForExecutable("Rubocop", "Ruby - Rubocop Path (rubocop_path)", "Path")
+
# Find the rubocop path
@Promise.all([
@which(options.rubocop_path) if options.rubocop_path
@@ -48,14 +64,18 @@ module.exports = class Rubocop extends Beautifier
"--force-exclusion"
"--stdin", "atom-beautify.rb" # filename is required but not used
]
+ exeOptions = {
+ ignoreReturnCode: true,
+ cwd: projectPath if configFile?,
+ onStdin: (stdin) -> stdin.end text
+ }
rubocopArguments.push("--config", tempConfig) if tempConfig?
@debug("rubocop arguments", rubocopArguments)
- @run(rubocopPath, rubocopArguments, {
- ignoreReturnCode: true,
- cwd: projectPath,
- onStdin: (stdin) -> stdin.end text
- }).then((stdout) =>
+ (if options.rubocop_path then \
+ @run(rubocopPath, rubocopArguments, exeOptions) else \
+ @exe("rubocop").run(rubocopArguments, exeOptions)
+ ).then((stdout) =>
@debug("rubocop output", stdout)
# Rubocop output an error if stdout is empty
return text if stdout.length == 0
diff --git a/src/options.json b/src/options.json
index 9e1d59a..458cd8b 100644
--- a/src/options.json
+++ b/src/options.json
@@ -9278,6 +9278,22 @@
}
}
},
+ "rubocop": {
+ "key": "rubocop",
+ "title": "Rubocop",
+ "type": "object",
+ "collapsed": true,
+ "description": "Options for Rubocop executable.",
+ "properties": {
+ "path": {
+ "key": "path",
+ "title": "Binary/Script Path",
+ "type": "string",
+ "default": "",
+ "description": "Absolute path to the \"rubocop\" executable's binary/script."
+ }
+ }
+ },
"sass-convert": {
"key": "sass-convert",
"title": "SassConvert",