Class: Hashira::CI::Ratchet
- Inherits:
-
Object
- Object
- Hashira::CI::Ratchet
- Defined in:
- lib/hashira/ci/ratchet.rb
Instance Method Summary collapse
- #check ⇒ Object
-
#initialize(graph, findings, baseline_path, io: $stdout) ⇒ Ratchet
constructor
A new instance of Ratchet.
- #update ⇒ Object
Constructor Details
#initialize(graph, findings, baseline_path, io: $stdout) ⇒ Ratchet
Returns a new instance of Ratchet.
4 5 6 7 8 9 |
# File 'lib/hashira/ci/ratchet.rb', line 4 def initialize(graph, findings, baseline_path, io: $stdout) @graph = graph @findings = findings @baseline = Hashira::CI::Baseline.load(baseline_path) @io = io end |
Instance Method Details
#check ⇒ Object
17 18 19 20 21 |
# File 'lib/hashira/ci/ratchet.rb', line 17 def check raise(Hashira::Error, "no baseline at #{@baseline.path} — run --update-baseline first") unless @baseline.exist? vet Hashira::CI::RatchetReport.new(@graph, @findings, io: @io).print(drift, delta) end |
#update ⇒ Object
11 12 13 14 15 |
# File 'lib/hashira/ci/ratchet.rb', line 11 def update @baseline.write(edges, digests, packaging:) @io.puts("Baseline updated: #{edges.size} edges, #{digests.size} findings.") 0 end |