Class: Codeowners::Git

Inherits:
Object
  • Object
show all
Defined in:
lib/codeowners/git.rb,
lib/codeowners/git/contributor.rb,
lib/codeowners/git/contributors.rb

Defined Under Namespace

Classes: Contributor, Contributors

Instance Method Summary collapse

Constructor Details

#initialize(base_directory) ⇒ Git

Returns a new instance of Git.



8
9
10
# File 'lib/codeowners/git.rb', line 8

def initialize(base_directory)
  @base_directory = Pathname.new(::File.expand_path(base_directory))
end

Instance Method Details

#contributors(file, debug = false) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/codeowners/git.rb', line 12

def contributors(file, debug = false)
  require "codeowners/git/contributors"
  output = git(["log", "--numstat", %(--pretty=format:"author:%aN email:%ae"), "--no-color", "--", escape(file)])
  print_debug(output, debug)

  Contributors.call(file, output)
end