chef-dk 3.3.23 → 3.4.38

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -7
  3. data/Gemfile.lock +91 -82
  4. data/lib/chef-dk/cli.rb +13 -13
  5. data/lib/chef-dk/command/base.rb +8 -8
  6. data/lib/chef-dk/command/clean_policy_cookbooks.rb +10 -10
  7. data/lib/chef-dk/command/clean_policy_revisions.rb +9 -9
  8. data/lib/chef-dk/command/delete_policy.rb +9 -9
  9. data/lib/chef-dk/command/delete_policy_group.rb +9 -9
  10. data/lib/chef-dk/command/diff.rb +35 -35
  11. data/lib/chef-dk/command/export.rb +11 -11
  12. data/lib/chef-dk/command/generate.rb +3 -3
  13. data/lib/chef-dk/command/generator_commands.rb +24 -24
  14. data/lib/chef-dk/command/generator_commands/build_cookbook.rb +3 -3
  15. data/lib/chef-dk/command/generator_commands/chef_exts/generator_desc_resource.rb +1 -1
  16. data/lib/chef-dk/command/generator_commands/cookbook.rb +3 -3
  17. data/lib/chef-dk/command/generator_commands/cookbook_file.rb +3 -3
  18. data/lib/chef-dk/command/generator_commands/generator_generator.rb +5 -5
  19. data/lib/chef-dk/command/generator_commands/template.rb +3 -3
  20. data/lib/chef-dk/command/install.rb +11 -11
  21. data/lib/chef-dk/command/provision.rb +32 -32
  22. data/lib/chef-dk/command/push.rb +9 -9
  23. data/lib/chef-dk/command/push_archive.rb +9 -9
  24. data/lib/chef-dk/command/shell_init.rb +21 -21
  25. data/lib/chef-dk/command/show_policy.rb +11 -11
  26. data/lib/chef-dk/command/undelete.rb +17 -17
  27. data/lib/chef-dk/command/update.rb +12 -12
  28. data/lib/chef-dk/command/verify.rb +63 -63
  29. data/lib/chef-dk/component_test.rb +3 -3
  30. data/lib/chef-dk/exceptions.rb +5 -5
  31. data/lib/chef-dk/generator.rb +61 -61
  32. data/lib/chef-dk/helpers.rb +1 -1
  33. data/lib/chef-dk/policyfile/cookbook_location_specification.rb +1 -1
  34. data/lib/chef-dk/policyfile/cookbook_locks.rb +1 -1
  35. data/lib/chef-dk/policyfile/git_lock_fetcher.rb +7 -7
  36. data/lib/chef-dk/policyfile/policyfile_location_specification.rb +1 -1
  37. data/lib/chef-dk/policyfile/uploader.rb +4 -4
  38. data/lib/chef-dk/policyfile_compiler.rb +1 -1
  39. data/lib/chef-dk/policyfile_services/export_repo.rb +49 -49
  40. data/lib/chef-dk/policyfile_services/install.rb +3 -3
  41. data/lib/chef-dk/policyfile_services/push_archive.rb +5 -5
  42. data/lib/chef-dk/policyfile_services/rm_policy_group.rb +1 -1
  43. data/lib/chef-dk/policyfile_services/update_attributes.rb +2 -2
  44. data/lib/chef-dk/service_exception_inspectors/http.rb +9 -9
  45. data/lib/chef-dk/skeletons/code_generator/recipes/recipe.rb +6 -6
  46. data/lib/chef-dk/version.rb +1 -1
  47. data/lib/kitchen/provisioner/policyfile_zero.rb +9 -9
  48. data/omnibus_overrides.rb +1 -1
  49. data/spec/spec_helper.rb +3 -3
  50. data/spec/unit/cli_spec.rb +9 -9
  51. data/spec/unit/command/base_spec.rb +25 -25
  52. data/spec/unit/command/clean_policy_cookbooks_spec.rb +6 -6
  53. data/spec/unit/command/clean_policy_revisions_spec.rb +6 -6
  54. data/spec/unit/command/delete_policy_group_spec.rb +6 -6
  55. data/spec/unit/command/delete_policy_spec.rb +6 -6
  56. data/spec/unit/command/export_spec.rb +10 -10
  57. data/spec/unit/command/generate_spec.rb +5 -5
  58. data/spec/unit/command/generator_commands/build_cookbook_spec.rb +15 -15
  59. data/spec/unit/command/generator_commands/cookbook_spec.rb +174 -174
  60. data/spec/unit/command/generator_commands/generator_generator_spec.rb +5 -5
  61. data/spec/unit/command/generator_commands/policyfile_spec.rb +15 -15
  62. data/spec/unit/command/generator_commands/repo_spec.rb +16 -16
  63. data/spec/unit/command/install_spec.rb +15 -15
  64. data/spec/unit/command/provision_spec.rb +25 -25
  65. data/spec/unit/command/push_spec.rb +12 -12
  66. data/spec/unit/command/shell_init_spec.rb +59 -59
  67. data/spec/unit/command/show_policy_spec.rb +6 -6
  68. data/spec/unit/command/undelete_spec.rb +6 -6
  69. data/spec/unit/command/update_spec.rb +30 -30
  70. data/spec/unit/fixtures/command/cli_test_command.rb +1 -1
  71. data/spec/unit/policyfile/chef_server_lock_fetcher_spec.rb +41 -41
  72. data/spec/unit/policyfile/comparison_base_spec.rb +38 -38
  73. data/spec/unit/policyfile/cookbook_locks_spec.rb +3 -3
  74. data/spec/unit/policyfile/differ_spec.rb +361 -361
  75. data/spec/unit/policyfile/git_lock_fetcher_spec.rb +34 -34
  76. data/spec/unit/policyfile/included_policies_cookbook_source_spec.rb +6 -6
  77. data/spec/unit/policyfile/local_lock_fetcher_spec.rb +35 -35
  78. data/spec/unit/policyfile/lock_applier_spec.rb +6 -6
  79. data/spec/unit/policyfile/reports/upload_spec.rb +5 -5
  80. data/spec/unit/policyfile/uploader_spec.rb +27 -27
  81. data/spec/unit/policyfile_demands_spec.rb +84 -84
  82. data/spec/unit/policyfile_evaluation_spec.rb +14 -14
  83. data/spec/unit/policyfile_includes_spec.rb +1 -1
  84. data/spec/unit/policyfile_install_with_includes_spec.rb +3 -3
  85. data/spec/unit/policyfile_lock_build_spec.rb +58 -58
  86. data/spec/unit/policyfile_lock_validation_spec.rb +108 -108
  87. data/spec/unit/policyfile_services/clean_policies_spec.rb +12 -12
  88. data/spec/unit/policyfile_services/clean_policy_cookbooks_spec.rb +9 -9
  89. data/spec/unit/policyfile_services/export_repo_spec.rb +64 -64
  90. data/spec/unit/policyfile_services/install_spec.rb +4 -4
  91. data/spec/unit/policyfile_services/push_archive_spec.rb +41 -41
  92. data/spec/unit/policyfile_services/push_spec.rb +38 -38
  93. data/spec/unit/policyfile_services/rm_policy_group_spec.rb +12 -12
  94. data/spec/unit/policyfile_services/rm_policy_spec.rb +6 -6
  95. data/spec/unit/policyfile_services/show_policy_spec.rb +161 -161
  96. data/spec/unit/policyfile_services/undelete_spec.rb +13 -13
  97. data/spec/unit/policyfile_services/update_attributes_spec.rb +6 -6
  98. data/spec/unit/policyfile_services/update_spec.rb +7 -7
  99. data/spec/unit/service_exception_inspectors/http_spec.rb +12 -12
  100. metadata +2 -2
