Class: Itamae::RecipeLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/itamae/recipe_loader.rb,
lib/itamae/recipe_loader/version.rb

Constant Summary collapse

VERSION =
'0.1.0'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(recipe_files, backend_type, options) ⇒ RecipeLoader

Returns a new instance of RecipeLoader.



9
10
11
12
13
14
15
# 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

Instance Attribute Details

#backendObject (readonly)

Returns the value of attribute backend.



6
7
8
# File 'lib/itamae/recipe_loader.rb', line 6

def backend
  @backend
end

#runnerObject (readonly)

Returns the value of attribute runner.



7
8
9
# File 'lib/itamae/recipe_loader.rb', line 7

def runner
  @runner
end

Class Method Details

.logger_init(options) ⇒ Object



17
18
19
20
# 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

Instance Method Details

#all_recipe_names(reject_recipes = ['recipes']) ⇒ Object



22
23
24
# File 'lib/itamae/recipe_loader.rb', line 22

def all_recipe_names(reject_recipes = ['recipes'])
  recipe_names(@runner.children) - reject_recipes
end