Class: Madrox::Repo

Inherits:
Object
  • Object
show all
Defined in:
lib/madrox/repo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Repo

Returns a new instance of Repo.



8
9
10
11
# File 'lib/madrox/repo.rb', line 8

def initialize(path)
  @grit = Grit::Repo.new(path)
rescue Grit::NoSuchPathError, Grit::InvalidGitRepositoryError
end

Instance Attribute Details

#gritObject (readonly)

Gets the Grit object for this Madrox::Repo.

Returns a Grit::Repo instance.



6
7
8
# File 'lib/madrox/repo.rb', line 6

def grit
  @grit
end

Instance Method Details

#exist?Boolean

Public: Determines whether this Madrox repo has an available Git repo.

Returns true if the Git repo exists, or false.

Returns:

  • (Boolean)


17
18
19
# File 'lib/madrox/repo.rb', line 17

def exist?
  @grit && @grit.git.exists?
end

#timeline(user, email = nil) ⇒ Object

Gets a Madrox::Timeline for the given user.

user - String user name for the timeline. email - Optional string email address for commit messages.

Returns a Madrox::Timeline.



27
28
29
# File 'lib/madrox/repo.rb', line 27

def timeline(user, email = nil)
  Madrox::Timeline.new(self, user, email)
end