def run(self):
    files = self._direct_match() or self._prioritize_by_path()

    if files:
      OpenFile(self.context.window(), files).run()
    elif self._fall_back_to_create_spec():
      CreateSpecFile(self.context).run()
    else:
      rspec_print("No files found, searched for {0}".format(self._file_base_name()))
Пример #2
0
    def run(self):
        files = self._direct_match() or self._prioritize_by_path()

        if files:
            OpenFile(self.context.window(), files).run()
        elif self._fall_back_to_create_spec():
            CreateSpecFile(self.context).run()
        else:
            rspec_print("No files found, searched for {0}".format(
                self._file_base_name()))
Пример #3
0
import sys, imp, os
from rspec.rspec_print import rspec_print

# Dependecy reloader
# The original idea is borrowed from
# https://github.com/wbond/sublime_package_control/blob/master/package_control/reloader.py

rspec_print('Reloading rspec modules')
CODE_DIRS = [
    'plugin_helpers',
    'rspec',
]
PYTHON_FILE_EXT = '.py'


def _reload(dir, file):
    (name, extension) = os.path.splitext(file)
    if not extension == PYTHON_FILE_EXT: return

    dirs = '.'.join(filter(None, os.path.split(dir)))
    module = sys.modules.get('.'.join([dirs, name]))
    if not module: return

    if 'on_module_reload' in module.__dict__:
        module.on_module_reload()
    imp.reload(module)


for _ in range(2):  # double reload required to update dependencies
    for directory in CODE_DIRS:
        for dir, _, files in os.walk(directory):
Пример #4
0
 def run(self, edit):
   rspec_print("Creating spec file")
   context = TaskContext(self, edit)
   CreateSpecFile(context).run()
Пример #5
0
 def run(self, edit):
   rspec_print("Switching between code and test")
   context = TaskContext(self, edit)
   SwitchBetweenCodeAndTest(context).run()
Пример #6
0
 def run(self, edit):
   rspec_print("Displaying output panel")
   context = TaskContext(self, edit)
   context.display_output_panel()
Пример #7
0
 def run(self, edit):
   rspec_print("Running last rspec command")
   context = TaskContext(self, edit)
   ExecuteSpec(context).last_run()
Пример #8
0
 def run(self, edit):
   rspec_print("Running rspec")
   context = TaskContext(self, edit, spec_target_is_file = True)
   ExecuteSpec(context).current()
Пример #9
0
 def run(self, edit):
   rspec_print("Running rspec")
   context = TaskContext(self, edit)
   ExecuteSpec(context).current()
Пример #10
0
 def run(self, edit):
   rspec_print("Creating sepc file")
   context = TaskContext(self, edit)
   CreateSpecFile(context).run()
Пример #11
0
 def run(self, edit):
   rspec_print("Switching between code and test")
   context = TaskContext(self, edit)
   SwitchBetweenCodeAndTest(context).run()
Пример #12
0
 def run(self, edit):
   rspec_print("Displaying output panel")
   context = TaskContext(self, edit)
   context.display_output_panel()
Пример #13
0
 def run(self, edit):
   rspec_print("Running last rspec command")
   context = TaskContext(self, edit)
   ExecuteSpec(context).last_run()
Пример #14
0
 def run(self, edit):
   rspec_print("Running rspec")
   context = TaskContext(self, edit, spec_target_is_file = True)
   ExecuteSpec(context).current()
Пример #15
0
 def run(self, edit):
   rspec_print("Running rspec")
   context = TaskContext(self, edit)
   ExecuteSpec(context).current()
Пример #16
0
import sys, imp, os
from rspec.rspec_print import rspec_print

# Dependecy reloader
# The original idea is borrowed from
# https://github.com/wbond/sublime_package_control/blob/master/package_control/reloader.py

rspec_print('Reloading rspec modules')
CODE_DIRS = [
  'plugin_helpers',
  'rspec',
]
PYTHON_FILE_EXT = '.py'

def _reload(dir, file):
  (name, extension) = os.path.splitext(file)
  if not extension == PYTHON_FILE_EXT: return

  dirs = '.'.join(filter(None, os.path.split(dir)))
  module = sys.modules.get('.'.join([dirs, name]))
  if not module: return

  if 'on_module_reload' in module.__dict__:
    module.on_module_reload()
  imp.reload(module)

for _ in range(2): # double reload required to update dependencies
  for directory in CODE_DIRS:
    for dir, _, files in os.walk(directory):
      for file in files:
        _reload(dir, file)