@@ -180,11 +180,11 @@ describe ChefDK::Command::GeneratorCommands::GeneratorGenerator do
180
180
 
181
181
  metadata_path = File.join(target_dir, "metadata.rb")
182
182
  metadata_content = IO.read(metadata_path)
183
- expected_metadata = <<-METADATA
184
- name 'my_cool_generator'
185
- description 'Custom code generator cookbook for use with ChefDK'
186
- long_description 'Custom code generator cookbook for use with ChefDK'
187
- version '0.1.0'
183
+ expected_metadata = <<~METADATA
184
+ name 'my_cool_generator'
185
+ description 'Custom code generator cookbook for use with ChefDK'
186
+ long_description 'Custom code generator cookbook for use with ChefDK'
187
+ version '0.1.0'
188
188
 
189
189
  METADATA
190
190
  expect(metadata_content).to eq(expected_metadata)
@@ -114,26 +114,26 @@ describe ChefDK::Command::GeneratorCommands::Policyfile do
114
114
  let(:policies_dir) { File.join(tempdir, "policyfiles") }
115
115
 
116
116
  let(:expected_policyfile_content) do
117
- <<-POLICYFILE_RB
118
- # Policyfile.rb - Describe how you want Chef to build your system.
119
- #
120
- # For more information on the Policyfile feature, visit
121
- # https://docs.chef.io/policyfile.html
117
+ <<~POLICYFILE_RB
118
+ # Policyfile.rb - Describe how you want Chef to build your system.
119
+ #
120
+ # For more information on the Policyfile feature, visit
121
+ # https://docs.chef.io/policyfile.html
122
122
 
