Class: YARD::CodeObjects::Chef::CookbookObject

Inherits:
ChefObject
  • Object
show all
Defined in:
lib/yard-chefdoc/code_objects/cookbook.rb

Overview

A CookbookObject represents a Chef cookbook. See wiki.opscode.com/display/chef/Cookbooks for more information about cookbooks.

Instance Attribute Summary collapse

Attributes inherited from ChefObject

#file, #header

Instance Method Summary collapse

Methods inherited from ChefObject

#chef_init, #children_by_type, #find_description_in, #find_header_in, register, register_element

Constructor Details

#initialize(namespace, name) ⇒ CookbookObject

Creates a new CookbookObject instance. belongs

Parameters:

  • namespace (NamespaceObject)

    namespace to which the cookbook

  • name (String)

    name of the cookbook



32
33
34
35
# File 'lib/yard-chefdoc/code_objects/cookbook.rb', line 32

def initialize(namespace, name)
  super(namespace, name)
  @docstring_type = :markdown
end

Instance Attribute Details

#dependenciesObject

Cookbook metadata



15
16
17
# File 'lib/yard-chefdoc/code_objects/cookbook.rb', line 15

def dependencies
  @dependencies
end

#docstring_typeObject

Returns the value of attribute docstring_type.



12
13
14
# File 'lib/yard-chefdoc/code_objects/cookbook.rb', line 12

def docstring_type
  @docstring_type
end

#gemsObject

Returns the value of attribute gems.



23
24
25
# File 'lib/yard-chefdoc/code_objects/cookbook.rb', line 23

def gems
  @gems
end

#issues_urlObject

Returns the value of attribute issues_url.



18
19
20
# File 'lib/yard-chefdoc/code_objects/cookbook.rb', line 18

def issues_url
  @issues_url
end

#licenseObject

Returns the value of attribute license.



21
22
23
# File 'lib/yard-chefdoc/code_objects/cookbook.rb', line 21

def license
  @license
end

#maintainerObject

Returns the value of attribute maintainer.



19
20
21
# File 'lib/yard-chefdoc/code_objects/cookbook.rb', line 19

def maintainer
  @maintainer
end

#maintainer_emailObject

Returns the value of attribute maintainer_email.



20
21
22
# File 'lib/yard-chefdoc/code_objects/cookbook.rb', line 20

def maintainer_email
  @maintainer_email
end

#platformsObject

Returns the value of attribute platforms.



22
23
24
# File 'lib/yard-chefdoc/code_objects/cookbook.rb', line 22

def platforms
  @platforms
end

#source_urlObject

Returns the value of attribute source_url.



17
18
19
# File 'lib/yard-chefdoc/code_objects/cookbook.rb', line 17

def source_url
  @source_url
end

#versionObject

Returns the value of attribute version.



16
17
18
# File 'lib/yard-chefdoc/code_objects/cookbook.rb', line 16

def version
  @version
end

Instance Method Details

#librariesArray

Libraries defined in the cookbook. Catches all classes, modules and defintion directly defined without a namespace

Returns:

  • (Array)

    libraries in the cookbook



42
43
44
45
46
47
48
# File 'lib/yard-chefdoc/code_objects/cookbook.rb', line 42

def libraries
  modules = YARD::Registry.all(:module)
  classes = YARD::Registry.all(:class)
  root_definitions = YARD::Registry.all(:method).select { |m| m.path =~ /^root#/ }

  classes + modules + root_definitions
end

#metadataObject



50
51
52
# File 'lib/yard-chefdoc/code_objects/cookbook.rb', line 50

def 
  [@version, @maintainer, @dependencies]
end