Class: Gitit::GitConfig
- Inherits:
-
Object
- Object
- Gitit::GitConfig
- Includes:
- GitExecutor
- Defined in:
- lib/gitit/git_config.rb
Overview
Instance Attribute Summary
Attributes included from GitExecutor
Instance Method Summary collapse
-
#get_value(key) ⇒ Object
————————————————————————-.
-
#initialize(repo, location: '') ⇒ Object
constructor
————————————————————————-.
-
#remove_section(section) ⇒ Object
————————————————————————-.
-
#set_value(key, value) ⇒ Object
————————————————————————-.
-
#unset_value(key) ⇒ Object
————————————————————————-.
Methods included from GitExecutor
Constructor Details
#initialize(repo, location: '') ⇒ Object
14 15 16 17 |
# File 'lib/gitit/git_config.rb', line 14 def initialize(repo, location: '') @repo = repo @location = location end |
Instance Method Details
#get_value(key) ⇒ Object
21 22 23 24 25 |
# 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) ⇒ Object
44 45 46 47 |
# 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) ⇒ Object
30 31 32 33 34 |
# 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) ⇒ Object
38 39 40 41 |
# 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 |