123456789_123456789_123456789_123456789_123456789_

Class: RSpec::Core::Bisect::Coordinator Private

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: rspec-core/lib/rspec/core/bisect/coordinator.rb

Overview

The main entry point into the bisect logic. Coordinates among:

- Bisect::ShellCommand: Generates shell commands to run spec subsets
- Bisect::ExampleMinimizer: Contains the core bisect logic.
- A bisect runner: runs a set of examples and returns the results.
- A bisect formatter: provides progress updates to the user.

Class Method Summary

Instance Method Summary

Class Method Details

.bisect_with(spec_runner, original_cli_args, formatter)

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/bisect/coordinator.rb', line 16

def self.bisect_with(spec_runner, original_cli_args, formatter)
  new(spec_runner, original_cli_args, formatter).bisect
end

Instance Method Details

#bisect

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/bisect/coordinator.rb', line 26

def bisect
  repro = start_bisect_runner do |runner|
    minimizer = ExampleMinimizer.new(@shell_command, runner, @notifier)

    gracefully_abort_on_sigint(minimizer)
    minimizer.find_minimal_repro
    minimizer.repro_command_for_currently_needed_ids
  end

  @notifier.publish(:bisect_repro_command, :repro => repro)

  true
rescue BisectFailedError => e
  @notifier.publish(:bisect_failed, :failure_explanation => e.message)
  false
ensure
  @notifier.publish(:close)
end

#gracefully_abort_on_sigint(minimizer) (private)

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/bisect/coordinator.rb', line 52

def gracefully_abort_on_sigint(minimizer)
  trap('INT') do
    repro = minimizer.repro_command_for_currently_needed_ids
    @notifier.publish(:bisect_aborted, :repro => repro)
    exit(1)
  end
end

#start_bisect_runner(&block) (private)

[ GitHub ]

  
# File 'rspec-core/lib/rspec/core/bisect/coordinator.rb', line 47

def start_bisect_runner(&block)
  klass = @spec_runner.configuration.bisect_runner_class
  klass.start(@shell_command, @spec_runner, &block)
end