class Itamae::RecipeLoader

Constants

VERSION

Attributes

backend[R]
runner[R]

Public Class Methods

logger_init(options) click to toggle source
# File lib/itamae/recipe_loader.rb, line 17
def self.logger_init(options)
  Itamae.logger.level = ::Logger.const_get(options[:log_level].upcase) if options[:log_level]
  Itamae.logger.formatter.colored = options[:color] if options[:color]
end
new(recipe_files, backend_type, options) click to toggle source
# File lib/itamae/recipe_loader.rb, line 9
def initialize(recipe_files, backend_type, options)
  self.class.logger_init(options)
  @targets = []
  backend = Itamae::Backend.create(backend_type, options)
  @runner = Itamae::Runner.new(backend, options)
  @runner.load_recipes(recipe_files)
end

Public Instance Methods

all_recipe_names(reject_recipes = ['recipes']) click to toggle source
# File lib/itamae/recipe_loader.rb, line 22
def all_recipe_names(reject_recipes = ['recipes'])
  recipe_names(@runner.children) - reject_recipes
end

Private Instance Methods

recipe_names(children) click to toggle source
# File lib/itamae/recipe_loader.rb, line 28
def recipe_names(children)
  children.each do |child|
    next unless child.is_a?(Itamae::Recipe)
    @targets.push(File.basename(child.dir))
    recipe_names(child.children) if child.children.count.positive?
  end
  @targets.uniq
end