{"id":419,"date":"2015-08-18T16:20:57","date_gmt":"2015-08-18T16:20:57","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/2015\/08\/18\/chef-documenting-cookbooks-automatically\/"},"modified":"2021-11-19T07:04:07","modified_gmt":"2021-11-19T07:04:07","slug":"chef-documenting-cookbooks-automatically","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/chef-documenting-cookbooks-automatically\/","title":{"rendered":"Understanding the chef cookbook&#8217;s README file"},"content":{"rendered":"<p><strong>Problems Area &#8211;<\/strong><\/p>\n<p>Our infrastructure has many cookbooks that aim to be reusable, primarily through encapsulating behaviour in LWRPs. This led to an explosion of LWRPs and sometimes the documentation didn&#8217;t keep up or did just not exist.<\/p>\n<p><strong>Solution 1: Follow Best Practices&nbsp;<\/strong><\/p>\n<p>This command will create a README.rdoc by default, and I prefer Markdown, so I specify the -r md option.<\/p>\n<pre>&gt; knife cookbook create smartmontools -r md<\/pre>\n<p><strong>Solution 2: Automate using plugins<\/strong><\/p>\n<p>README.md which should be generated automatcially must contain information about the recipes, attributes, platform compatibility and cookbook requirements (i.e. depends, recommends, suggests etc).<\/p>\n<p>Mathias Lafeldt wrote a knife plugin that generates an initial README.md from the metadata.rb file in a a cookbook.<\/p>\n<p>Link &#8211;<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/mlafeldt\/knife-cookbook-readme\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/mlafeldt\/knife-cookbook-readme<\/a><\/li>\n<li><a href=\"http:\/\/mlafeldt.github.io\/knife-cookbook-readme\/\" target=\"_blank\" rel=\"noopener\">http:\/\/mlafeldt.github.io\/knife-cookbook-readme\/<\/a><\/li>\n<\/ul>\n<p>Extension of Mathias Lafeldt was done here with regenerate README.md from the cookbook source code<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/realityforge\/knife-cookbook-doc\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/realityforge\/knife-cookbook-doc<\/a><\/li>\n<\/ul>\n<p><strong>Please refer these useful blogs as well which is referenced in order to write this article&#8230;<\/strong><\/p>\n<ul>\n<li><a href=\"http:\/\/realityforge.org\/code\/2013\/04\/01\/documenting-cookbooks.html\" target=\"_blank\" rel=\"noopener\">http:\/\/realityforge.org\/code\/2013\/04\/01\/documenting-cookbooks.html<\/a><\/li>\n<\/ul>\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_22204\"><figure class=\"wp-block-embed wp-block-embed-youtube is-type-video is-provider-youtube epyt-figure\"><div class=\"wp-block-embed__wrapper\"><iframe loading=\"lazy\"  id=\"_ytid_30125\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/?enablejsapi=1&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  data-epytgalleryid=\"epyt_gallery_22204\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe><\/div><\/figure><div class=\"epyt-gallery-list\"><div>Sorry, there was a YouTube error.<\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Problems Area &#8211; Our infrastructure has many cookbooks that aim to be reusable, primarily through encapsulating behaviour in LWRPs. This led to an explosion of LWRPs and sometimes the documentation didn&#8217;t keep up or did just not exist. Solution 1: Follow Best Practices&nbsp; This command will create a README.rdoc by default, and I prefer Markdown,&#8230;<\/p>\n","protected":false},"author":1,"featured_media":3444,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[88],"tags":[1651,1650,795,1649,1652,407,642,1648,604,1472,1050,1646,1647],"class_list":["post-419","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-chef","tag-auto","tag-automate","tag-automatically","tag-automation","tag-best-practices","tag-chef","tag-chef-cookbook","tag-chef-cookbook-documentation","tag-chef-guide","tag-chef-tutorial","tag-cookbooks","tag-documentation","tag-documenting-cookbooks"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/419","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=419"}],"version-history":[{"count":3,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/419\/revisions"}],"predecessor-version":[{"id":25816,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/419\/revisions\/25816"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/3444"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=419"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=419"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}