123
- # A name that describes what the system you're building with Chef does.
124
- name 'my-app-frontend'
123
+ # A name that describes what the system you're building with Chef does.
124
+ name 'my-app-frontend'
125
125
 
126
- # This lets you source cookbooks from your chef-repo.
127
- default_source :chef_repo, '../'
126
+ # This lets you source cookbooks from your chef-repo.
127
+ default_source :chef_repo, '../'
128
128
 
129
- # Where to find external cookbooks:
130
- default_source :supermarket
129
+ # Where to find external cookbooks:
130
+ default_source :supermarket
131
131
 
132
- # run_list: chef-client will run these recipes in the order specified.
133
- run_list 'my-app-frontend::default'
132
+ # run_list: chef-client will run these recipes in the order specified.
133
+ run_list 'my-app-frontend::default'
134
134
 
135
- # Specify a custom source for a single cookbook:
136
- # cookbook 'example_cookbook', path: '../cookbooks/example_cookbook'
135
+ # Specify a custom source for a single cookbook:
136
+ # cookbook 'example_cookbook', path: '../cookbooks/example_cookbook'
137
137
  POLICYFILE_RB
138
138
  end
139
139
 
@@ -296,10 +296,10 @@ describe ChefDK::Command::GeneratorCommands::Repo do
296
296
  let(:file) { "policyfiles/README.md" }
297
297
 
298
298
  let(:expected_content) do
299
- <<-README
300
- Create policyfiles here. When using a chef-repo, give your policyfiles
301
- the same filename as the name set in the policyfile itself, and use the
302
- `.rb` file extension.
299
+ <<~README
300
+ Create policyfiles here. When using a chef-repo, give your policyfiles
301
+ the same filename as the name set in the policyfile itself, and use the
302
+ `.rb` file extension.
303
303
  README
304
304
  end
305
305
 
@@ -324,16 +324,16 @@ README
324
324
  let(:file) { "roles/README.md" }
325
325
 
326
326
  let(:expected_content) do
327
- <<-README
328
- Create roles here, in either the Role Ruby DSL (.rb) or JSON (.json) files. To install roles on the server, use knife.
327
+ <<~README
328
+ Create roles here, in either the Role Ruby DSL (.rb) or JSON (.json) files. To install roles on the server, use knife.
329
329
 
330
- For example, in this directory you'll find an example role file called `example.json` which can be uploaded to the Chef Server:
330
+ For example, in this directory you'll find an example role file called `example.json` which can be uploaded to the Chef Server:
331
331
 
332
- knife role from file roles/example.json
332
+ knife role from file roles/example.json
333
333
 
334
- For more information on roles, see the Chef wiki page:
334
+ For more information on roles, see the Chef wiki page:
335
335
 
