class Lapidarist::FindFailure

Attributes

attempt[R]
gems[R]
git[R]
last_good_sha[R]
test[R]

Public Class Methods

new(gems:, attempt:, last_good_sha:) click to toggle source
# File lib/lapidarist/find_failure.rb, line 3
def initialize(gems:, attempt:, last_good_sha:)
  @gems = gems
  @attempt = attempt
  @last_good_sha = last_good_sha
  @git = GitCommand.new
  @test = TestCommand.new
end

Public Instance Methods

run() click to toggle source
# File lib/lapidarist/find_failure.rb, line 11
def run
  Lapidarist.logger.header('Investigating failure')

  updated_but_failed_gem =
    if gems.one?
      git.reset_hard('HEAD^')
      gems.first
    else
      failed_gem_name = git.bisect(last_good_sha, test)
      gems.detect { |gem| gem.name == failed_gem_name }
    end

  Gem.from(
    updated_but_failed_gem,
    attempt: attempt,
    status: :failed,
    updated_version: updated_but_failed_gem.latest_attempt.version
  )
end