Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

xml_file (2) Versions 0.3.0

Provides xml_file resource-provider

Policyfile
Berkshelf
Knife
cookbook 'xml_file', '~> 0.3.0', :supermarket
cookbook 'xml_file', '~> 0.3.0'
knife supermarket install xml_file
knife supermarket download xml_file
README
Dependencies
Quality 17%

xml_file - Cookbook

xml_file resource-provider to manage XML files.

Description

xml_file resource allows managing XML files where only parts of the file's
content is controlled. Users can specify XPath targets and expected content
at those targets.

Usage

xml_file resource allows different attributes to specify
partial content.

  • 'partial' attribute to add a XML fragments. Following example will insert part.xml (present in files/default directory of the consumer cookbook) at '/parent/child' XPath target's last element. Content of whole.xml xml <?xml version="1.0" encoding="UTF-8"?> <project name=""> <repo type="git"></repo> <maintainers> <maintainer>Hendrix</maintainer> <maintainer>Morrison</maintainer> </maintainers> <project>

Content of part.xml
xml
<issuetracker>
<name>Jira</name>
<url>http://example.com</url>
</issuetracker>

xml_file resource declaration:
ruby
xml_file '/opt/whole.xml' do
partial '//project', 'part.xml'
owner 'root'
group 'root'
mode 0644
end

will change whole.xml file to:
xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="">
<repo type="git"></repo>
<maintainers>
<maintainer>Hendrix</maintainer>
<maintainer>Morrison</maintainer>
</maintainers>
<issuetracker>
<name>Jira</name>
<url>http://example.com</url>
</issuetracker>
<project>

before or after keys can be specified alongside the XPath values
to insert the elements at certain position with respective to their siblings.

  • The 'attribute' method allows setting the value of an XML element's attribute. Following is an example: ruby xml_file '/opt/whole.xml' do attribute '//project/repo', 'type', 'svn' owner 'root' group 'root' mode 0644 end Will result: xml <?xml version="1.0" encoding="UTF-8"?> <project name=""> <repo type="svn"></repo> <maintainers> <maintainer>Hendrix</maintainer> <maintainer>Morrison</maintainer> </maintainers> <project>
  • The 'text' method will set the text content of an XML element. Following example: ruby xml_file '/opt/whole.xml' do text '//maintainer[last()]', 'Ray' owner 'root' group 'root' mode 0644 end will result: xml <?xml version="1.0" encoding="UTF-8"?> <project name=""> <repo type="svn"></repo> <maintainers> <maintainer>Hendrix</maintainer> <maintainer>Ray</maintainer> </maintainers> <project>
  • The 'remove' method will remove all matching xpath elements: Following example: ruby xml_file '/opt/whole.xml' do remove '//maintainer' end will result: xml <?xml version="1.0" encoding="UTF-8"?> <project name=""> <repo type="svn"></repo> <maintainers> </maintainers> <project>

All methods can be combined. When used in combination, partials are
processed before text and attribute, hence they can refer to XPath introduced by partials.

xml_file resource only supports :edit action. Its written in
REXML and should be portable across platforms.

License

Apache 2

Contributing

  1. Fork it ( https://github.com/GoatOS/xml_file/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

goatos Applicable Versions

Collaborator Number Metric
            

0.3.0 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

0.3.0 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
            

0.3.0 failed this metric

FC066: Ensure chef_version is set in metadata: xml_file/metadata.rb:1
FC069: Ensure standardized license defined in metadata: xml_file/metadata.rb:1
FC070: Ensure supports metadata defines valid platforms: xml_file/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

No Binaries Metric
            

0.3.0 passed this metric

Testing File Metric
            

0.3.0 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
            

0.3.0 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