Class: Ladder::Cookbooks::Cookbook

Inherits:
Object
  • Object
show all
Defined in:
lib/chef/ladder/cookbooks.rb

Direct Known Subclasses

GitCookbook, LocalCookbook

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, source) ⇒ Cookbook

Returns a new instance of Cookbook.



17
18
19
20
# File 'lib/chef/ladder/cookbooks.rb', line 17

def initialize(name, source)
	@name = name
	@source = source
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



22
23
24
# File 'lib/chef/ladder/cookbooks.rb', line 22

def name
  @name
end

#sourceObject (readonly)

Returns the value of attribute source.



23
24
25
# File 'lib/chef/ladder/cookbooks.rb', line 23

def source
  @source
end

Class Method Details

.create(name, options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/chef/ladder/cookbooks.rb', line 5

def self.create(name, options)
	if options.has_key? :path
		return LocalCookbook.new(name, options[:path])
	elsif options.has_key? :git
		return GitCookbook.new(name, options[:git])
	elsif options.has_key? :github
		return GithubCookbook.new(name, options[:github])
	else
		raise "No valid source defined for cookbook '#{name}'"
	end
end