Class: Jeweler::JewelerGit

Inherits:
Object
  • Object
show all
Defined in:
lib/jeweler_rails/jeweler_git.rb

Constant Summary collapse

@@git_conf =
lambda do 
  output = {}
  filepath = File.expand_path( "~/.gitconfig", __FILE__)
  return output unless FileTest.exists?( filepath )
  File.open( filepath, "r" ) do |f|
    header_key = nil
    while line = f.gets 
      if line =~ /^\[\w+\]$/x
        header_key = line[/\w+/]
        output[header_key] = {}
      elsif line =~ /^.+=.+$/x
        item = line.split("=")
        key = item[0].strip
        val = item[1].strip
        output[header_key][key] = val
      end # if header line
    end # while
  end # File.open
  return output
end.call

Class Method Summary collapse

Class Method Details

.configurationObject

git_conf



25
26
27
# File 'lib/jeweler_rails/jeweler_git.rb', line 25

def self.configuration
  @@git_conf
end

.github_userObject

self.user_email



37
38
39
# File 'lib/jeweler_rails/jeweler_git.rb', line 37

def self.github_user
  @@git_conf["github"]["user"]
end

.user_emailObject

self.user_name



33
34
35
# File 'lib/jeweler_rails/jeweler_git.rb', line 33

def self.user_email
  @@git_conf["user"]["email"]
end

.user_nameObject

self.configuration



29
30
31
# File 'lib/jeweler_rails/jeweler_git.rb', line 29

def self.user_name
  @@git_conf["user"]["name"]
end