Class: Kaisoku::Commands::RunCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/kaisoku/commands/run_command.rb

Instance Method Summary collapse

Constructor Details

#initialize(paths, options) ⇒ RunCommand

Returns a new instance of RunCommand.



6
7
8
9
10
# File 'lib/kaisoku/commands/run_command.rb', line 6

def initialize(paths, options)
  @paths = paths
  @options = options
  @context = RuntimeContext.new(options)
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/kaisoku/commands/run_command.rb', line 12

def call
  all_entities = @context.adapter.discover
  selection = build_run_selection(@paths, all_entities)
  @context.test_map.clear! if selection.invalidate_map
  entities = Prioritizer.new.order(selection.entities)
  reporter.selection(selection, selected_count: entities.length, total_count: all_entities.length)
  return 0 if entities.empty?

  results = execute_entities(entities)
  reporter.results(results)
  results.values.any? { |result| result[:status] == 'failed' } ? 1 : 0
end