Module: Retest::Watcher

Defined in:
lib/retest/watcher.rb

Defined Under Namespace

Modules: Default, Watchexec

Class Method Summary collapse

Class Method Details

.for(watcher) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/retest/watcher.rb', line 5

def self.for(watcher)
  tool = case watcher.to_s
    when 'listen'        then Default
    when 'watchexec'     then Watchexec
    when '', 'installed' then installed
    else                 raise ArgumentError, "Unknown #{watcher}"
    end

  unless tool.installed?
    raise ArgumentError, "#{watcher} not installed on machine"
  end

  tool
end

.installedObject



20
21
22
# File 'lib/retest/watcher.rb', line 20

def self.installed
  [Watchexec, Default].find(&:installed?)
end