Skip to content

Commit 689dd2f

Browse files
committed
Adding documentation
1 parent c9c0e5e commit 689dd2f

3 files changed

Lines changed: 28 additions & 2 deletions

File tree

chef/lib/chef/client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def run_solo
9494
# node_name<String>:: The name of the node to build - defaults to nil
9595
#
9696
# === Returns
97-
# node:: Returns the created node object, also stored in @node
97+
# node<Chef::Node>:: Returns the created node object, also stored in @node
9898
def build_node(node_name=nil)
9999
node_name ||= Facter["fqdn"].value ? Facter["fqdn"].value : Facter["hostname"].value
100100
@safe_name = node_name.gsub(/\./, '_')

chef/lib/chef/compile.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ class Compile
2222

2323
# Creates a new Chef::Compile object. This object gets used by the Chef Server to generate
2424
# a fully compiled recipe list for a node.
25+
#
26+
# === Returns
27+
# object<Chef::Compile>:: Duh. :)
2528
def initialize()
2629
@node = nil
2730
@cookbook_loader = Chef::CookbookLoader.new
@@ -35,7 +38,7 @@ def initialize()
3538
# The first step in compiling the catalog. Results available via the node accessor.
3639
#
3740
# === Returns
38-
# <Chef::Node>:: The loaded Chef Node
41+
# node<Chef::Node>:: The loaded Chef Node
3942
def load_node(name)
4043
Chef::Log.debug("Loading Chef Node #{name} from CouchDB")
4144
@node = Chef::Node.load(name)

chef/lib/chef/cookbook.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ class Cookbook
2222
:lib_files, :name
2323
attr_reader :recipe_files
2424

25+
# Creates a new Chef::Cookbook object.
26+
#
27+
# === Returns
28+
# object<Chef::Cookbook>:: Duh. :)
2529
def initialize(name)
2630
@name = name
2731
@attribute_files = Array.new
@@ -33,13 +37,28 @@ def initialize(name)
3337
@lib_files = Array.new
3438
end
3539

40+
# Loads all the library files in this cookbook via require.
41+
#
42+
# === Returns
43+
# true:: Always returns true
3644
def load_libraries
3745
@lib_files.each do |file|
3846
Chef::Log.debug("Loading cookbook #{name} library file: #{file}")
3947
require file
4048
end
49+
true
4150
end
4251

52+
# Loads all the attribute files in this cookbook within a particular <Chef::Node>.
53+
#
54+
# === Parameters
55+
# node<Chef::Node>:: The Chef::Node to apply the attributes to
56+
#
57+
# === Returns
58+
# node<Chef::Node>:: The updated Chef::Node object
59+
#
60+
# === Raises
61+
# <ArgumentError>:: If the argument is not a kind_of? <Chef::Node>
4362
def load_attributes(node)
4463
unless node.kind_of?(Chef::Node)
4564
raise ArgumentError, "You must pass a Chef::Node to load_attributes!"
@@ -51,6 +70,10 @@ def load_attributes(node)
5170
node
5271
end
5372

73+
# Loads all the resource definitions in this cookbook.
74+
#
75+
# === Returns
76+
# definitions<Hash>: A hash of <Chef::ResourceDefinition> objects, keyed by name.
5477
def load_definitions
5578
results = Hash.new
5679
@definition_files.each do |file|

0 commit comments

Comments
 (0)