lib/chef-cli/command/generator_commands/cookbook.rb in chef-cli-3.1.6 vs lib/chef-cli/command/generator_commands/cookbook.rb in chef-cli-4.0.0
- old
+ new
@@ -53,10 +53,17 @@
long: "--policy",
description: "Generate a cookbook using Policyfile dependency resolution (default).",
boolean: true,
default: nil
+ option :specs,
+ short: "-s",
+ long: "--specs",
+ description: "Generate a cookbook with sample ChefSpec specs",
+ boolean: true,
+ default: nil
+
option :workflow,
short: "-w",
long: "--workflow",
description: "Generate a cookbook with a full #{ChefCLI::Dist::WORKFLOW} build cookbook.",
boolean: true,
@@ -79,10 +86,11 @@
def initialize(params)
@params_valid = true
@cookbook_name = nil
@policy_mode = true
@verbose = false
+ @specs = false
super
end
def run
read_and_validate_params
@@ -131,10 +139,11 @@
Generator.add_attr_to_context(:workflow_project_dir, cookbook_full_path)
Generator.add_attr_to_context(:build_cookbook_parent_is_cookbook, true)
Generator.add_attr_to_context(:workflow_project_git_initialized, have_git? && !cookbook_path_in_git_repo?)
Generator.add_attr_to_context(:verbose, verbose?)
+ Generator.add_attr_to_context(:specs, specs?)
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?)
@@ -186,10 +195,14 @@
def verbose?
@verbose
end
+ def specs?
+ @specs
+ end
+
#
# Is there a .delivery/cli.toml in the current dir or any of the parent dirs
#
# @return [Boolean]
#
@@ -219,9 +232,13 @@
@policy_mode = false
end
if config[:verbose]
@verbose = true
+ end
+
+ if config[:specs]
+ @specs = true
end
true
end