Class: Lolcommits::GitInfo
- Inherits:
-
Object
- Object
- Lolcommits::GitInfo
- Includes:
- Methadone::CLILogging
- Defined in:
- lib/lolcommits/git_info.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
Returns the value of attribute message.
-
#repo ⇒ Object
Returns the value of attribute repo.
-
#repo_internal_path ⇒ Object
Returns the value of attribute repo_internal_path.
-
#sha ⇒ Object
Returns the value of attribute sha.
Instance Method Summary collapse
-
#initialize ⇒ GitInfo
constructor
A new instance of GitInfo.
Constructor Details
#initialize ⇒ GitInfo
Returns a new instance of GitInfo.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/lolcommits/git_info.rb', line 6 def initialize debug "GitInfo: attempting to read local repository" g = Git.open('.') debug "GitInfo: reading commits logs" commit = g.log.first debug "GitInfo: most recent commit is '#{commit}'" self. = commit..split("\n").first self.sha = commit.sha[0..10] self.repo_internal_path = g.repo.path regex = /.*[:\/](\w*).git/ match = g.remote.url.match regex if g.remote.url self.repo = match[1] if match debug "GitInfo: parsed the following values from commit:" debug "GitInfo: \t#{self.}" debug "GitInfo: \t#{self.sha}" debug "GitInfo: \t#{self.repo_internal_path}" debug "GitInfo: \t#{self.repo}" end |
Instance Attribute Details
#message ⇒ Object
Returns the value of attribute message.
4 5 6 |
# File 'lib/lolcommits/git_info.rb', line 4 def @message end |
#repo ⇒ Object
Returns the value of attribute repo.
4 5 6 |
# File 'lib/lolcommits/git_info.rb', line 4 def repo @repo end |
#repo_internal_path ⇒ Object
Returns the value of attribute repo_internal_path.
4 5 6 |
# File 'lib/lolcommits/git_info.rb', line 4 def repo_internal_path @repo_internal_path end |
#sha ⇒ Object
Returns the value of attribute sha.
4 5 6 |
# File 'lib/lolcommits/git_info.rb', line 4 def sha @sha end |