Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f973c09
Showing
5 changed files
with
121 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
[ | ||
{ | ||
"caption": "Preferences", | ||
"mnemonic": "n", | ||
"id": "preferences", | ||
"children": | ||
[ | ||
{ | ||
"caption": "Package Settings", | ||
"mnemonic": "P", | ||
"id": "package-settings", | ||
"children": | ||
[ | ||
{ | ||
"caption": "RubyCheckOnSave", | ||
"children": | ||
[ | ||
{ | ||
"command": "open_file", | ||
"args": {"file": "${packages}/RubyCheckOnSave/README.md"}, | ||
"caption": "README" | ||
}, | ||
{ | ||
"command": "open_file", | ||
"args": {"file": "${packages}/RubyCheckOnSave/changelog.txt"}, | ||
"caption": "Change Log" | ||
}, | ||
{ "caption": "-" }, | ||
{ | ||
"command": "open_file", | ||
"args": {"file": "${packages}/RubyCheckOnSave/RubyCheckOnSave.sublime-settings"}, | ||
"caption": "Settings – Default" | ||
}, | ||
{ | ||
"command": "open_file", | ||
"args": {"file": "${packages}/User/RubyCheckOnSave.sublime-settings"}, | ||
"caption": "Settings – User" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] |
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
RubyCheckOnSave Sublime Text 2 Plugin | ||
=========++========================== | ||
|
||
This simple plugin checks the syntax of ruby files when they're saved. | ||
|
||
Installation | ||
------------ | ||
|
||
**Without Git:** Download the latest source from [GitHub](https://github.com/edgar/RubyCheckOnSave) and copy the RubyCheckOnSave folder to your Sublime Text 2 "Packages" directory. | ||
|
||
**With Git:** Clone the repository in your Sublime Text 2 "Packages" directory: | ||
|
||
git clone git://github.com/edgar/RubyCheckOnSave.git | ||
|
||
|
||
The "Packages" directory is located at: | ||
|
||
* OS X: | ||
|
||
~/Library/Application Support/Sublime Text 2/Packages/ | ||
|
||
* Linux: | ||
|
||
~/.config/sublime-text-2/Packages/ | ||
|
||
* Windows: | ||
|
||
%APPDATA%/Sublime Text 2/Packages/ | ||
|
||
|
||
Configuration | ||
------------- | ||
|
||
There are a number of configuration options available to customize the behavior of RubyCheckOnSave. For the latest information on what options are available, select the menu item `Preferences->Package Settings->RubyCheckOnSave->Settings - Default`. | ||
|
||
Do **NOT** edit the default RubyCheckOnSave settings. Your changes will be lost when RubyCheckOnSave is updated. ALWAYS edit the user RubyCheckOnSave settings by selecting `Preferences->Package Settings->SublimeLinter->Settings - User`. | ||
|
||
If you are using rvm or rbenv, you will probably have to specify the full path to the ruby you are using in the `ruby_check_on_save_cmd` setting. | ||
|
||
### Per project | ||
|
||
SublimeLinter supports per-project settings. This is useful if you work with several projects that requires different ruby interpreters. To edit your project settings, select the menu item `Project->Edit Project`. If there is no `settings` object at the top level, add one and then add the `ruby_check_on_save_cmd` setting, like this: | ||
|
||
{ | ||
"folders": | ||
[ | ||
{ | ||
"path": "/Users/edgar/sandboxes/repo" | ||
} | ||
], | ||
"settings": | ||
{ | ||
"ruby_check_on_save_cmd": "/Users/edgar/.rvm/rubies/ruby-1.9.3-p194/bin/ruby" | ||
} | ||
} | ||
|
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import sublime, sublime_plugin | ||
|
||
class RubyCheckOnSave(sublime_plugin.EventListener): | ||
def on_post_save(self, view): | ||
if view.file_name()[-3:] == '.rb': | ||
view.window().run_command("ruby_check_on_save", {"saving": True}) | ||
|
||
class RubyCheckOnSaveCommand(sublime_plugin.TextCommand): | ||
def run(self, edit, saving=False): | ||
view = self.view | ||
global_settings = sublime.load_settings(__name__ + '.sublime-settings') | ||
cmd_setting = 'ruby_check_on_save_cmd' | ||
ruby = view.settings().get(cmd_setting, global_settings.get(cmd_setting)) | ||
view.window().run_command("exec", {"cmd": [ruby, "-cw", view.file_name()]}) |
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/* | ||
RubySyntaxCheck default settings | ||
*/ | ||
{ | ||
"ruby_check_on_save_cmd": "/usr/bin/ruby" | ||
} |