diff --git a/README.md b/README.md index c927aa0..ae99384 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,11 @@ Your Config in Atom menu): # ruby path. run `which ruby` to find the path. 'rubyExecutablePath': null + # additional arguments arguments passed to ruby. + # default: -c -w --external-encoding=utf-8 --internal-encoding=utf-8 + # add -Ku if you experience problems with utf-8 encoding on macOS. + 'rubyAdditionalArgs': '-Ku' + # ignored extensions, ERB and markdown files by default. 'ignoredExtensions': 'erb, md' ``` diff --git a/lib/main.js b/lib/main.js index f55fa13..b6a2856 100644 --- a/lib/main.js +++ b/lib/main.js @@ -14,6 +14,9 @@ export default { atom.config.observe('linter-ruby.rubyExecutablePath', (value) => { this.executablePath = value; }), + atom.config.observe('linter-ruby.rubyAdditionalArgs', (value) => { + this.additionalArgs = value; + }), atom.config.observe('linter-ruby.ignoredExtensions', (value) => { this.ignoredExtensions = value; }), @@ -44,13 +47,16 @@ export default { return []; } - const execArgs = [ + const defaultExecArgs = [ '-c', // Check syntax only, no execution '-w', // Turns on warnings // Set the encoding to UTF-8 '--external-encoding=utf-8', '--internal-encoding=utf-8', ]; + const additionalArgs = this.additionalArgs.split(/\s+/); + + const execArgs = defaultExecArgs.concat(additionalArgs); const execOpts = { stdin: fileText, stream: 'stderr', diff --git a/package.json b/package.json index 101690f..a559d71 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,12 @@ "type": "string", "default": "ruby" }, + "rubyAdditionalArgs": { + "title": "Additional arguments passed to Ruby", + "description": "Default arguments: `-c -w --external-encoding=utf-8 --internal-encoding=utf-8`", + "type": "string", + "default": "" + }, "ignoredExtensions": { "type": "array", "default": [