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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', '= 1.1.1', :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.
Usage
Add "depends 'line'" to your cookbook's metadata.rb to gain access to
the resoures.
append_if_no_line "make sure a line is in some file" do path "/some/file" line "HI THERE I AM STRING" end replace_or_add "why hello" do path "/some/file" pattern "Why hello there.*" line "Why hello there, you beautiful person, you." end delete_lines "remove hash-comments from /some/file" do path "/some/file" pattern "^#.*" end delete_lines "remove hash-comments from /some/file with a regexp" do path "/some/file" pattern /^#.*/ end replace_or_add "change the love, don't add more" do path "/some/file" pattern "Why hello there.*" line "Why hello there, you beautiful person, you." replace_only true end add_to_list "add entry to a list" do path "/some/file" pattern "People to call: " delim [","] entry "Bobby" end delete_from_list "delete entry from a list" do path "/some/file" pattern "People to call: " delim [","] entry "Bobby" end
Notes
So far, the only resources implemented are
append_if_no_line replace_or_add delete_lines add_to_list delete_from_list
add_to_list
delim must be an array of 1, 2 or 3 multi-character elements.
If one delimiter is given, it is assumed that either the delimiter or the given search pattern will proceed each entry and
each entry will be followed by either the delimeter or a new line character:
People to call: Joe, Bobby
delim [","]
entry 'Karen'
People to call: Joe, Bobby, Karen
If two delimiters are given, the first is used as the list element delimiter and the second as entry delimiters:
my @net1918 = ("10.0.0.0/8", "172.16.0.0/12");
delim [", ", "\""]
entry "192.168.0.0/16"
my @net1918 = ("10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16");
if three delimiters are given, the first is used as the list element delimiter, the second as the leading entry delimiter and the third as the trailing delimiter:
multi = ([310], [818])
delim [", ", "[", "]"]
entry "425"
multi = ([310], [818], [425])
end_with is an optional property. If specified a list is expected to end with the given string.
delete_from_list
Works exactly the same way as add_to_list
, see above.
More to follow.
Author
Author:: Sean OMeara (sean@sean.io)
Contributor:: Antek S. Baranski (antek.baranski@gmail.com)
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
line Cookbook CHANGELOG
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 subresource. - Support matching with regexps in addition to strings with
delete_lines
. - Rework
append_if_no_line
to use file provider subresource. - Fix edge conditions around files-with-no-trailing-CR being fed to
append_if_no_line
. - Remove library helpers.
- Remove the escape_regexp and escape_string methods in favour of native Regexp.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
1.1.1 passed this metric
Contributing File Metric
1.1.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
1.1.1 passed this metric
No Binaries Metric
1.1.1 passed this metric
Testing File Metric
1.1.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.1.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.1.1 passed this metric
1.1.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
1.1.1 passed this metric
No Binaries Metric
1.1.1 passed this metric
Testing File Metric
1.1.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.1.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.1.1 passed this metric
1.1.1 passed this metric
Testing File Metric
1.1.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.1.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.1.1 failed this metric
1.1.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number