Skip to content

Commit

Permalink
new functionality : easy create file
Browse files Browse the repository at this point in the history
  • Loading branch information
gs committed Mar 8, 2013
1 parent 77d0d82 commit aa5ac96
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Default (Linux).sublime-keymap
Expand Up @@ -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
]
3 changes: 2 additions & 1 deletion Default (OSX).sublime-keymap
Expand Up @@ -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
]
3 changes: 2 additions & 1 deletion Default (Windows).sublime-keymap
Expand Up @@ -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
]
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -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)
Expand Down
15 changes: 15 additions & 0 deletions run_ruby_test.py
Expand Up @@ -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 = {}
Expand Down

0 comments on commit aa5ac96

Please sign in to comment.