summaryrefslogtreecommitdiff
path: root/lib/puppet/util/ini_file
AgeCommit message (Collapse)Author
2013-03-04Add purging support to ini fileDan Bode
This commit adds purging to ini file native types. Purging will only work for child providers that implement the method: self.file_path. This is because collecting all instances of the type ( which is a requirement for purging) is only possible when the path of the file that is being managed can be accessed by the class instance (in the method self.instances.) This commit adds the following method to the internal of the ini_file: - get_settings - has of all settings/values for a given section It also adds the following method to the section class: - setting_names - list of all setting names in a section. These methods are required for the instances method to be able to list the values for all settings of each section.
2012-10-26Add detection for commented versions of settingsChris Price
This commit adds support for detecting commented versions of settings in an existing version of an inifile. If you are setting a value for a setting that isn't currently set in the file, but a commented version is found, then we add the new setting immediately following the commented version, rather than at the end of the section.
2012-10-20Refactor to clarify implementation of `save`Chris Price
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.
2012-10-20Respect indentation / spacing for existing sections and settingsChris Price
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.
2012-10-17Minor tweaks to handling of removing settingsChris Price
This commit makes some minor changes to how we handle removing settings. In particular, it updates all of the line numbers of the various 'section' objects to correspond to the new state of the world based on the removal of a line that appeared before them. Also adds one more test related to setting removal.
2012-10-10Add support for removing linesDan Bode
This commit adds the ability to ensure that lines are absent.
2012-07-28First (basic) working version of ini_setting providerChris Price