fix issue where single characters settings were not being saved.

see https://github.com/boxen/puppet-git/issues/30
This commit is contained in:
Huan Do 2014-09-08 23:12:09 -07:00
parent 8aeddc8a8c
commit 681f5c0cb4
2 changed files with 3 additions and 1 deletions

View file

@ -6,7 +6,7 @@ module Util
class IniFile
@@SECTION_REGEX = /^\s*\[([^\]]*)\]\s*$/
@@SETTING_REGEX = /^(\s*)([^\[#;][\w\d\.\\\/\-\s\[\]\']*[\w\d\.\\\/\-\]])([ \t]*=[ \t]*)([\S\s]*?)\s*$/
@@SETTING_REGEX = /^(\s*)([\w\d\.\\\/\-\s\[\]\']*[\w\d\.\\\/\-\]])([ \t]*=[ \t]*)([\S\s]*?)\s*$/
@@COMMENTED_SETTING_REGEX = /^(\s*)[#;]+(\s*)([^\[]*[\w\d\.\\\/\-]+[\w\d\.\\\/\-\[\]\']+)([ \t]*=[ \t]*)([\S\s]*?)\s*$/
def initialize(path, key_val_separator = ' = ')

View file

@ -30,6 +30,7 @@ baz=bazvalue
; yet another comment
zot = multi word value
xyzzy['thing1']['thing2']=xyzzyvalue
l=git log
EOS
template.split("\n")
}
@ -52,6 +53,7 @@ baz=bazvalue
subject.get_value("section2", "baz").should == "bazvalue"
subject.get_value("section2", "zot").should == "multi word value"
subject.get_value("section2", "xyzzy['thing1']['thing2']").should == "xyzzyvalue"
subject.get_value("section2", "l").should == "git log"
end
end