Class: Lapidarist::BisectStep

Inherits:
Object
  • Object
show all
Defined in:
lib/lapidarist/git_command.rb

Instance Method Summary collapse

Constructor Details

#initialize(line, shell) ⇒ BisectStep

Returns a new instance of BisectStep.



94
95
96
97
# File 'lib/lapidarist/git_command.rb', line 94

def initialize(line, shell)
  @line = line
  @shell = shell
end

Instance Method Details

#failing_gem(sha) ⇒ Object



114
115
116
117
118
119
120
121
# File 'lib/lapidarist/git_command.rb', line 114

def failing_gem(sha)
  commit_message = shell.run("git log --format=%s -n 1 #{sha}", label: 'git log')[0]

  sha_regex = Regexp::new('Update (.*) from').match(commit_message)
  unless sha_regex.nil?
    sha_regex[1]
  end
end

#failing_shaObject



107
108
109
110
111
112
# File 'lib/lapidarist/git_command.rb', line 107

def failing_sha
  sha_regex = Regexp::new("(.*) is the first bad commit\n").match(line)
  unless sha_regex.nil?
    sha_regex[1]
  end
end

#failure?Boolean

Returns:

  • (Boolean)


103
104
105
# File 'lib/lapidarist/git_command.rb', line 103

def failure?
  !failing_sha.nil?
end

#success?Boolean

Returns:

  • (Boolean)


99
100
101
# File 'lib/lapidarist/git_command.rb', line 99

def success?
  line == "bisect run success\n"
end