Module: Spectator

Extended by:
Spectator
Included in:
Spectator
Defined in:
lib/spectator.rb,
lib/spectator/ui.rb,
lib/spectator/version.rb,
lib/spectator/spec_runner.rb,
lib/spectator/path_watcher.rb,
lib/spectator/specs_matcher.rb,
lib/spectator/success_notifier.rb

Defined Under Namespace

Classes: PathWatcher, Runner, SpecRunner, SpecsMatcher, SuccessNotifier, UI

Constant Summary collapse

Config =
Class.new(OpenStruct)
VERSION =
'1.4.1'

Instance Method Summary collapse

Instance Method Details

#config(overrides_hash = {}) ⇒ Object



15
16
17
# File 'lib/spectator.rb', line 15

def config(overrides_hash = {})
  Config.new(default_config_hash.merge(env_config_hash).merge(overrides_hash))
end

#default_config_hashObject



28
29
30
31
32
33
34
35
# File 'lib/spectator.rb', line 28

def default_config_hash
  {
    rspec_command:   (File.exist?('.rspec') ? 'rspec' : 'spec'),
    spec_dir_regexp: 'spec',
    base_dir_regexp: 'app|lib|script',
    debug:           false,
  }
end

#env_config_hashObject



19
20
21
22
23
24
25
26
# File 'lib/spectator.rb', line 19

def env_config_hash
  config = {}
  config[:rspec_command]   = ENV['RSPEC_COMMAND']   if ENV['RSPEC_COMMAND']
  config[:spec_dir_regexp] = ENV['SPEC_DIR_REGEXP'] if ENV['SPEC_DIR_REGEXP']
  config[:base_dir_regexp] = ENV['BASE_DIR_REGEXP'] if ENV['BASE_DIR_REGEXP']
  config[:debug]           = ENV['SPECTATOR_DEBUG'] if ENV['SPECTATOR_DEBUG']
  config
end

#run(*args, &block) ⇒ Object



97
98
99
# File 'lib/spectator.rb', line 97

def run(*args, &block)
  Runner.new(*args, &block).run
end