Method: Chef::Cookbook::SyntaxCheck.for_cookbook

Defined in:
lib/chef/cookbook/syntax_check.rb

.for_cookbook(cookbook_name, cookbook_path = nil) ⇒ Object

Creates a new SyntaxCheck given the cookbook_name and a cookbook_path. If no cookbook_path is given, Chef::Config.cookbook_path is used.



34
35
36
37
38
39
40
# File 'lib/chef/cookbook/syntax_check.rb', line 34

def self.for_cookbook(cookbook_name, cookbook_path=nil)
  cookbook_path ||= Chef::Config.cookbook_path
  unless cookbook_path
    raise ArgumentError, "Cannot find cookbook #{cookbook_name} unless Chef::Config.cookbook_path is set or an explicit cookbook path is given"
  end
  new(File.join(cookbook_path, cookbook_name.to_s))
end