336
- https://docs.chef.io/roles.html
336
+ https://docs.chef.io/roles.html
337
337
  README
338
338
  end
339
339
 
@@ -348,16 +348,16 @@ README
348
348
  let(:file) { "environments/README.md" }
349
349
 
350
350
  let(:expected_content) do
351
- <<-README
352
- Create environments here, in either the Role Ruby DSL (.rb) or JSON (.json) files. To install environments on the server, use knife.
351
+ <<~README
352
+ Create environments here, in either the Role Ruby DSL (.rb) or JSON (.json) files. To install environments on the server, use knife.
353
353
 
354
- For example, in this directory you'll find an example environment file called `example.json` which can be uploaded to the Chef Server:
354
+ For example, in this directory you'll find an example environment file called `example.json` which can be uploaded to the Chef Server:
355
355
 
356
- knife environment from file environments/example.json
356
+ knife environment from file environments/example.json
357
357
 
358
- For more information on environments, see the Chef wiki page:
358
+ For more information on environments, see the Chef wiki page:
359
359
 
360
- https://docs.chef.io/environments.html
360
+ https://docs.chef.io/environments.html
361
361
  README
362
362
  end
363
363
 
@@ -61,9 +61,9 @@ describe ChefDK::Command::Install do
61
61
  end
62
62
 
63
63
  it "loads the config from the given path" do
64
- expect(Chef::WorkstationConfigLoader).to receive(:new).
65
- with("~/.chef/alternate_config.rb").
66
- and_return(chef_config_loader)
64
+ expect(Chef::WorkstationConfigLoader).to receive(:new)
65
+ .with("~/.chef/alternate_config.rb")
66
+ .and_return(chef_config_loader)
67
67
  expect(chef_config_loader).to receive(:load)
68
68
  expect(command.chef_config).to eq(Chef::Config)
69
69
  end
@@ -77,9 +77,9 @@ describe ChefDK::Command::Install do
77
77
  end
78
78
 
79
79
  it "creates the installer service with a `nil` policyfile path" do
80
- expect(ChefDK::PolicyfileServices::Install).to receive(:new).
81
- with(hash_including(policyfile: nil, ui: command.ui, root_dir: Dir.pwd, config: Chef::Config)).
82
- and_return(install_service)
80
+ expect(ChefDK::PolicyfileServices::Install).to receive(:new)
81
+ .with(hash_including(policyfile: nil, ui: command.ui, root_dir: Dir.pwd, config: Chef::Config))
82
+ .and_return(install_service)
83
83
  expect(command.installer).to eq(install_service)
84
84
  end
85
85
 
@@ -94,9 +94,9 @@ describe ChefDK::Command::Install do
94
94
  end
95
95
 
96
96
  it "creates the installer service with the specified policyfile path" do
97
- expect(ChefDK::PolicyfileServices::Install).to receive(:new).
98
- with(hash_including(policyfile: "MyPolicy.rb", ui: command.ui, root_dir: Dir.pwd, config: Chef::Config)).
99
- and_return(install_service)
97
+ expect(ChefDK::PolicyfileServices::Install).to receive(:new)
98
+ .with(hash_including(policyfile: "MyPolicy.rb", ui: command.ui, root_dir: Dir.pwd, config: Chef::Config))
99
+ .and_return(install_service)
100
100
  expect(command.installer).to eq(install_service)
101
101
  end
102
102
 
@@ -144,9 +144,9 @@ describe ChefDK::Command::Install do
144
144
  end
145
145
 
146
146
  it "displays the exception and cause" do
147
- expected_error_text = <<-E
148
- Error: install failed
149
- Reason: (StandardError) some operation failed
147
+ expected_error_text = <<~E
148
+ Error: install failed
149
+ Reason: (StandardError) some operation failed
150
150
 
151
151
  E
152
152
 
@@ -159,9 +159,9 @@ E
159
159
  let(:params) { ["-D"] }
160
160
 
161
161
  it "displays the exception and cause with backtrace" do
