final commit for 0.0.1 release
* Updated README * Fixed a small bug that would be triggered if the file specified by `path` didn't exist. * Added a smoke test manifest
This commit is contained in:
parent
bf06644b4a
commit
4f0e7264e3
5 changed files with 42 additions and 3 deletions
22
README.markdown
Normal file
22
README.markdown
Normal file
|
@ -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.
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
puppetlabs-inifile
|
||||
==================
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
16
tests/ini_setting.pp
Normal file
16
tests/ini_setting.pp
Normal file
|
@ -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"],
|
||||
}
|
Loading…
Reference in a new issue