LoginSignup
2
1

More than 5 years have passed since last update.

レシピから同cookbook内の別レシピの呼ぶ

Posted at

レシピから別のレシピを呼ぶ場合はinclude_recipeを使う

recipe/my_recipe.rb
include_recipe "other_cookbook::other_recipe"

同cookbook内の別レシピを呼ぶ場合も使えるが、foodcriticに引っかかる
FC007: Ensure recipe dependencies are reflected in cookbook metadata
http://www.foodcritic.io/#FC007
つまりinclude_recipeするcookbookはmetadataに依存性を書いとかなきゃいけない

ただmetadataに自身のcookbookをdependsするのもダメ
FC063: Cookbook incorrectly depends on itself
http://www.foodcritic.io/#FC063

これらのwarning回避するには、自身のcookbook名をハードコードするのではなく、変数を使う

recipe/my_recipe.rb
include_recipe "#{cookbook_name}::my_recipe"

参照

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1