class Gitit::GitConfig



Public Class Methods

new(repo, location: '') click to toggle source

@param [Object] repo @param [Object] location @return [Object]

# File lib/gitit/git_config.rb, line 14
def initialize(repo, location: '')
  @repo = repo
  @location = location
end

Public Instance Methods

get_value(key) click to toggle source

@param [Object] key

# File lib/gitit/git_config.rb, line 21
def get_value(key)
  value = execute_command("config #{@location} --null --get #{key}")
  raise 'failure running command' if $?.exitstatus != 0
  value.slice!(0, value.length-1)
end
remove_section(section) click to toggle source

# File lib/gitit/git_config.rb, line 44
def remove_section(section)
  execute_command("config #{@location} --remove-section #{section}")
  raise 'failure running command' if $?.exitstatus != 0
end
set_value(key, value) click to toggle source

@param [Object] key @param [Object] value

# File lib/gitit/git_config.rb, line 30
def set_value(key, value)
  val = value
  execute_command("config #{@location} \"#{key}\" \"#{val}\"")
  raise 'failure running command' if $?.exitstatus != 0
end
unset_value(key) click to toggle source

@param [Object] key

# File lib/gitit/git_config.rb, line 38
def unset_value(key)
  execute_command("config #{@location} --null --unset #{key}")
  raise 'failure running command' if $?.exitstatus != 0
end