class Pronto::PatchChangeset

Quacks like Undercover::Changeset but wraps Pronto::Patches to provide full compatibility with pronto's git diff options

Constants

T_ZERO

Public Class Methods

new(patches) click to toggle source
# File lib/pronto/patch_changeset.rb, line 9
def initialize(patches)
  @patches = patches
end

Public Instance Methods

each_changed_line() { |delta.new_file, new_lineno| ... } click to toggle source
# File lib/pronto/patch_changeset.rb, line 30
def each_changed_line
  @patches.each do |patch|
    patch.added_lines.each do |line|
      yield patch.delta.new_file[:path].to_s, line.new_lineno
    end
  end
end
file_paths() click to toggle source
# File lib/pronto/patch_changeset.rb, line 26
def file_paths
  @patches.map(&:new_file_full_path)
end
last_modified() click to toggle source
# File lib/pronto/patch_changeset.rb, line 17
def last_modified
  mod = file_paths.map do |f|
    next T_ZERO unless File.exist?(f)

    File.mtime(f)
  end.max
  mod || T_ZERO
end
update() click to toggle source
# File lib/pronto/patch_changeset.rb, line 13
def update
  self # no-op for this class
end
validate(lcov_report_path) click to toggle source
# File lib/pronto/patch_changeset.rb, line 38
def validate(lcov_report_path)
  return :no_changes if file_paths.empty?
  return :stale_coverage if last_modified > File.mtime(lcov_report_path)
end