Permalink
Browse files

new functionality : easy create file

  • Loading branch information...
1 parent 77d0d82 commit aa5ac96f25f6e9217f0cf196396a0cf0d3522e22 @gs gs committed Mar 8, 2013
Showing with 23 additions and 4 deletions.
  1. +2 −1 Default (Linux).sublime-keymap
  2. +2 −1 Default (OSX).sublime-keymap
  3. +2 −1 Default (Windows).sublime-keymap
  4. +2 −1 README.md
  5. +15 −0 run_ruby_test.py
@@ -11,5 +11,6 @@
]}, // switch between code and test in single view
{ "keys": ["ctrl+shift+period"], "command": "switch_between_code_and_test", "args": {"split_view": true}, "context" : [
{ "key": "selector", "operator": "equal", "operand": "source.ruby", "match_all": true }
- ]} // switch between code and test in split view
+ ]}, // switch between code and test in split view
+ { "keys": ["ctrl+shift+c"], "command": "generate_file" } // create new file
]
@@ -7,5 +7,6 @@
{ "keys": ["alt+shift+v"], "command": "verify_ruby_file" }, // verify ruby syntax
{ "keys": ["super+period"], "command": "switch_between_code_and_test", "args": {"split_view": false} }, // switch between code and test in single mode
- { "keys": ["super+ctrl+period"], "command": "switch_between_code_and_test", "args": {"split_view": true} } // switch between code and test in split view
+ { "keys": ["super+ctrl+period"], "command": "switch_between_code_and_test", "args": {"split_view": true} }, // switch between code and test in split view
+ { "keys": ["super+shift+c"], "command": "generate_file" } // create new file
]
@@ -11,5 +11,6 @@
]}, // switch between code and test in single view
{ "keys": ["ctrl+shift+period"], "command": "switch_between_code_and_test", "args": {"split_view": true}, "context" : [
{ "key": "selector", "operator": "equal", "operand": "source.ruby", "match_all": true }
- ]} // switch between code and test in split view
+ ]}, // switch between code and test in split view
+ { "keys": ["ctrl+shift+c"], "command": "generate_file" } // create new file
]
View
@@ -46,9 +46,10 @@ Usage
- Run last ruby test(s): `Command-Shift-E`
- Show test panel: `Command-Shift-X` (when test panel visible hit `esc` to hide it)
- Check RB, ERB file syntax: `Alt-Shift-V`
- - Switching between code and test:
+ - Switching between code and test (create a file if not found):
- Single View: `Command-.`
- Split View: `Command-Ctrl-.`
+ - Easy file creation: `Command-Shift-C`
Keys:
'Command' (OSX)
'Ctrl' (Linux / Windows)
View
@@ -376,6 +376,21 @@ def generate(self, selection, name):
finally:
self.view.end_edit(edit)
+class GenerateFile(BaseRubyTask):
+ def run(self, args):
+ GenerateNewFile(self.window()).doIt()
+
+class GenerateNewFile(GenerateTestFile):
+ def __init__(self, window):
+ self.window = window
+ self.split_view = False
+
+ def is_valid_path(self, path):
+ return not re.search('\.\w+', path)
+
+ def suggest_file_name(self, path):
+ return ""
+
class GenerateTestFile:
relative_paths = []
full_torelative_paths = {}

0 comments on commit aa5ac96

Please sign in to comment.