chef-cli 5.0.1 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +15 -0
- data/lib/chef-cli/command/generate.rb +5 -3
- data/lib/chef-cli/command/generator_commands/cookbook.rb +14 -1
- data/lib/chef-cli/command/generator_commands/recipe.rb +7 -0
- data/lib/chef-cli/skeletons/code_generator/recipes/cookbook.rb +12 -4
- data/lib/chef-cli/skeletons/code_generator/recipes/recipe.rb +11 -3
- data/lib/chef-cli/skeletons/code_generator/templates/default/recipe.yml.erb +18 -0
- data/lib/chef-cli/version.rb +1 -1
- data/spec/unit/command/generate_spec.rb +7 -0
- data/spec/unit/command/generator_commands/cookbook_spec.rb +49 -195
- data/spec/unit/command/generator_commands/recipe_spec.rb +34 -0
- metadata +3 -13
- data/lib/chef-cli/command/generator_commands/build_cookbook.rb +0 -126
- data/lib/chef-cli/skeletons/code_generator/files/default/build_cookbook/README.md +0 -146
- data/lib/chef-cli/skeletons/code_generator/files/default/build_cookbook/kitchen.yml +0 -21
- data/lib/chef-cli/skeletons/code_generator/files/default/build_cookbook/test-fixture-recipe.rb +0 -8
- data/lib/chef-cli/skeletons/code_generator/files/default/delivery-config.json +0 -17
- data/lib/chef-cli/skeletons/code_generator/recipes/build_cookbook.rb +0 -175
- data/lib/chef-cli/skeletons/code_generator/templates/default/build_cookbook/Berksfile.erb +0 -7
- data/lib/chef-cli/skeletons/code_generator/templates/default/build_cookbook/metadata.rb.erb +0 -10
- data/lib/chef-cli/skeletons/code_generator/templates/default/build_cookbook/recipe.rb.erb +0 -9
- data/spec/unit/command/generator_commands/build_cookbook_spec.rb +0 -377
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a13b7fe5a79e96a77dbe15637e0c7049ba7a2b1497c9b51ae1a8512dde66173e
|
4
|
+
data.tar.gz: cfa51c708cf8c115755dc5e243f6ac08b658bb71cb9dd4b015d8738de229ae26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 974da449a8873d332523b92a0a263f675d80bd8b378317e645f80ea2bc5bdcff5fb476a038e7ce41268e1c88222d2625695aef90bf7311ddf2c7972b001c99f2
|
7
|
+
data.tar.gz: 6a3504dc2d8f14b4a1ad63085fb74661c18e89d78551c0d2fd65efdb392c588277fd9202bbada3c09471290743c1eee389268008b6d132d926a958b035024ffe
|
data/Gemfile
CHANGED
@@ -10,6 +10,21 @@ group :test do
|
|
10
10
|
gem "cookstyle", "=7.7.2" # this forces dependabot PRs to open which triggers cookstyle CI on the chef generate command
|
11
11
|
gem "chefstyle", "=1.6.2"
|
12
12
|
gem "test-kitchen", ">= 2.11.1"
|
13
|
+
|
14
|
+
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.6")
|
15
|
+
gem "chef-zero", "~> 14"
|
16
|
+
gem "chef", "~> 15"
|
17
|
+
gem "chef-utils", "=16.6.14"
|
18
|
+
end
|
19
|
+
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.7")
|
20
|
+
gem "ohai", "~> 16"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
group :development do
|
25
|
+
gem "pry"
|
26
|
+
gem "pry-byebug"
|
27
|
+
gem "rb-readline"
|
13
28
|
end
|
14
29
|
|
15
30
|
group :profile do
|
@@ -29,7 +29,6 @@ require_relative "generator_commands/template"
|
|
29
29
|
require_relative "generator_commands/repo"
|
30
30
|
require_relative "generator_commands/policyfile"
|
31
31
|
require_relative "generator_commands/generator_generator"
|
32
|
-
require_relative "generator_commands/build_cookbook"
|
33
32
|
require_relative "../dist"
|
34
33
|
|
35
34
|
module ChefCLI
|
@@ -56,7 +55,7 @@ module ChefCLI
|
|
56
55
|
generator(:repo, :Repo, "Generate a #{ChefCLI::Dist::INFRA_PRODUCT} code repository")
|
57
56
|
generator(:policyfile, :Policyfile, "Generate a Policyfile for use with the install/push commands")
|
58
57
|
generator(:generator, :GeneratorGenerator, "Copy #{ChefCLI::Dist::PRODUCT}'s generator cookbook so you can customize it")
|
59
|
-
generator(:'build-cookbook', :BuildCookbook, "Generate a build cookbook for use with #{ChefCLI::Dist::WORKFLOW}")
|
58
|
+
generator(:'build-cookbook', :BuildCookbook, "DEPRECATED: Generate a build cookbook for use with #{ChefCLI::Dist::WORKFLOW}")
|
60
59
|
|
61
60
|
def self.banner_headline
|
62
61
|
<<~E
|
@@ -83,6 +82,10 @@ module ChefCLI
|
|
83
82
|
end
|
84
83
|
|
85
84
|
def run(params)
|
85
|
+
if params[0] == "build-cookbook"
|
86
|
+
warn "[DEPRECATION] Chef Workflow (Delivery) is end of life (EOL) as of December 31, 2020 and this generator subcommand has been removed".freeze
|
87
|
+
return 1
|
88
|
+
end
|
86
89
|
if ( generator_spec = generator_for(params[0]) )
|
87
90
|
params.shift
|
88
91
|
generator = GeneratorCommands.build(generator_spec.class_name, params)
|
@@ -118,7 +121,6 @@ module ChefCLI
|
|
118
121
|
def have_generator?(name)
|
119
122
|
self.class.generators.map { |g| g.name.to_s }.include?(name)
|
120
123
|
end
|
121
|
-
|
122
124
|
end
|
123
125
|
end
|
124
126
|
end
|
@@ -76,6 +76,13 @@ module ChefCLI
|
|
76
76
|
boolean: true,
|
77
77
|
default: false
|
78
78
|
|
79
|
+
option :yaml,
|
80
|
+
short: "-y",
|
81
|
+
long: "--yaml",
|
82
|
+
description: "Generate a cookbook with YAML Recipe configuration file as the default.",
|
83
|
+
boolean: true,
|
84
|
+
default: nil
|
85
|
+
|
79
86
|
option :pipeline,
|
80
87
|
long: "--pipeline PIPELINE",
|
81
88
|
description: "Use PIPELINE to set target branch to something other than master for the #{ChefCLI::Dist::WORKFLOW} build_cookbook",
|
@@ -111,6 +118,7 @@ module ChefCLI
|
|
111
118
|
end
|
112
119
|
|
113
120
|
def emit_post_create_message
|
121
|
+
default_recipe_file = yaml ? "default.yml" : "default.rb"
|
114
122
|
if have_delivery_config?
|
115
123
|
msg("Your cookbook is ready. To setup the pipeline, type `cd #{cookbook_name_or_path}`, then run `delivery init`")
|
116
124
|
else
|
@@ -120,7 +128,7 @@ module ChefCLI
|
|
120
128
|
msg("\nWhy not start by writing an InSpec test? Tests for the default recipe are stored at:\n")
|
121
129
|
msg("test/integration/default/default_test.rb")
|
122
130
|
msg("\nIf you'd prefer to dive right in, the default recipe can be found at:")
|
123
|
-
msg("\nrecipes
|
131
|
+
msg("\nrecipes/#{default_recipe_file}\n")
|
124
132
|
end
|
125
133
|
end
|
126
134
|
|
@@ -147,6 +155,7 @@ module ChefCLI
|
|
147
155
|
Generator.add_attr_to_context(:pipeline, pipeline)
|
148
156
|
Generator.add_attr_to_context(:kitchen, kitchen)
|
149
157
|
Generator.add_attr_to_context(:vscode_dir, create_vscode_dir?)
|
158
|
+
Generator.add_attr_to_context(:yaml, yaml)
|
150
159
|
end
|
151
160
|
|
152
161
|
def kitchen
|
@@ -157,6 +166,10 @@ module ChefCLI
|
|
157
166
|
config[:pipeline]
|
158
167
|
end
|
159
168
|
|
169
|
+
def yaml
|
170
|
+
config[:yaml]
|
171
|
+
end
|
172
|
+
|
160
173
|
def policy_name
|
161
174
|
cookbook_name
|
162
175
|
end
|
@@ -26,6 +26,13 @@ module ChefCLI
|
|
26
26
|
|
27
27
|
banner "Usage: #{ChefCLI::Dist::EXEC} generate recipe [path/to/cookbook] NAME [options]"
|
28
28
|
|
29
|
+
option :yaml,
|
30
|
+
short: "-y",
|
31
|
+
long: "--yaml",
|
32
|
+
description: "Generate recipe using YAML configuration format.",
|
33
|
+
boolean: true,
|
34
|
+
default: nil
|
35
|
+
|
29
36
|
options.merge!(SharedGeneratorOptions.options)
|
30
37
|
|
31
38
|
def recipe
|
@@ -117,10 +117,18 @@ end
|
|
117
117
|
# Recipes
|
118
118
|
directory "#{cookbook_dir}/recipes"
|
119
119
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
120
|
+
if context.yaml
|
121
|
+
template "#{cookbook_dir}/recipes/default.yml" do
|
122
|
+
source 'recipe.yml.erb'
|
123
|
+
helpers(ChefCLI::Generator::TemplateHelper)
|
124
|
+
action :create_if_missing
|
125
|
+
end
|
126
|
+
else
|
127
|
+
template "#{cookbook_dir}/recipes/default.rb" do
|
128
|
+
source 'recipe.rb.erb'
|
129
|
+
helpers(ChefCLI::Generator::TemplateHelper)
|
130
|
+
action :create_if_missing
|
131
|
+
end
|
124
132
|
end
|
125
133
|
|
126
134
|
# the same will be done below if workflow was enabled so avoid double work and skip this
|
@@ -1,6 +1,7 @@
|
|
1
1
|
context = ChefCLI::Generator.context
|
2
2
|
cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
|
3
3
|
recipe_path = File.join(cookbook_dir, 'recipes', "#{context.new_file_basename}.rb")
|
4
|
+
recipe_path_yml = File.join(cookbook_dir, 'recipes', "#{context.new_file_basename}.yml")
|
4
5
|
spec_helper_path = File.join(cookbook_dir, 'spec', 'spec_helper.rb')
|
5
6
|
spec_dir = File.join(cookbook_dir, 'spec', 'unit', 'recipes')
|
6
7
|
spec_path = File.join(spec_dir, "#{context.new_file_basename}_spec.rb")
|
@@ -44,7 +45,14 @@ template inspec_path do
|
|
44
45
|
end
|
45
46
|
|
46
47
|
# Recipe
|
47
|
-
|
48
|
-
|
49
|
-
|
48
|
+
if context.yaml
|
49
|
+
template recipe_path_yml do
|
50
|
+
source 'recipe.yml.erb'
|
51
|
+
helpers(ChefCLI::Generator::TemplateHelper)
|
52
|
+
end
|
53
|
+
else
|
54
|
+
template recipe_path do
|
55
|
+
source 'recipe.rb.erb'
|
56
|
+
helpers(ChefCLI::Generator::TemplateHelper)
|
57
|
+
end
|
50
58
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook:: <%= cookbook_name %>
|
3
|
+
# Recipe:: <%= recipe_name %>
|
4
|
+
#
|
5
|
+
<%= license_description('#') %>
|
6
|
+
|
7
|
+
---
|
8
|
+
resources:
|
9
|
+
# Example Syntax
|
10
|
+
# Additional snippets are available using the Chef Infra Extension for Visual Studio Code
|
11
|
+
# - type: file
|
12
|
+
# name: '/path/to/file'
|
13
|
+
# content: 'content'
|
14
|
+
# owner: 'root'
|
15
|
+
# group: 'root'
|
16
|
+
# mode: '0755'
|
17
|
+
# action:
|
18
|
+
# - create
|
data/lib/chef-cli/version.rb
CHANGED
@@ -138,5 +138,12 @@ describe ChefCLI::Command::Generate do
|
|
138
138
|
|
139
139
|
end
|
140
140
|
|
141
|
+
describe "When build-cookbookis given as subcommand" do
|
142
|
+
it "shows deprecation warning when" do
|
143
|
+
result = generate.run(%w{build-cookbook example})
|
144
|
+
expect(result).to eq(1)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
141
148
|
end
|
142
149
|
end
|
@@ -189,201 +189,6 @@ describe ChefCLI::Command::GeneratorCommands::Cookbook do
|
|
189
189
|
end
|
190
190
|
end
|
191
191
|
|
192
|
-
context "when passed workflow option" do
|
193
|
-
|
194
|
-
context "generates a workflow (delivery) cookbook" do
|
195
|
-
|
196
|
-
let(:argv) { %w{new_cookbook --workflow} }
|
197
|
-
|
198
|
-
let(:dot_delivery) { File.join(tempdir, "new_cookbook", ".delivery") }
|
199
|
-
|
200
|
-
before do
|
201
|
-
Dir.chdir(tempdir) do
|
202
|
-
allow(cookbook_generator.chef_runner).to receive(:stdout).and_return(stdout_io)
|
203
|
-
expect(cookbook_generator.run).to eq(0)
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
describe "when passed without --specs subcommand .delivery/project.toml" do
|
208
|
-
|
209
|
-
let(:file) { File.join(tempdir, "new_cookbook", ".delivery", "project.toml") }
|
210
|
-
|
211
|
-
let(:expected_content) do
|
212
|
-
<<~PROJECT_DOT_TOML
|
213
|
-
# Delivery for Local Phases Execution
|
214
|
-
#
|
215
|
-
# This file allows you to execute test phases locally on a workstation or
|
216
|
-
# in a CI pipeline. The delivery-cli will read this file and execute the
|
217
|
-
# command(s) that are configured for each phase. You can customize them
|
218
|
-
# by just modifying the phase key on this file.
|
219
|
-
#
|
220
|
-
# By default these phases are configured for Cookbook Workflow only
|
221
|
-
#
|
222
|
-
|
223
|
-
[local_phases]
|
224
|
-
unit = "echo skipping unit phase."
|
225
|
-
lint = "chef exec cookstyle"
|
226
|
-
# foodcritic has been deprecated in favor of cookstyle so we skip the syntax
|
227
|
-
# phase now.
|
228
|
-
syntax = "echo skipping syntax phase. Use lint phase instead."
|
229
|
-
provision = "chef exec kitchen create"
|
230
|
-
deploy = "chef exec kitchen converge"
|
231
|
-
smoke = "chef exec kitchen verify"
|
232
|
-
# The functional phase is optional, you can define it by uncommenting
|
233
|
-
# the line below and running the command: `delivery local functional`
|
234
|
-
# functional = ""
|
235
|
-
cleanup = "chef exec kitchen destroy"
|
236
|
-
|
237
|
-
# Remote project.toml file
|
238
|
-
#
|
239
|
-
# Instead of the local phases above, you may specify a remote URI location for
|
240
|
-
# the `project.toml` file. This is useful for teams that wish to centrally
|
241
|
-
# manage the behavior of the `delivery local` command across many different
|
242
|
-
# projects.
|
243
|
-
#
|
244
|
-
# remote_file = "https://url/project.toml"
|
245
|
-
PROJECT_DOT_TOML
|
246
|
-
end
|
247
|
-
|
248
|
-
it "exists with default config for Cookbook Workflow" do
|
249
|
-
expect(IO.read(file)).to eq(expected_content)
|
250
|
-
end
|
251
|
-
|
252
|
-
end
|
253
|
-
|
254
|
-
describe "when passed with --specs subcommand .delivery/project.toml" do
|
255
|
-
|
256
|
-
let(:argv) { %w{new_cookbook --workflow --specs} }
|
257
|
-
|
258
|
-
let(:file) { File.join(tempdir, "new_cookbook", ".delivery", "project.toml") }
|
259
|
-
|
260
|
-
let(:expected_content) do
|
261
|
-
<<~PROJECT_DOT_TOML
|
262
|
-
# Delivery for Local Phases Execution
|
263
|
-
#
|
264
|
-
# This file allows you to execute test phases locally on a workstation or
|
265
|
-
# in a CI pipeline. The delivery-cli will read this file and execute the
|
266
|
-
# command(s) that are configured for each phase. You can customize them
|
267
|
-
# by just modifying the phase key on this file.
|
268
|
-
#
|
269
|
-
# By default these phases are configured for Cookbook Workflow only
|
270
|
-
#
|
271
|
-
|
272
|
-
[local_phases]
|
273
|
-
unit = "chef exec rspec spec/"
|
274
|
-
lint = "chef exec cookstyle"
|
275
|
-
# foodcritic has been deprecated in favor of cookstyle so we skip the syntax
|
276
|
-
# phase now.
|
277
|
-
syntax = "echo skipping syntax phase. Use lint phase instead."
|
278
|
-
provision = "chef exec kitchen create"
|
279
|
-
deploy = "chef exec kitchen converge"
|
280
|
-
smoke = "chef exec kitchen verify"
|
281
|
-
# The functional phase is optional, you can define it by uncommenting
|
282
|
-
# the line below and running the command: `delivery local functional`
|
283
|
-
# functional = ""
|
284
|
-
cleanup = "chef exec kitchen destroy"
|
285
|
-
|
286
|
-
# Remote project.toml file
|
287
|
-
#
|
288
|
-
# Instead of the local phases above, you may specify a remote URI location for
|
289
|
-
# the `project.toml` file. This is useful for teams that wish to centrally
|
290
|
-
# manage the behavior of the `delivery local` command across many different
|
291
|
-
# projects.
|
292
|
-
#
|
293
|
-
# remote_file = "https://url/project.toml"
|
294
|
-
PROJECT_DOT_TOML
|
295
|
-
end
|
296
|
-
|
297
|
-
it "exists with default config for Cookbook Workflow" do
|
298
|
-
expect(IO.read(file)).to eq(expected_content)
|
299
|
-
end
|
300
|
-
|
301
|
-
end
|
302
|
-
|
303
|
-
end
|
304
|
-
|
305
|
-
context "when no delivery CLI configuration is present" do
|
306
|
-
|
307
|
-
let(:argv) { %w{new_cookbook --workflow} }
|
308
|
-
|
309
|
-
it "detects no delivery config" do
|
310
|
-
Dir.chdir(tempdir) do
|
311
|
-
expect(cookbook_generator.have_delivery_config?).to be(false)
|
312
|
-
end
|
313
|
-
end
|
314
|
-
|
315
|
-
it "emits concise output" do
|
316
|
-
Dir.chdir(tempdir) do
|
317
|
-
allow(cookbook_generator.chef_runner).to receive(:stdout).and_return(stdout_io)
|
318
|
-
expect(cookbook_generator.run).to eq(0)
|
319
|
-
end
|
320
|
-
|
321
|
-
expected = <<~OUTPUT
|
322
|
-
Generating cookbook new_cookbook
|
323
|
-
- Ensuring correct cookbook content
|
324
|
-
- Committing cookbook files to git
|
325
|
-
|
326
|
-
#{non_delivery_breadcrumb}
|
327
|
-
OUTPUT
|
328
|
-
|
329
|
-
actual = stdout_io.string
|
330
|
-
|
331
|
-
# the formatter will add escape sequences to turn off any colors
|
332
|
-
actual.gsub!("\e[0m", "")
|
333
|
-
expect(actual).to eq(expected)
|
334
|
-
end
|
335
|
-
end
|
336
|
-
|
337
|
-
context "when a delivery CLI config is present" do
|
338
|
-
|
339
|
-
# Setup a situation like this:
|
340
|
-
# there is a dir for the delivery organization with the
|
341
|
-
# `.delivery/cli.toml` in it. Inside that is another dir (maybe IRL this
|
342
|
-
# would be "cookbooks"), then we create the cookbook inside that.
|
343
|
-
|
344
|
-
let(:argv) { %w{new_cookbook --workflow} }
|
345
|
-
|
346
|
-
let(:tempdir_subdir) { File.join(tempdir, "subdirectory") }
|
347
|
-
|
348
|
-
let(:dot_delivery_dir) { File.join(tempdir, ".delivery") }
|
349
|
-
|
350
|
-
let(:dot_delivery_cli_toml) { File.join(dot_delivery_dir, "cli.toml") }
|
351
|
-
|
352
|
-
before do
|
353
|
-
Dir.mkdir(tempdir_subdir)
|
354
|
-
Dir.mkdir(dot_delivery_dir)
|
355
|
-
FileUtils.touch(dot_delivery_cli_toml)
|
356
|
-
end
|
357
|
-
|
358
|
-
it "detects the delivery config" do
|
359
|
-
Dir.chdir(tempdir_subdir) do
|
360
|
-
expect(cookbook_generator.have_delivery_config?).to be(true)
|
361
|
-
end
|
362
|
-
end
|
363
|
-
|
364
|
-
it "emits concise output" do
|
365
|
-
Dir.chdir(tempdir) do
|
366
|
-
allow(cookbook_generator.chef_runner).to receive(:stdout).and_return(stdout_io)
|
367
|
-
expect(cookbook_generator.run).to eq(0)
|
368
|
-
end
|
369
|
-
|
370
|
-
expected = <<~OUTPUT
|
371
|
-
Generating cookbook new_cookbook
|
372
|
-
- Ensuring correct cookbook content
|
373
|
-
- Committing cookbook files to git
|
374
|
-
|
375
|
-
Your cookbook is ready. To setup the pipeline, type `cd new_cookbook`, then run `delivery init`
|
376
|
-
OUTPUT
|
377
|
-
|
378
|
-
actual = stdout_io.string
|
379
|
-
|
380
|
-
# the formatter will add escape sequences to turn off any colors
|
381
|
-
actual.gsub!("\e[0m", "")
|
382
|
-
expect(actual).to eq(expected)
|
383
|
-
end
|
384
|
-
end
|
385
|
-
end
|
386
|
-
|
387
192
|
context "when given the specs flag" do
|
388
193
|
|
389
194
|
let(:argv) { %w{ new_cookbook --specs } }
|
@@ -615,6 +420,55 @@ describe ChefCLI::Command::GeneratorCommands::Cookbook do
|
|
615
420
|
|
616
421
|
end
|
617
422
|
|
423
|
+
context "when YAML recipe flag is passed" do
|
424
|
+
|
425
|
+
let(:argv) { %w{new_cookbook --yaml} }
|
426
|
+
|
427
|
+
describe "recipes/default.yml" do
|
428
|
+
let(:file) { File.join(tempdir, "new_cookbook", "recipes", "default.yml") }
|
429
|
+
|
430
|
+
let(:expected_content_header) do
|
431
|
+
<<~DEFAULT_YML_HEADER
|
432
|
+
#
|
433
|
+
# Cookbook:: new_cookbook
|
434
|
+
# Recipe:: default
|
435
|
+
#
|
436
|
+
DEFAULT_YML_HEADER
|
437
|
+
end
|
438
|
+
|
439
|
+
let(:expected_content) do
|
440
|
+
<<~DEFAULT_YML_CONTENT
|
441
|
+
---
|
442
|
+
resources:
|
443
|
+
# Example Syntax
|
444
|
+
# Additional snippets are available using the Chef Infra Extension for Visual Studio Code
|
445
|
+
# - type: file
|
446
|
+
# name: '/path/to/file'
|
447
|
+
# content: 'content'
|
448
|
+
# owner: 'root'
|
449
|
+
# group: 'root'
|
450
|
+
# mode: '0755'
|
451
|
+
# action:
|
452
|
+
# - create
|
453
|
+
DEFAULT_YML_CONTENT
|
454
|
+
end
|
455
|
+
|
456
|
+
before do
|
457
|
+
Dir.chdir(tempdir) do
|
458
|
+
allow(cookbook_generator.chef_runner).to receive(:stdout).and_return(stdout_io)
|
459
|
+
expect(cookbook_generator.run).to eq(0)
|
460
|
+
end
|
461
|
+
end
|
462
|
+
|
463
|
+
it "has a default.yml file with template contents" do
|
464
|
+
expect(IO.read(file)).to match(expected_content_header)
|
465
|
+
expect(IO.read(file)).to match(expected_content)
|
466
|
+
end
|
467
|
+
|
468
|
+
end
|
469
|
+
|
470
|
+
end
|
471
|
+
|
618
472
|
context "when configured for Berkshelf" do
|
619
473
|
|
620
474
|
let(:argv) { %w{new_cookbook --berks} }
|