162
- expected_error_text = <<-E
163
- Error: install failed
164
- Reason: (StandardError) some operation failed
162
+ expected_error_text = <<~E
163
+ Error: install failed
164
+ Reason: (StandardError) some operation failed
165
165
 
166
166
 
167
167
  E
@@ -284,9 +284,9 @@ describe ChefDK::Command::Provision do
284
284
  end
285
285
 
286
286
  it "generates chef config with no policyfile options" do
287
- expected_config = <<-CONFIG
288
- # SSL Settings:
289
- ssl_verify_mode :verify_peer
287
+ expected_config = <<~CONFIG
288
+ # SSL Settings:
289
+ ssl_verify_mode :verify_peer
290
290
 
291
291
  CONFIG
292
292
  expect(context.chef_config).to eq(expected_config)
@@ -303,9 +303,9 @@ CONFIG
303
303
  before do
304
304
  allow(chef_config_loader).to receive(:load)
305
305
 
306
- allow(ChefDK::PolicyfileServices::Push).to receive(:new).
307
- with(policyfile: given_policyfile_path, ui: ui, policy_group: given_policy_group, config: chef_config, root_dir: Dir.pwd).
308
- and_return(push_service)
306
+ allow(ChefDK::PolicyfileServices::Push).to receive(:new)
307
+ .with(policyfile: given_policyfile_path, ui: ui, policy_group: given_policy_group, config: chef_config, root_dir: Dir.pwd)
308
+ .and_return(push_service)
309
309
 
310
310
  allow(push_service).to receive(:policy_data).and_return(policy_data)
311
311
 
@@ -358,16 +358,16 @@ CONFIG
358
358
  end
359
359
 
360
360
  it "generates chef config with policyfile options" do
361
- expected_config = <<-CONFIG
362
- # SSL Settings:
363
- ssl_verify_mode :verify_peer
361
+ expected_config = <<~CONFIG
362
+ # SSL Settings:
363
+ ssl_verify_mode :verify_peer
364
364
 
365
- # Policyfile Settings:
366
- use_policyfile true
367
- policy_document_native_api true
365
+ # Policyfile Settings:
366
+ use_policyfile true
367
+ policy_document_native_api true
368
368
 
369
- policy_group "some-policy-group"
370
- policy_name "myapp"
369
+ policy_group "some-policy-group"
370
+ policy_name "myapp"
371
371
 
372
372
  CONFIG
373
373
  expect(context.chef_config).to eq(expected_config)
@@ -405,16 +405,16 @@ CONFIG
405
405
  end
406
406
 
407
407
  it "generates chef config with policyfile options" do
408
- expected_config = <<-CONFIG
409
- # SSL Settings:
410
- ssl_verify_mode :verify_peer
408
+ expected_config = <<~CONFIG
409
+ # SSL Settings:
410
+ ssl_verify_mode :verify_peer
411
411
 
412
- # Policyfile Settings:
413
- use_policyfile true
414
- policy_document_native_api true
412
+ # Policyfile Settings:
413
+ use_policyfile true
414
+ policy_document_native_api true
415
415
 
416
- policy_group "some-policy-group"
417
- policy_name "myapp"
416
+ policy_group "some-policy-group"
417
+ policy_name "myapp"
418
418
 
419
419
  CONFIG
420
420
  expect(context.chef_config).to eq(expected_config)
@@ -493,9 +493,9 @@ CONFIG
493
493
  end
494
494
 
495
495
  it "prints an error and exits non-zero" do
496
- expected_output = <<-E
497
- Error: push failed
498
- Reason: (StandardError) some operation failed
496
+ expected_output = <<~E
497
+ Error: push failed
498
+ Reason: (StandardError) some operation failed
499
499
 
500
500
  E
501
501
  expect(command.run(params)).to eq(1)
@@ -65,9 +65,9 @@ describe ChefDK::Command::Push do
65
65
  end
66
66
 
67
67
  it "configures the Push service" do
