class Rfix::Diff

Constants

OPTIONS

Public Instance Methods

deltas() click to toggle source
# File lib/rfix/diff.rb, line 34
def deltas
  diff.deltas.reject(&:deleted?)
end
files() click to toggle source
# File lib/rfix/diff.rb, line 38
def files
  deltas.map(&:new_file).map do |file|
    repository.path.join(file.fetch(:path))
  end
end

Private Instance Methods

absolute_path() click to toggle source
# File lib/rfix/diff.rb, line 53
def absolute_path
  repository.path.join(current_path)
end
diff() click to toggle source
# File lib/rfix/diff.rb, line 46
def diff
  origin.diff(index, **extended_options).tap do |diff|
    diff.merge!(index.diff(**extended_options))
    diff.find_similar!(all: true, ignore_whitespace: true)
  end
end
extended_options() click to toggle source
# File lib/rfix/diff.rb, line 57
def extended_options
  unless absolute_path.exist?
    raise Error, "#{current_path} path does not exist in #{repository.path}"
  end

  unless absolute_path.directory?
    raise Error, "#{current_path} is not a directory"
  end

  OPTIONS.merge(paths: [current_path.join("**/*").to_s], **options)
end