class Rfix::Collector
Constants
Public Instance Methods
each(&block)
click to toggle source
# File lib/rfix/collector.rb, line 31 def each(&block) construct = lambda do |path, statuses| File.call(basename: path, status: statuses, repository: repository) end statuses = Hash.new(EMPTY_ARRAY).tap do |statuses| repository.status do |path, status| statuses[path] = status end end if repository.head_unborn? statuses.each do |path, status| (block << construct).call(path, status) end else origin.diff_workdir(**OPTIONS.dup).tap do |diff| diff.find_similar!( renames_from_rewrites: true, renames: true, copies: true ) end.each_delta do |delta| delta.new_file.fetch(:path).then do |file_path| (block << construct).call(file_path, statuses[file_path] + [delta.status]) end end end end
Private Instance Methods
origin()
click to toggle source
# File lib/rfix/collector.rb, line 63 def origin repository.lookup(repository.rev_parse(reference).oid) rescue Rugged::Error, Rugged::InvalidError, Rugged::ReferenceError raise Error, "Reference #{reference.inspect} not found" end