Przeglądaj źródła

Merge pull request #15 from reidmv/bug/master/spaces

Cool, thanks!
Chris Price 11 lat temu
rodzic
commit
6d3e6a137a

+ 1 - 1
lib/puppet/util/ini_file.rb

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

+ 3 - 1
spec/unit/puppet/util/ini_file_spec.rb

@@ -26,6 +26,7 @@ foo= foovalue2
 baz=bazvalue
     #another comment
  ; yet another comment
+ zot = multi word value
       EOS
       template.split("\n")
     }
@@ -45,6 +46,7 @@ baz=bazvalue
       subject.get_value("section1", "bar").should == "barvalue"
       subject.get_value("section2", "foo").should == "foovalue2"
       subject.get_value("section2", "baz").should == "bazvalue"
+      subject.get_value("section2", "zot").should == "multi word value"
     end
 
   end
@@ -102,4 +104,4 @@ foo=foovalue
     end
 
   end
-end
+end