chef

https://github.com/opscode/chef

Ruby

A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure.

Chef::ChefFS::Config#initialize

Create a new Config object which can produce a chef_fs and local_fs.

==== Arguments

[chef_config]
  A hash that looks suspiciously like +Chef::Config+.  These hash keys
  include:

  :chef_repo_path::
    The root where all local chef object data is stored.  Mirrors
    +Chef::Config.chef_repo_path+
  :cookbook_path, node_path, ...::
    Paths to cookbooks/, nodes/, data_bags/, etc.  Mirrors
    +Chef::Config.cookbook_path+, etc.  Defaults to
    +<chef_repo_path>/cookbooks+, etc.
  :repo_mode::
    The directory format on disk.  'everything', 'hosted_everything' and
    'static'.  Default: autodetected based on whether the URL has
    "/organizations/NAME."
  :versioned_cookbooks::
    If true, the repository contains cookbooks with versions in their
    name (apache2-1.0.0).  If false, the repository just has one version
    of each cookbook and the directory has the cookbook name (apache2).
    Default: +false+
  :chef_server_url::
    The URL to the Chef server, e.g. https://api.opscode.com/organizations/foo.
    Used as the server for the remote chef_fs, and to "guess" repo_mode
    if not specified.
  :node_name:: The username to authenticate to the Chef server with.
  :client_key:: The private key for the user for authentication
  :environment:: The environment in which you are presently working
  :repo_mode::
    The repository mode, :hosted_everything, :everything or :static.
    This determines the set of subdirectories the Chef server will offer
    up.
  :versioned_cookbooks:: Whether or not to include versions in cookbook names

[cwd]
  The current working directory to base relative Chef paths from.
  Defaults to +Dir.pwd+.

[options]
  A hash of other, not-suspiciously-like-chef-config options:
  :cookbook_version::
    When downloading cookbooks, download this cookbook version instead
    of the latest.

[ui]
  The object to print output to, with "output", "warn" and "error"
  (looks a little like a Chef::Knife::UI object, obtainable from
  Chef::Knife.ui).

==== Example

  require 'chef/chef_fs/config'
  config = Chef::ChefFS::Config.new
  config.chef_fs.child('cookbooks').children.each do |cookbook|
    puts "Cookbook on server: #{cookbook.name}"
  end
  config.local_fs.child('cookbooks').children.each do |cookbook|
    puts "Local cookbook: #{cookbook.name}"
  end

Source | Google | Stack overflow

Edit

git clone [email protected]:opscode/chef.git

cd chef

open lib/chef/chef_fs/config.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Chef--ChefFS--Config-initialize-for-pr


# Commit to git

git add lib/chef/chef_fs/config.rbgit commit -m "better docs for Chef::ChefFS::Config#initialize"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Chef--ChefFS--Config-initialize-for-pr

hub pull-request


# Celebrate!