module Pronto

Constants

Comment
Status

Public Class Methods

default_commit() click to toggle source
# File lib/pronto.rb, line 76
def self.default_commit
  Config.new.default_commit
end
run(commit = nil, repo_path = '.', formatters = [Formatter::TextFormatter.new], file = nil) click to toggle source
# File lib/pronto.rb, line 58
def self.run(commit = nil, repo_path = '.',
             formatters = [Formatter::TextFormatter.new], file = nil)
  commit ||= default_commit

  repo = Git::Repository.new(repo_path)
  options = { paths: [file] } if file
  patches = repo.diff(commit, options)

  result = Runners.new.run(patches)

  Array(formatters).each do |formatter|
    formatted = formatter.format(result, repo, patches)
    puts formatted if formatted
  end

  result
end