class MyPrecious::GitInfoExtractor
Tool for getting information about the Git repository associated with a directory
Constants
- URL_PATTERN
Attributes
dir[R]
Public Class Methods
new(dir)
click to toggle source
Calls superclass method
# File lib/myprecious.rb, line 190 def initialize(dir) super() @dir = dir end
Public Instance Methods
git_info()
click to toggle source
# File lib/myprecious.rb, line 196 def git_info @git_info ||= Git.open(self.dir) end
origin_remote()
click to toggle source
# File lib/myprecious.rb, line 200 def origin_remote git_info.remotes.find {|r| r.name == 'origin'} end
repo_name()
click to toggle source
# File lib/myprecious.rb, line 204 def repo_name @repo_name ||= (URL_PATTERN =~ origin_remote.url) && $1 end