Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
Add ability to customize command-line arguments passed to Ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
zenbro committed Jan 18, 2018
1 parent 7bbd68b commit 40ae194
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ Your Config in Atom menu):
# ruby path. run `which ruby` to find the path.
'rubyExecutablePath': null

# arguments passed to ruby.
# add -Ku if you experience problems with utf-8 encoding on macOS.
'rubyExecutableArgs': '-c -w --external-encoding=utf-8 --internal-encoding=utf-8 -Ku'

# ignored extensions, ERB and markdown files by default.
'ignoredExtensions': 'erb, md'
```
11 changes: 4 additions & 7 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export default {
atom.config.observe('linter-ruby.rubyExecutablePath', (value) => {
this.executablePath = value;
}),
atom.config.observe('linter-ruby.rubyExecutableArgs', (value) => {
this.executableArgs = value;
}),
atom.config.observe('linter-ruby.ignoredExtensions', (value) => {
this.ignoredExtensions = value;
}),
Expand Down Expand Up @@ -44,13 +47,7 @@ export default {
return [];
}

const execArgs = [
'-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 execArgs = this.executableArgs.split(/\s+/);
const execOpts = {
stdin: fileText,
stream: 'stderr',
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
"type": "string",
"default": "ruby"
},
"rubyExecutableArgs": {
"title": "Arguments passed to Ruby",
"type": "string",
"default": "-c -w --external-encoding=utf-8 --internal-encoding=utf-8"
},
"ignoredExtensions": {
"type": "array",
"default": [
Expand Down

0 comments on commit 40ae194

Please sign in to comment.