lib/chef-cli/command/generator_commands/cookbook.rb in chef-cli-5.0.1 vs lib/chef-cli/command/generator_commands/cookbook.rb in chef-cli-5.1.0

- old
+ new

@@ -74,10 +74,17 @@ long: "--verbose", description: "Show detailed output from the generator", boolean: true, default: false + option :yaml, + short: "-y", + long: "--yaml", + description: "Generate a cookbook with YAML Recipe configuration file as the default.", + boolean: true, + default: nil + option :pipeline, long: "--pipeline PIPELINE", description: "Use PIPELINE to set target branch to something other than master for the #{ChefCLI::Dist::WORKFLOW} build_cookbook", default: "master" @@ -109,20 +116,21 @@ err("ERROR: #{e}") 1 end def emit_post_create_message + default_recipe_file = yaml ? "default.yml" : "default.rb" if have_delivery_config? msg("Your cookbook is ready. To setup the pipeline, type `cd #{cookbook_name_or_path}`, then run `delivery init`") else msg("Your cookbook is ready. Type `cd #{cookbook_name_or_path}` to enter it.") msg("\nThere are several commands you can run to get started locally developing and testing your cookbook.") msg("Type `delivery local --help` to see a full list of local testing commands.") msg("\nWhy not start by writing an InSpec test? Tests for the default recipe are stored at:\n") msg("test/integration/default/default_test.rb") msg("\nIf you'd prefer to dive right in, the default recipe can be found at:") - msg("\nrecipes/default.rb\n") + msg("\nrecipes/#{default_recipe_file}\n") end end def setup_context super @@ -145,17 +153,22 @@ Generator.add_attr_to_context(:use_policyfile, policy_mode?) Generator.add_attr_to_context(:pipeline, pipeline) Generator.add_attr_to_context(:kitchen, kitchen) Generator.add_attr_to_context(:vscode_dir, create_vscode_dir?) + Generator.add_attr_to_context(:yaml, yaml) end def kitchen config[:kitchen] end def pipeline config[:pipeline] + end + + def yaml + config[:yaml] end def policy_name cookbook_name end