summaryrefslogtreecommitdiff
path: root/lib/chef/chef_fs/config.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/chef_fs/config.rb')
-rw-r--r--lib/chef/chef_fs/config.rb67
1 files changed, 66 insertions, 1 deletions
diff --git a/lib/chef/chef_fs/config.rb b/lib/chef/chef_fs/config.rb
index ca273b2cca..fcad6c919f 100644
--- a/lib/chef/chef_fs/config.rb
+++ b/lib/chef/chef_fs/config.rb
@@ -22,9 +22,74 @@ require 'chef/chef_fs/path_utils'
class Chef
module ChefFS
#
- # Helpers to take Chef::Config and create chef_fs and local_fs from it
+ # Helpers to take Chef::Config and create chef_fs and local_fs (ChefFS
+ # objects representing the server and local repository, respectively).
#
class Config
+ #
+ # 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
+ #
def initialize(chef_config = Chef::Config, cwd = Dir.pwd, options = {}, ui = nil)
@chef_config = chef_config
@cwd = cwd