lib/itamae/recipe.rb in itamae-1.5.2 vs lib/itamae/recipe.rb in itamae-1.6.0
- old
+ new
@@ -116,13 +116,12 @@
Resource.define_resource(name, Definition.create_class(name, params, @recipe, &block))
end
def include_recipe(target)
expanded_path = ::File.expand_path(target, File.dirname(@recipe.path))
- candidate_paths = [
- ::Dir.exists?(expanded_path) ? ::File.join(expanded_path, "default.rb") : expanded_path,
- Recipe.find_recipe_in_gem(target),
- ].compact
+ expanded_path = ::File.join(expanded_path, 'default.rb') if ::Dir.exists?(expanded_path)
+ expanded_path.concat('.rb') unless expanded_path.end_with?('.rb')
+ candidate_paths = [expanded_path, Recipe.find_recipe_in_gem(target)].compact
path = candidate_paths.find {|path| File.exist?(path) }
unless path
raise NotFoundError, "Recipe not found. (#{target})"
end