chef
https://github.com/opscode/chef
Ruby
A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure.
Chef::Cookbook::Metadata#gem_requirements_to_array
Convert an Array of Gem::Dependency objects (chef_version/ohai_version) to an Array.
Gem::Dependencey#to_s is not useful, and there is no #to_json defined on it or its component
objets, so we have to write our own rendering method.
[ Gem::Dependency.new(">= 12.5"), Gem::Dependency.new(">= 11.18.0", "< 12.0") ]
results in:
[ [ ">= 12.5" ], [ ">= 11.18.0", "< 12.0" ] ]Edit
git clone [email protected]:opscode/chef.git
cd chef
open lib/chef/cookbook/metadata.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Chef--Cookbook--Metadata-gem_requirements_to_array-for-pr
# Commit to gitgit add lib/chef/cookbook/metadata.rbgit commit -m "better docs for Chef::Cookbook::Metadata#gem_requirements_to_array"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Chef--Cookbook--Metadata-gem_requirements_to_array-for-pr
hub pull-request
# Celebrate!