Class: LearnTest::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/learn_test/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repo, options = {}) ⇒ Runner

Returns a new instance of Runner.



7
8
9
10
11
# File 'lib/learn_test/runner.rb', line 7

def initialize(repo, options = {})
  @repo = repo
  @options = options
  die if !strategy
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/learn_test/runner.rb', line 5

def options
  @options
end

#repoObject (readonly)

Returns the value of attribute repo.



5
6
7
# File 'lib/learn_test/runner.rb', line 5

def repo
  @repo
end

Instance Method Details

#filesObject



26
27
28
# File 'lib/learn_test/runner.rb', line 26

def files
  @files ||= Dir.entries('.')
end

#keep_results?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/learn_test/runner.rb', line 30

def keep_results?
  @keep_results ||= options[:keep] || !!options.delete('--keep')
end

#runObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/learn_test/runner.rb', line 13

def run
  strategy.check_dependencies
  strategy.configure
  strategy.run
  if options[:debug]
    report_and_clean
  else
    Process.detach(Process.fork do
      report_and_clean
    end)
  end
end

#strategyObject



34
35
36
# File 'lib/learn_test/runner.rb', line 34

def strategy
  @strategy ||= strategies.map{ |s| s.new(self) }.detect(&:detect)
end