68
- expect(ChefDK::PolicyfileServices::Push).to receive(:new).
69
- with(policyfile: nil, ui: command.ui, policy_group: policy_group, config: chef_config, root_dir: Dir.pwd).
70
- and_return(push_service)
68
+ expect(ChefDK::PolicyfileServices::Push).to receive(:new)
69
+ .with(policyfile: nil, ui: command.ui, policy_group: policy_group, config: chef_config, root_dir: Dir.pwd)
70
+ .and_return(push_service)
71
71
  expect(command.push).to eq(push_service)
72
72
  end
73
73
 
@@ -76,9 +76,9 @@ describe ChefDK::Command::Push do
76
76
  let(:params) { [policy_group, "MyPolicy.rb"] }
77
77
 
78
78
  it "configures the Push service with the given Policyfile" do
79
- expect(ChefDK::PolicyfileServices::Push).to receive(:new).
80
- with(policyfile: "MyPolicy.rb", ui: command.ui, policy_group: policy_group, config: chef_config, root_dir: Dir.pwd).
81
- and_return(push_service)
79
+ expect(ChefDK::PolicyfileServices::Push).to receive(:new)
80
+ .with(policyfile: "MyPolicy.rb", ui: command.ui, policy_group: policy_group, config: chef_config, root_dir: Dir.pwd)
81
+ .and_return(push_service)
82
82
  expect(command.push).to eq(push_service)
83
83
  end
84
84
 
@@ -158,9 +158,9 @@ describe ChefDK::Command::Push do
158
158
  it "describes the error" do
159
159
  command.run(params)
160
160
 
161
- expected_output = <<-E
162
- Error: push failed
163
- Reason: (StandardError) some operation failed
161
+ expected_output = <<~E
162
+ Error: push failed
163
+ Reason: (StandardError) some operation failed
164
164
 
165
165
  E
166
166
 
@@ -177,9 +177,9 @@ E
177
177
 
178
178
  command.run(params)
179
179
 
180
- expected_output = <<-E
181
- Error: push failed
182
- Reason: (StandardError) some operation failed
180
+ expected_output = <<~E
181
+ Error: push failed
182
+ Reason: (StandardError) some operation failed
183
183
 
184
184
 
185
185
  E
@@ -60,7 +60,7 @@ describe ChefDK::Command::ShellInit do
60
60
  expect(stdout_io.string).to include(expected_environment_commands)
61
61
  end
62
62
 
63
- it "does not emit any empty lines", :if => %w{powershell posh}.include?(shell) do
63
+ it "does not emit any empty lines", if: %w{powershell posh}.include?(shell) do
64
64
  command_instance.run(argv)
65
65
  stdout_io.string.each_line do |s|
66
66
  expect(s.strip).not_to be_empty
@@ -86,7 +86,7 @@ describe ChefDK::Command::ShellInit do
86
86
  expect(stdout_io.string).to include(expected_environment_commands)
87
87
  end
88
88
 
89
- it "does not emit any empty lines", :if => %w{powershell posh}.include?(shell) do
89
+ it "does not emit any empty lines", if: %w{powershell posh}.include?(shell) do
90
90
  command_instance.run(argv)
91
91
  stdout_io.string.each_line do |s|
92
92
  expect(s.strip).not_to be_empty
@@ -101,11 +101,11 @@ describe ChefDK::Command::ShellInit do
101
101
  end
102
102
 
103
103
  let(:expected_environment_commands) do
104
- <<-EOH
105
- export PATH="#{expected_path}"
106
- export GEM_ROOT="#{expected_gem_root}"
107
- export GEM_HOME="#{expected_gem_home}"
108
- export GEM_PATH="#{expected_gem_path}"
104
+ <<~EOH
105
+ export PATH="#{expected_path}"
106
+ export GEM_ROOT="#{expected_gem_root}"
107
+ export GEM_HOME="#{expected_gem_home}"
108
+ export GEM_PATH="#{expected_gem_path}"
109
109
  EOH
110
110
  end
111
111
  include_context "shell init script", shell
@@ -117,11 +117,11 @@ EOH
117
117
  end
118
118
 
