-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from Sawrz/master
- Loading branch information
Showing
1 changed file
with
22 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,31 @@ | ||
from SublimeLinter.lint import RubyLinter | ||
from SublimeLinter.lint import Linter | ||
|
||
|
||
class RubyLinter(Linter): | ||
def context_sensitive_executable_path(self, cmd): | ||
# The default implementation will look for a user defined `executable` | ||
# setting. | ||
success, executable = super().context_sensitive_executable_path(cmd) | ||
if success: | ||
return True, executable | ||
|
||
gem_name = cmd[0] if isinstance(cmd, list) else cmd | ||
|
||
if self.settings.get('use_bundle_exec', False): | ||
return True, ['bundle', 'exec', gem_name] | ||
|
||
rvm = self.which('rvm-auto-ruby') | ||
if rvm: | ||
return True, [rvm, '-S', gem_name] | ||
|
||
return False, None | ||
|
||
|
||
class Mdl(RubyLinter): | ||
executable = 'mdl' | ||
cmd = ['mdl', '${temp_file}'] | ||
regex = r'^.+?:(?P<line>\d+): (?P<warning>(?P<message>[^`]*))' | ||
line_col_base = (1, 1) | ||
tempfile_suffix = 'md' | ||
defaults = { | ||
'selector': 'text.html.markdown' | ||
} | ||
|
||
def cmd(self): | ||
"""Support bundle-exec.""" | ||
|
||
if self.get_view_settings().get('bundle-exec', False): | ||
return ('bundle', 'exec', self.executable) | ||
return (self.executable_path) |