class LibrarianChefDSLParser

Attributes

cookbooks[RW]
site[RW]

Public Class Methods

new(cheffile, &data) click to toggle source
# File lib/librarian_chef_dsl_parser.rb, line 7
def initialize(cheffile, &data)
  @cheffile = cheffile
  @cookbooks = []
  data = false

  uri = URI.parse(cheffile)
  if %w( http https ).include?(uri.scheme)
    data = Net::HTTP.get(uri)
  else
    data = File.read(cheffile)
  end
  instance_eval data
end

Public Instance Methods

cheffile() click to toggle source
# File lib/librarian_chef_dsl_parser.rb, line 21
def cheffile
  @cheffile
end
cookbook(name, options) click to toggle source
# File lib/librarian_chef_dsl_parser.rb, line 29
def cookbook(name, options)
  cookbook = { "name" => name, "options" => options }
  @cookbooks.push(cookbook)
end