cprice-puppet/puppetlabs-inifile — pull request #19 by cprice-puppet (2012-10-22 18:05:19+00:00)
Title: Feature/master/use existing indentation

commit f0d443fed02d870965613dd174793cc1816137a2
Author: Chris Price
Date: Sat Oct 20 23:14:39 2012 -0700

Refactor to clarify implementation of `save`

The `save` method was previously relying on some really
specific implementation details of the `section` class
(when the start/end_line would be nil, etc.). This made
the code a bit hard to follow.

This commit introduces a few utility methods in the
`section` class (`is_new_section?`, `is_global?`), and
refactors the `save` method to use them... this makes
the logic a little easier to follow and should hopefully
make it easier to maintain.

commit e517148f4a2ab309aeb8413095791b021574b417
Author: Chris Price
Date: Sat Oct 20 22:16:36 2012 -0700

Add example for `ensure=absent`

commit 845fa707be7132e753f291901dd7e4d4dc48c405
Author: Chris Price
Date: Sat Oct 20 00:24:37 2012 -0700

Better handling of whitespace lines at ends of sections

This is another bit of cosmetic functionality; prior to
this commit, when adding a new setting to a section, we'd
write it on the very last line before the next section,
even if there was a chunk of trailing whitespace lines
at the end of the existing section. This was functional,
but the output was not always particularly pleasant for
human consumption.

This commit tweaks things so that we insert new settings
just before the final chunk of whitespace lines in an
existing section. This keeps things a bit cleaner.

commit c2c26de9b10c3675e1044d5571e47e195a5d0167
Author: Chris Price
Date: Sat Oct 20 00:08:06 2012 -0700

Respect indentation / spacing for existing sections and settings

This commit adds some cosmetic functionality. The main two
improvements are:

* We'll now pay attention to indentation within existing
sections, and when we write new settings or update
existing ones, we'll match the existing indentation.

* When modifying existing settings, the regex now captures
a greater portion of the original line and preserves it.
Basically, the original whitespacing in the line should
remain intact and only the value should be modified.