Class: Herodotus::Git

Inherits:
Object
  • Object
show all
Defined in:
lib/herodotus/git.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_path = nil) ⇒ Git

Returns a new instance of Git.



4
5
6
7
# File 'lib/herodotus/git.rb', line 4

def initialize(base_path = nil)
  @base_path = base_path || Configuration.config.base_path
  @repo     = Grit::Repo.new(guess_repo)
end

Instance Attribute Details

#base_pathObject

Returns the value of attribute base_path.



3
4
5
# File 'lib/herodotus/git.rb', line 3

def base_path
  @base_path
end

#repoObject

Returns the value of attribute repo.



3
4
5
# File 'lib/herodotus/git.rb', line 3

def repo
  @repo
end

Instance Method Details

#commits(since_ref = nil) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/herodotus/git.rb', line 9

def commits(since_ref = nil)
  if since_ref
    output = repo.git.rev_list({'pretty' => 'raw'}, "#{since_ref}..")
    Grit::Commit.list_from_string(repo, output)
  else
    Grit::Commit.find_all(@repo, since_ref)
  end
end