]> gitweb.fluxo.info Git - puppet-inifile.git/commitdiff
final commit for 0.0.1 release
authorChris Price <chris@pupppetlabs.com>
Fri, 17 Aug 2012 02:30:58 +0000 (19:30 -0700)
committerChris Price <chris@pupppetlabs.com>
Fri, 17 Aug 2012 04:50:20 +0000 (21:50 -0700)
* Updated README
* Fixed a small bug that would be triggered if the file specified
  by `path` didn't exist.
* Added a smoke test manifest

README.markdown [new file with mode: 0644]
README.md [deleted file]
lib/puppet/util/ini_file.rb
spec/unit/puppet/util/ini_file_spec.rb
tests/ini_setting.pp [new file with mode: 0644]

diff --git a/README.markdown b/README.markdown
new file mode 100644 (file)
index 0000000..3e6532e
--- /dev/null
@@ -0,0 +1,22 @@
+# INI-file module #
+
+This module provides resource types for use in managing INI-style configuration
+files.  The main resource type is `ini_setting`, which is used to manage an
+individual setting in an INI file.  Here's an example usage:
+
+    ini_setting { "sample setting":
+      path    => '/tmp/foo.ini',
+      section => 'foo',
+      setting => 'foosetting',
+      value   => 'FOO!',
+      ensure  => present,
+    }
+
+A few noteworthy features:
+
+ * The module tries *hard* not to manipulate your file any more than it needs to.
+   In most cases, it should leave the original whitespace, comments, ordering,
+   etc. perfectly intact.
+ * Supports comments starting with either '#' or ';'.
+ * Will add missing sections if they don't exist.
+
diff --git a/README.md b/README.md
deleted file mode 100644 (file)
index 2c44dca..0000000
--- a/README.md
+++ /dev/null
@@ -1,2 +0,0 @@
-puppetlabs-inifile
-==================
\ No newline at end of file
index b951b3f723990af84e9249c628fa777fa2effa52..9fd08ad460546ffe44965e1babd7bc27e49b1db9 100644 (file)
@@ -12,7 +12,9 @@ module Util
       @path = path
       @section_names = []
       @sections_hash = {}
-      parse_file
+      if File.file?(@path)
+        parse_file
+      end
     end
 
     def section_names
index 7e7458ae4f1095d280e2960c8a5e1eb9ee36a453..f2c6e204ae064bb1f52148c51ab4bb982dd76c30 100644 (file)
@@ -23,6 +23,7 @@ baz=bazvalue
     }
 
     before :each do
+      File.should_receive(:file?).with("/my/ini/file/path") { true }
       described_class.should_receive(:readlines).once.with("/my/ini/file/path") do
         sample_content
       end
diff --git a/tests/ini_setting.pp b/tests/ini_setting.pp
new file mode 100644 (file)
index 0000000..598bedf
--- /dev/null
@@ -0,0 +1,16 @@
+ini_setting { "sample setting":
+  path    => '/tmp/foo.ini',
+  section => 'foo',
+  setting => 'foosetting',
+  value   => 'FOO!',
+  ensure  => present,
+}
+
+ini_setting { "sample setting2":
+  path    => '/tmp/foo.ini',
+  section => 'bar',
+  setting => 'barsetting',
+  value   => 'BAR!',
+  ensure  => present,
+  require => Ini_setting["sample setting"],
+}