Class: ItamaeMitsurin::Mitsurin::ServerspecTask

Inherits:
BaseTask
  • Object
show all
Defined in:
lib/itamae-mitsurin/mitsurin/serverspec_task.rb

Constant Summary collapse

LoadSpecError =
Class.new(StandardError)

Constants inherited from BaseTask

BaseTask::EnvironmentsSetError, BaseTask::LoadAttributeError, BaseTask::LoadRecipeError

Instance Method Summary collapse

Methods inherited from BaseTask

#create_itamae_command, #create_spec_command, #create_tmp_nodes, #load_environments, #load_node_attributes, #load_recipe_attributes, #load_run_list, #merge_attributes, #runner_display

Instance Method Details

#list_recipe_filepath(run_list) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/itamae-mitsurin/mitsurin/serverspec_task.rb', line 8

def list_recipe_filepath(run_list)
  recipes = []
  run_list.each do |recipe|
    target_list = Dir.glob("site-cookbooks/**/#{recipe.keys.join}/spec/#{recipe.values.join}_spec.rb")

    raise LoadSpecError, "#{recipe.to_a.join('::')} cookbook or spec does not exist." if target_list.empty?

    target_list.each do |target|
      recipes << " #{target}"
    end
  end

  recipes
end