Sha256: bd3aae7d8ea87b3aca30397f81236613bde44af4a4ec24adf2a2f4a4edd4383a

Contents?: true

Size: 533 Bytes

Versions: 5

Compression:

Stored size: 533 Bytes

Contents

require 'pathname'

module RecipeHelper
  ROOT_DIR = Pathname.new(File.expand_path(__dir__))

  def include_role(name)
    path = ROOT_DIR.join('roles', *name.split('::'))
    path = path.relative_path_from(Pathname.new(@recipe.path).parent)
    include_recipe(path.to_s)
  end

  def include_cookbook(name)
    path = ROOT_DIR.join('cookbooks', *name.split('::'))
    path = path.relative_path_from(Pathname.new(@recipe.path).parent)
    include_recipe(path.to_s)
  end
end

Itamae::Recipe::EvalContext.send(:include, RecipeHelper)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
itamae-template-0.1.4 template/recipe_helper.rb
itamae-template-0.1.3 template/recipe_helper.rb
itamae-template-0.1.2 template/recipe_helper.rb
itamae-template-0.1.1 template/recipe_helper.rb
itamae-template-0.1.0 template/recipe_helper.rb