Class: Gitit::Config
- Inherits:
-
Object
- Object
- Gitit::Config
- Includes:
- CommandExecutor
- Defined in:
- lib/gitit/command_config.rb
Overview
Instance Attribute Summary
Attributes included from CommandExecutor
Instance Method Summary collapse
-
#get_value(key) ⇒ Object
————————————————————————- ————————————————————————-.
-
#initialize(repo, location = '') ⇒ Config
constructor
————————————————————————- ————————————————————————-.
-
#remove_section(section) ⇒ Object
————————————————————————- ————————————————————————-.
-
#set_value(key, value) ⇒ Object
————————————————————————- ————————————————————————-.
-
#unset_value(key) ⇒ Object
————————————————————————- ————————————————————————-.
Methods included from CommandExecutor
Constructor Details
#initialize(repo, location = '') ⇒ Config
12 13 14 15 |
# File 'lib/gitit/command_config.rb', line 12 def initialize(repo, location='') @repo = repo @location = location end |
Instance Method Details
#get_value(key) ⇒ Object
19 20 21 22 23 |
# File 'lib/gitit/command_config.rb', line 19 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
42 43 44 45 |
# File 'lib/gitit/command_config.rb', line 42 def remove_section(section) execute_command("config #{@location} --remove-section #{section}") raise 'failure running command' if $?.exitstatus != 0 end |
#set_value(key, value) ⇒ Object
27 28 29 30 31 |
# File 'lib/gitit/command_config.rb', line 27 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
35 36 37 38 |
# File 'lib/gitit/command_config.rb', line 35 def unset_value(key) execute_command("config #{@location} --null --unset #{key}") raise 'failure running command' if $?.exitstatus != 0 end |