119
119
  let(:expected_environment_commands) do
120
- <<-EOH
121
- $env:PATH="#{expected_path}"
122
- $env:GEM_ROOT="#{expected_gem_root}"
123
- $env:GEM_HOME="#{expected_gem_home}"
124
- $env:GEM_PATH="#{expected_gem_path}"
120
+ <<~EOH
121
+ $env:PATH="#{expected_path}"
122
+ $env:GEM_ROOT="#{expected_gem_root}"
123
+ $env:GEM_HOME="#{expected_gem_home}"
124
+ $env:GEM_PATH="#{expected_gem_path}"
125
125
  EOH
126
126
  end
127
127
  include_context "shell init script", shell
@@ -151,20 +151,20 @@ EOH
151
151
  let(:argv) { [ "bash" ] }
152
152
 
153
153
  let(:expected_completion_function) do
154
- <<-END_COMPLETION
155
- _chef_comp() {
156
- local COMMANDS="exec env gem generate"
157
- COMPREPLY=($(compgen -W "$COMMANDS" -- ${COMP_WORDS[COMP_CWORD]} ))
158
- }
159
- complete -F _chef_comp chef
154
+ <<~END_COMPLETION
155
+ _chef_comp() {
156
+ local COMMANDS="exec env gem generate"
157
+ COMPREPLY=($(compgen -W "$COMMANDS" -- ${COMP_WORDS[COMP_CWORD]} ))
158
+ }
159
+ complete -F _chef_comp chef
160
160
  END_COMPLETION
161
161
  end
162
162
 
163
163
  before do
164
164
  # Stub this or else we'd have to update the test every time a new command
165
165
  # is added.
166
- allow(command_instance.shell_completion_template_context).to receive(:commands).
167
- and_return(command_descriptions)
166
+ allow(command_instance.shell_completion_template_context).to receive(:commands)
167
+ .and_return(command_descriptions)
168
168
 
169
169
  allow(command_instance).to receive(:omnibus_embedded_bin_dir).and_return(omnibus_embedded_bin_dir)
170
170
  allow(command_instance).to receive(:omnibus_bin_dir).and_return(omnibus_bin_dir)
@@ -199,28 +199,28 @@ END_COMPLETION
199
199
  let(:argv) { [ "zsh" ] }
200
200
 
201
201
  let(:expected_completion_function) do
202
- <<-END_COMPLETION
203
- function _chef() {
202
+ <<~END_COMPLETION
203
+ function _chef() {
204
204
 
205
- local -a _1st_arguments
206
- _1st_arguments=(
207
- 'exec:Runs the command in context of the embedded ruby'
208
- 'env:Prints environment variables used by ChefDK'
209
- 'gem:Runs the `gem` command in context of the embedded ruby'
210
- 'generate:Generate a new app, cookbook, or component'
211
- )
205
+ local -a _1st_arguments
206
+ _1st_arguments=(
207
+ 'exec:Runs the command in context of the embedded ruby'
208
+ 'env:Prints environment variables used by ChefDK'
209
+ 'gem:Runs the `gem` command in context of the embedded ruby'
210
+ 'generate:Generate a new app, cookbook, or component'
211
+ )
212
212
 
213
- _arguments \\
214
- '(-v --version)'{-v,--version}'[version information]' \\
215
- '*:: :->subcmds' && return 0
213
+ _arguments \\
214
+ '(-v --version)'{-v,--version}'[version information]' \\
215
+ '*:: :->subcmds' && return 0
216
216
 
217
- if (( CURRENT == 1 )); then
218
- _describe -t commands "chef subcommand" _1st_arguments
219
- return
220
- fi
221
- }
217
+ if (( CURRENT == 1 )); then
218
+ _describe -t commands "chef subcommand" _1st_arguments
219
+ return
220
+ fi
221
+ }
222
222
 
223
- compdef _chef chef
223
+ compdef _chef chef
224
224
 
225
225
  END_COMPLETION
226
226
  end
@@ -228,8 +228,8 @@ compdef _chef chef
228
228
  before do
