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

Commit 40ae194

Browse files
committed
Add ability to customize command-line arguments passed to Ruby
1 parent 7bbd68b commit 40ae194

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ Your Config in Atom menu):
2121
# ruby path. run `which ruby` to find the path.
2222
'rubyExecutablePath': null
2323

24+
# arguments passed to ruby.
25+
# add -Ku if you experience problems with utf-8 encoding on macOS.
26+
'rubyExecutableArgs': '-c -w --external-encoding=utf-8 --internal-encoding=utf-8 -Ku'
27+
2428
# ignored extensions, ERB and markdown files by default.
2529
'ignoredExtensions': 'erb, md'
2630
```

lib/main.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ export default {
1414
atom.config.observe('linter-ruby.rubyExecutablePath', (value) => {
1515
this.executablePath = value;
1616
}),
17+
atom.config.observe('linter-ruby.rubyExecutableArgs', (value) => {
18+
this.executableArgs = value;
19+
}),
1720
atom.config.observe('linter-ruby.ignoredExtensions', (value) => {
1821
this.ignoredExtensions = value;
1922
}),
@@ -44,13 +47,7 @@ export default {
4447
return [];
4548
}
4649

47-
const execArgs = [
48-
'-c', // Check syntax only, no execution
49-
'-w', // Turns on warnings
50-
// Set the encoding to UTF-8
51-
'--external-encoding=utf-8',
52-
'--internal-encoding=utf-8',
53-
];
50+
const execArgs = this.executableArgs.split(/\s+/);
5451
const execOpts = {
5552
stdin: fileText,
5653
stream: 'stderr',

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
"type": "string",
1818
"default": "ruby"
1919
},
20+
"rubyExecutableArgs": {
21+
"title": "Arguments passed to Ruby",
22+
"type": "string",
23+
"default": "-c -w --external-encoding=utf-8 --internal-encoding=utf-8"
24+
},
2025
"ignoredExtensions": {
2126
"type": "array",
2227
"default": [

0 commit comments

Comments
 (0)