Class: Cyrun::TaskRunner

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/cyrun/task_runner.rb

Constant Summary collapse

CURRENT_SPEC_REGEX =
/^\s*Running:\s+(\S+)\s+\([0-9]+ of [0-9]+\)\s*$/.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logging

#error, #info

Constructor Details

#initialize(screenshots_pattern) ⇒ TaskRunner

Returns a new instance of TaskRunner.



16
17
18
# File 'lib/cyrun/task_runner.rb', line 16

def initialize(screenshots_pattern)
  @screenshots_pattern = screenshots_pattern
end

Instance Attribute Details

#screenshots_patternObject (readonly)

Returns the value of attribute screenshots_pattern.



14
15
16
# File 'lib/cyrun/task_runner.rb', line 14

def screenshots_pattern
  @screenshots_pattern
end

Instance Method Details

#run(group) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/cyrun/task_runner.rb', line 20

def run(group)
  temp_directory = create_directory
  command = build_command(group, temp_directory)

  info "Command: #{command.join " "}"

  execution_time = Cyrun::Timing.run do
    execute_command command
  end

  results = ResultDirectory.new(temp_directory, screenshots_pattern, group)
  SpecGroupExecutionResult.new(
    results.read_result_files,
    results.screenshots,
    execution_time
  )
end