229
229
  # Stub this or else we'd have to update the test every time a new command
230
230
  # is added.
231
- allow(command_instance.shell_completion_template_context).to receive(:commands).
232
- and_return(command_descriptions)
231
+ allow(command_instance.shell_completion_template_context).to receive(:commands)
232
+ .and_return(command_descriptions)
233
233
 
234
234
  allow(command_instance).to receive(:omnibus_embedded_bin_dir).and_return(omnibus_embedded_bin_dir)
235
235
  allow(command_instance).to receive(:omnibus_bin_dir).and_return(omnibus_bin_dir)
@@ -248,11 +248,11 @@ compdef _chef chef
248
248
  end
249
249
  let(:expected_path) { [omnibus_bin_dir, user_bin_dir, omnibus_embedded_bin_dir, ENV["PATH"], git_bin_dir].join(":").split(":").join('" "') }
250
250
  let(:expected_environment_commands) do
251
- <<-EOH
252
- set -gx PATH "#{expected_path}" 2>/dev/null;
253
- set -gx GEM_ROOT "#{expected_gem_root}";
254
- set -gx GEM_HOME "#{expected_gem_home}";
255
- set -gx GEM_PATH "#{expected_gem_path}";
251
+ <<~EOH
252
+ set -gx PATH "#{expected_path}" 2>/dev/null;
253
+ set -gx GEM_ROOT "#{expected_gem_root}";
254
+ set -gx GEM_HOME "#{expected_gem_home}";
255
+ set -gx GEM_PATH "#{expected_gem_path}";
256
256
  EOH
257
257
  end
258
258
 
@@ -275,26 +275,26 @@ EOH
275
275
  let(:argv) { [ "fish" ] }
276
276
 
277
277
  let(:expected_completion_function) do
278
- <<-END_COMPLETION
279
- # Fish Shell command-line completions for ChefDK
280
-
281
- function __fish_chef_no_command --description 'Test if chef has yet to be given the main command'
282
- set -l cmd (commandline -opc)
283
- test (count $cmd) -eq 1
284
- end
285
-
286
- complete -c chef -f -n '__fish_chef_no_command' -a exec -d "Runs the command in context of the embedded ruby"
287
- complete -c chef -f -n '__fish_chef_no_command' -a env -d "Prints environment variables used by ChefDK"
288
- complete -c chef -f -n '__fish_chef_no_command' -a gem -d "Runs the `gem` command in context of the embedded ruby"
289
- complete -c chef -f -n '__fish_chef_no_command' -a generate -d "Generate a new app, cookbook, or component"
278
+ <<~END_COMPLETION
279
+ # Fish Shell command-line completions for ChefDK
280
+
281
+ function __fish_chef_no_command --description 'Test if chef has yet to be given the main command'
282
+ set -l cmd (commandline -opc)
283
+ test (count $cmd) -eq 1
284
+ end
285
+
286
+ complete -c chef -f -n '__fish_chef_no_command' -a exec -d "Runs the command in context of the embedded ruby"
287
+ complete -c chef -f -n '__fish_chef_no_command' -a env -d "Prints environment variables used by ChefDK"
288
+ complete -c chef -f -n '__fish_chef_no_command' -a gem -d "Runs the `gem` command in context of the embedded ruby"
289
+ complete -c chef -f -n '__fish_chef_no_command' -a generate -d "Generate a new app, cookbook, or component"
290
290
  END_COMPLETION
291
291
  end
292
292
 
293
293
  before do
294
294
  # Stub this or else we'd have to update the test every time a new command
295
295
  # is added.
296
- allow(command_instance.shell_completion_template_context).to receive(:commands).
297
- and_return(command_descriptions)
296
+ allow(command_instance.shell_completion_template_context).to receive(:commands)
297
+ .and_return(command_descriptions)
298
298
 
299
299
  allow(command_instance).to receive(:omnibus_embedded_bin_dir).and_return(omnibus_embedded_bin_dir)
300
300
  allow(command_instance).to receive(:omnibus_bin_dir).and_return(omnibus_bin_dir)