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- 2.6.0
- 2.5.0
- 2.4.1
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.0
- 2.1.1
- 2.0.2
- 2.0.1
- 2.0.0
- 1.2.1
- 1.2.0
- 1.1.1
- 1.1.0
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.6.3
- 0.6.2
- 0.6.1
- 0.6.0
- 0.5.1
- 0.5.0
- 0.4.4
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.1
- 0.3.0
- 0.2.10
- 0.2.9
- 0.2.8
- 0.2.7
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.1.2
- 0.1.1
- 0.1.0
- 0.0.1
Provides line editing resources for use by recipes
cookbook 'line', '= 2.3.0', :supermarket
knife supermarket install line
knife supermarket download line
line cookbook
Motivation
Quite often, the need arises to do line editing instead of managing an entire file with a template resource. This cookbook supplies various resources that will help you do this.
Limitations
- The line resources processes the entire target file in memory. Trying to edit large files may fail.
- The end of line processing was only tested using
\n
and\r\n
. Using other line endings very well may not work. - The end of line string used needs to match the actual end of line used in the file
\n
and\r\n
are used as the defaults but if they don't match the actual end of line used in the file the results will be weird. - Adding a line implies there is a separator on the previous line. Adding a line differs from appending characters.
- Lines to be added should not contain EOL characters. The providers do not do multiline regex checks.
-
Missing file processing is the way it is by intention
-
add_to_list
do nothing, list not found so there is nothing to add to. -
append_if_no_line
create file, add the line. -
delete_from_list
do nothing, the list was not found which implies there is nothing to delete -
delete_lines
do nothing, the line isn't there which implies there is nothing to delete -
replace_or_add
create file, add the line -
filter_lines
create file if the file changes
-
Chef client version 13 or greater is expected.
Resources
For more detailed information see the matching resource documentation:
- [append_if_no_line](documentation/resources/append_if_no_line.md) - Add a missing line
- [replace_or_add](documentation/resources/replace_or_add.md) - Replace a line that matches a pattern or add a missing line
- [delete_lines](documentation/resources/delete_lines.md) - Delete an item from a list
- [add_to_list](documentation/resources/add_to_list.md) - Add an item to a list
- [delete_from_list](documentation/resources/delete_from_list.md) - Delete lines that match a pattern
- [filter_lines](documentation/resources/filter_lines.md) - Supply a ruby proc or use a sample filter to edit lines. The filter_lines resource supports multiple line modfications.
Sample filters:
- after: Insert lines after a matched line
- before: Insert lines before a matched lined
- between: Insert lines between matched lines
- comment: Change lines to comments
- delete_between: Delete the lines found between two patterns
- missing: Add missing lines to a file
- replace: Replace each instance of matched lines
- stanza: Insert or change keys in files formatted in stanzas
- substitute: Substitute text in lines matching a pattern
Authors
- Contributor: Mark Gibbons
- Contributor: Dan Webb
- Contributor: Sean OMeara
- Contributor: Antek S. Baranski
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
line Cookbook CHANGELOG
v2.3.0
Unreleased - for target version 2.3.0 in mid April 2019
- Add the between filter. Add lines between lines matching two patterns.
- Add the comment filter. Allow selected lines to be changed to comments in a file.
- Add the delete_before filter.
- Add the replace filter. Allow selected lines in a file to be replaced by other lines.
- Add the safe option to the after and before filter. Safe was the intended behavior.
- Add missing tests for methods verify_kind and verify_one_of.
- Allow inserted lines to be specified as strings. Split input strings on EOL characters.
- Add the substitute filter
- Add the stanza filter
v2.2.0 (2018-10-09)
- Add the before filter method to allow lines to be inserted before a matching line.
- Add test examples that show combining filters.
- Add a couple tests of empty file edge cases.
v2.1.1 (2018-10-08)
- Allow the backup option to be specified as true
v2.1.0 (2018-09-28)
- Add the filter_lines resource
- Add the after filter method to allow lines to be inserted after matching a line
v2.0.2 (2018-06-29)
- Explicitly disallow embedded EOL characters in replacement and append lines
v2.0.1 (2018-06-01)
- Tested on chef 12.13.37. Fix error caused by using the sensitive attribute. Sensitive true will always be used for chef 12.
v2.0.0 (2018-05-19)
- Breaking change - Files are processed in memory instead of line by line. It's possible that large files that were previously updated by the line cookbook will not be able to be processed.
- Breaking change - Drop Chef 12 support
- Use template files instead of
cookbook_file
so that we get platform sensitive line endings written for testing. - Add windows support to
add_to_list
,append_if_no_line
,delete_from_list
,delete_lines
,replace_or_add
. - Make the processing of missing target files consistent. Add the
ignore_missing
property to the resources to allow a missing file to raise an error. - Clean up the order of some boiler plate code.
- Create helper methods for some common resource functions.
- Drop the OS helpers in favour os using
platform_family?
.
v1.2.0 (2018-04-18)
- Add the ignore_missing option to the
delete_lines
anddelete_from_list
. Don't raise an error if the target file is missing.
v1.1.1 (2018-04-16)
- Allow appending to an empty file.
v1.1.0 (2018-03-26)
- Rework
delete_lines
to use file provider sub-resource. - Support matching with regexps in addition to strings with
delete_lines
. - Rework
append_if_no_line
to use file provider sub-resource. - Fix edge conditions around
files-with-no-trailing-CR
being fed toappend_if_no_line
. - Remove library helpers.
- Remove the
escape_regexp
and escape_string methods in favour of nativeRegexp.escape
v1.0.6 (2018-03-23)
- Add question mark to regular expression escape characters
v1.0.5 (2018-02-20)
- Minor Testing updates
- Remove custom matchers for ChefSpec. ChefDK 1 versions of ChefSpec will no longer work when unit testing against this cookbook.
v1.0.4 (2018-01-10)
- Handle deleting items from a list using spaces as the delimeter
v1.0.3 (2017-08-22)
- Add edge case tests for
add_to_list
- Handle the
delete_lines
,add_to_list
, anddelete_from_list
resources when a missing file is specified.
v1.0.2 (2017-07-07)
- Fix #58 Add resource locator matchers
- Fix #59 Add resource matcher tests
- Make cookstyle 2.0.0 fixes
- Delete the unused minitest files
- Clean up the
file_ext
inspec resource
v1.0.1 (2017-07-05)
- Fix #53
append_if_no_line
appends line always appends
v1.0.0 (2017-06-13)
- Move cookbook to Sous-Chefs org
- Move to using custom resources
v0.6.3 (2015-10-27)
- Fixing Ruby and Chef deprecation warnings
- Cleaning up tests a bit
- Adding support for
source_url
andissues_url
-
delete_from_list
resource
v0.6.2 (2015-07-15)
- Catch lines missed by strict patterns
- Add rspec tests for the
replace_or_add
provider. The existing chefspec tests don't step into the provider code and so don't check the provider functionality. - Change the Gemfile to reflect the need for berkshelf 3, chefspec v4.2, rspec 3 for the tests.
- Update
provider_replace_or_add
to handle cases where the pattern does not match the replacement line. - Fix notification problem where
updated_by_last_action
was set when nothing changed.
v0.6.1 (2015-02-24)
- Adding CHANGELOG
- Adding ChefSpec matchers
Collaborator Number Metric
2.3.0 passed this metric
Contributing File Metric
2.3.0 passed this metric
Foodcritic Metric
2.3.0 passed this metric
No Binaries Metric
2.3.0 passed this metric
Testing File Metric
2.3.0 passed this metric
Version Tag Metric
2.3.0 passed this metric
2.3.0 passed this metric
2.3.0 passed this metric
Foodcritic Metric
2.3.0 passed this metric
No Binaries Metric
2.3.0 passed this metric
Testing File Metric
2.3.0 passed this metric
Version Tag Metric
2.3.0 passed this metric
2.3.0 passed this metric
2.3.0 passed this metric
Testing File Metric
2.3.0 passed this metric
Version Tag Metric
2.3.0 passed this metric
2.3.0 passed this metric
2.3.0 passed this metric