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
@@ -10,12 +10,12 @@ inspec_dir = File.join(cookbook_dir, 'test', 'integration', 'default')
10
10
  inspec_path = File.join(inspec_dir, "#{context.new_file_basename}_test.rb")
11
11
 
12
12
  if File.directory?(File.join(cookbook_dir, 'test', 'recipes'))
13
- Chef::Log.deprecation <<-EOH
14
- It appears that you have Inspec tests located at "test/recipes". This location can
15
- cause issues with Foodcritic and has been deprecated in favor of "test/integration/default".
16
- Please move your existing Inspec tests to the newly created "test/integration/default"
17
- directory, and update the 'inspec_tests' value in your .kitchen.yml file(s) to
18
- point to "test/integration/default".
13
+ Chef::Log.deprecation <<~EOH
14
+ It appears that you have Inspec tests located at "test/recipes". This location can
15
+ cause issues with Foodcritic and has been deprecated in favor of "test/integration/default".
16
+ Please move your existing Inspec tests to the newly created "test/integration/default"
17
+ directory, and update the 'inspec_tests' value in your .kitchen.yml file(s) to
18
+ point to "test/integration/default".
19
19
  EOH
20
20
  end
21
21
 
@@ -16,5 +16,5 @@
16
16
  #
17
17
 
18
18
  module ChefDK
19
- VERSION = "3.3.23"
19
+ VERSION = "3.4.38".freeze
20
20
  end
@@ -68,14 +68,14 @@ module Kitchen
68
68
  default_config :policyfile, "Policyfile.rb"
69
69
 
70
70
  default_config :chef_client_path do |provisioner|
71
- provisioner.
72
- remote_path_join(%W{#{provisioner[:chef_omnibus_root]} bin chef-client}).
73
- tap { |path| path.concat(".bat") if provisioner.windows_os? }
71
+ provisioner
72
+ .remote_path_join(%W{#{provisioner[:chef_omnibus_root]} bin chef-client})
73
+ .tap { |path| path.concat(".bat") if provisioner.windows_os? }
74
74
  end
75
75
 
76
76
  default_config :ruby_bindir do |provisioner|
77
- provisioner.
78
- remote_path_join(%W{#{provisioner[:chef_omnibus_root]} embedded bin})
77
+ provisioner
78
+ .remote_path_join(%W{#{provisioner[:chef_omnibus_root]} embedded bin})
79
79
  end
80
80
 
81
81
  # (see Base#finalize_config!)
@@ -97,8 +97,8 @@ module Kitchen
97
97
  def run_command
98
98
  level = config[:log_level] == :info ? :auto : config[:log_level]
99
99
 
100
- cmd = "#{sudo(config[:chef_client_path])} --local-mode".
101
- tap { |str| str.insert(0, "& ") if powershell_shell? }
100
+ cmd = "#{sudo(config[:chef_client_path])} --local-mode"
101
+ .tap { |str| str.insert(0, "& ") if powershell_shell? }
102
102
 
103
103
  args = [
104
104
  "--config #{config[:root_path]}/client.rb",
@@ -118,8 +118,8 @@ module Kitchen
118
118
  end
119
119
 
120
120
  wrap_shell_code(
121
- [cmd, *args].join(" ").
122
- tap { |str| str.insert(0, reload_ps1_path) if windows_os? }
121
+ [cmd, *args].join(" ")
122
+ .tap { |str| str.insert(0, reload_ps1_path) if windows_os? }
123
123
  )
124
124
  end
125
125
 
@@ -16,7 +16,7 @@ override "libyaml", version: "0.1.7"
16
16
  override "makedepend", version: "1.0.5"
17
17
  override "ncurses", version: "5.9"
18
18
  override "pkg-config-lite", version: "0.28-1"
19
- override "ruby", version: "2.5.1"
19
+ override "ruby", version: "2.5.3"
20
20
  override "ruby-windows-devkit-bash", version: "3.1.23-4-msys-1.0.18"
21
21
  override "util-macros", version: "1.19.0"
22
22
  override "xproto", version: "7.0.28"
@@ -38,11 +38,11 @@ RSpec.configure do |c|
38
38
 
39
39
  c.after(:all) { clear_tempdir }
40
40
 
41
- c.filter_run :focus => true
41
+ c.filter_run focus: true
42
42
  c.run_all_when_everything_filtered = true
43
43
  # Tests that randomly fail, but may have value.
44
- c.filter_run_excluding :volatile => true
45
- c.filter_run_excluding :skip_on_windows => true if running_on_windows
44
+ c.filter_run_excluding volatile: true
45
+ c.filter_run_excluding skip_on_windows: true if running_on_windows
46
46
 
47
47
  c.mock_with(:rspec) do |mocks|
48
48
  mocks.verify_partial_doubles = true
@@ -40,17 +40,17 @@ describe ChefDK::CLI do
40
40
  end
41
41
 
42
42
  let(:base_help_message) do
43
- <<-E
44
- Usage:
45
- chef -h/--help
46
- chef -v/--version
47
- chef command [arguments...] [options...]
43
+ <<~E
44
+ Usage:
45
+ chef -h/--help
46
+ chef -v/--version
47
+ chef command [arguments...] [options...]
48
48
 
49
49
 
50
- Available Commands:
51
- verify Test the embedded ChefDK applications
52
- gem Runs the `gem` command in context of the embedded ruby
53
- example Example subcommand for testing
50
+ Available Commands:
51
+ verify Test the embedded ChefDK applications
52
+ gem Runs the `gem` command in context of the embedded ruby
53
+ example Example subcommand for testing
54
54
  E
55
55
  end
56
56
 
@@ -28,10 +28,10 @@ describe ChefDK::Command::Base do
28
28
  description: "An option with a required argument"
29
29
 
30
30
  option :user,
31
- :short => "-u",
32
- :long => "--user",
33
- :description => "If the user exists",
34
- :boolean => true
31
+ short: "-u",
32
+ long: "--user",
33
+ description: "If the user exists",
34
+ boolean: true
35
35
 
36
36
  def run(params)
37
37
  parse_options(params)
@@ -102,12 +102,12 @@ describe ChefDK::Command::Base do
102
102
 
103
103
  expect(stderr).to eq("ERROR: invalid option: -foo\n\n")
104
104
 
105
- expected = <<-E
106
- use me please
107
- -a, --arg ARG An option with a required argument
108
- -h, --help Show this message
109
- -u, --user If the user exists
110
- -v, --version Show chef version
105
+ expected = <<~E
106
+ use me please
107
+ -a, --arg ARG An option with a required argument
108
+ -h, --help Show this message
109
+ -u, --user If the user exists
110
+ -v, --version Show chef version
111
111
 
112
112
  E
113
113
  expect(stdout).to eq(expected)
@@ -122,12 +122,12 @@ E
122
122
 
123
123
  expect(stderr).to eq("ERROR: missing argument: -a\n\n")
124
124
 
125
- expected = <<-E
126
- use me please
127
- -a, --arg ARG An option with a required argument
128
- -h, --help Show this message
129
- -u, --user If the user exists
130
- -v, --version Show chef version
125
+ expected = <<~E
126
+ use me please
127
+ -a, --arg ARG An option with a required argument
128
+ -h, --help Show this message
129
+ -u, --user If the user exists
130
+ -v, --version Show chef version
131
131
 
132
132
  E
133
133
  expect(stdout).to eq(expected)
@@ -139,15 +139,15 @@ E
139
139
  describe "when parsing Chef's configuration fails" do
140
140
 
141
141
  let(:exception_message) do
142
- <<-MESSAGE
143
- You have an error in your config file /Users/ddeleo/.chef/config.rb (Chef::Exceptions::ConfigurationError)
144
-
145
- Mixlib::Config::UnknownConfigOptionError: Cannot set unsupported config value foo.
146
- /Users/person/.chef/config.rb:50:in `from_string'
147
- Relevant file content:
148
- 49: chefdk.generator_cookbook "~/.chef/code_generator"
149
- 50: chefdk.foo "bar"
150
- 51:
142
+ <<~MESSAGE
143
+ You have an error in your config file /Users/ddeleo/.chef/config.rb (Chef::Exceptions::ConfigurationError)
144
+
145
+ Mixlib::Config::UnknownConfigOptionError: Cannot set unsupported config value foo.
146
+ /Users/person/.chef/config.rb:50:in `from_string'
147
+ Relevant file content:
148
+ 49: chefdk.generator_cookbook "~/.chef/code_generator"
149
+ 50: chefdk.foo "bar"
150
+ 51:
151
151
 
152
152
  MESSAGE
153
153
  end
@@ -134,9 +134,9 @@ describe ChefDK::Command::CleanPolicyCookbooks do
134
134
  it "prints a debugging message and exits non-zero" do
135
135
  expect(command.run([])).to eq(1)
136
136
 
137
- expected_output = <<-E
138
- Error: Failed to delete some policy revisions.
139
- Reason: (StandardError) some operation failed
137
+ expected_output = <<~E
138
+ Error: Failed to delete some policy revisions.
139
+ Reason: (StandardError) some operation failed
140
140
 
141
141
  E
142
142
 
@@ -149,9 +149,9 @@ E
149
149
 
150
150
  command.run(%w{ -D })
151
151
 
152
- expected_output = <<-E
153
- Error: Failed to delete some policy revisions.
154
- Reason: (StandardError) some operation failed
152
+ expected_output = <<~E
153
+ Error: Failed to delete some policy revisions.
154
+ Reason: (StandardError) some operation failed
155
155
 
156
156
 
157
157
  E
@@ -134,9 +134,9 @@ describe ChefDK::Command::CleanPolicyRevisions do
134
134
  it "prints a debugging message and exits non-zero" do
135
135
  expect(command.run([])).to eq(1)
136
136
 
137
- expected_output = <<-E
138
- Error: Failed to delete some policy revisions.
139
- Reason: (StandardError) some operation failed
137
+ expected_output = <<~E
138
+ Error: Failed to delete some policy revisions.
139
+ Reason: (StandardError) some operation failed
140
140
 
141
141
  E
142
142
 
@@ -149,9 +149,9 @@ E
149
149
 
150
150
  command.run(%w{ -D })
151
151
 
152
- expected_output = <<-E
153
- Error: Failed to delete some policy revisions.
154
- Reason: (StandardError) some operation failed
152
+ expected_output = <<~E
153
+ Error: Failed to delete some policy revisions.
154
+ Reason: (StandardError) some operation failed
155
155
 
156
156
 
157
157
  E
@@ -161,9 +161,9 @@ describe ChefDK::Command::DeletePolicyGroup do
161
161
  it "prints a debugging message and exits non-zero" do
162
162
  expect(command.run(%w{example-policy-group})).to eq(1)
163
163
 
164
- expected_output = <<-E
165
- Error: Failed to delete policy group
166
- Reason: (StandardError) some operation failed
164
+ expected_output = <<~E
165
+ Error: Failed to delete policy group
166
+ Reason: (StandardError) some operation failed
167
167
 
168
168
  E
169
169
 
@@ -175,9 +175,9 @@ E
175
175
  it "includes the backtrace in the error" do
176
176
  command.run(%w{ example-policy-group -D })
177
177
 
178
- expected_output = <<-E
179
- Error: Failed to delete policy group
180
- Reason: (StandardError) some operation failed
178
+ expected_output = <<~E
179
+ Error: Failed to delete policy group
180
+ Reason: (StandardError) some operation failed
181
181
 
182
182
 
183
183
  E
@@ -161,9 +161,9 @@ describe ChefDK::Command::DeletePolicy do
161
161
  it "prints a debugging message and exits non-zero" do
162
162
  expect(command.run(%w{example-policy})).to eq(1)
163
163
 
164
- expected_output = <<-E
165
- Error: Failed to delete policy.
166
- Reason: (StandardError) some operation failed
164
+ expected_output = <<~E
165
+ Error: Failed to delete policy.
166
+ Reason: (StandardError) some operation failed
167
167
 
168
168
  E
169
169
 
@@ -175,9 +175,9 @@ E
175
175
  it "includes the backtrace in the error" do
176
176
  command.run(%w{ example-policy -D })
177
177
 
178
- expected_output = <<-E
179
- Error: Failed to delete policy.
180
- Reason: (StandardError) some operation failed
178
+ expected_output = <<~E
179
+ Error: Failed to delete policy.
180
+ Reason: (StandardError) some operation failed
181
181
 
182
182
 
183
183
  E
@@ -132,10 +132,10 @@ describe ChefDK::Command::Export do
132
132
  it "prints instructions for running chef-client in the repo" do
133
133
  command.run(params)
134
134
 
135
- expected_message = <<-MESSAGE
136
- To converge this system with the exported policy, run:
137
- cd /path/to/export
138
- chef-client -z
135
+ expected_message = <<~MESSAGE
136
+ To converge this system with the exported policy, run:
137
+ cd /path/to/export
138
+ chef-client -z
139
139
  MESSAGE
140
140
  expect(ui.output).to include(expected_message)
141
141
  end
@@ -164,9 +164,9 @@ MESSAGE
164
164
  end
165
165
 
166
166
  it "displays the exception and cause" do
167
- expected_error_text = <<-E
168
- Error: export failed
169
- Reason: (StandardError) some operation failed
167
+ expected_error_text = <<~E
168
+ Error: export failed
169
+ Reason: (StandardError) some operation failed
170
170
 
171
171
  E
172
172
 
@@ -179,9 +179,9 @@ E
179
179
  let(:params) { [ "path/to/export", "-D"] }
180
180
 
181
181
  it "displays the exception and cause with backtrace" do
182
- expected_error_text = <<-E
183
- Error: export failed
184
- Reason: (StandardError) some operation failed
182
+ expected_error_text = <<~E
183
+ Error: export failed
184
+ Reason: (StandardError) some operation failed
185
185
 
186
186
 
187
187
  E
@@ -41,7 +41,7 @@ class ChefDK::Command::GeneratorCommands::Example < ChefDK::Command::GeneratorCo
41
41
 
42
42
  def run
43
43
  parse_options(@argv)
44
- { :argv => @argv, :ran_cmd => "example" }
44
+ { argv: @argv, ran_cmd: "example" }
45
45
  end
46
46
  end
47
47
 
@@ -74,11 +74,11 @@ describe ChefDK::Command::Generate do
74
74
 
75
75
  context "with a generator defined" do
76
76
  let(:expected_help_message) do
77
- <<-E
78
- Usage: chef generate GENERATOR [options]
77
+ <<~E
78
+ Usage: chef generate GENERATOR [options]
79
79
 
80
- Available generators:
81
- example this is a test
80
+ Available generators:
81
+ example this is a test
82
82
  E
83
83
  end
84
84
 
@@ -192,15 +192,15 @@ describe ChefDK::Command::GeneratorCommands::BuildCookbook do
192
192
 
193
193
  include_examples "a generated file", :cookbook_name do
194
194
  let(:line) do
195
- <<-METADATA
196
- name 'build_cookbook'
197
- maintainer 'The Authors'
198
- maintainer_email 'you@example.com'
199
- license 'all_rights'
200
- version '0.1.0'
201
- chef_version '>= 13.0'
202
-
203
- depends 'delivery-truck'
195
+ <<~METADATA
196
+ name 'build_cookbook'
197
+ maintainer 'The Authors'
198
+ maintainer_email 'you@example.com'
199
+ license 'all_rights'
200
+ version '0.1.0'
201
+ chef_version '>= 13.0'
202
+
203
+ depends 'delivery-truck'
204
204
  METADATA
205
205
  end
206
206
  end
@@ -252,12 +252,12 @@ METADATA
252
252
 
253
253
  include_examples "a generated file", :cookbook_name do
254
254
  let(:line) do
255
- <<-METADATA
256
- name 'build_cookbook'
257
- maintainer 'The Authors'
258
- maintainer_email 'you@example.com'
259
- license 'all_rights'
260
- version '0.1.0'
255
+ <<~METADATA
256
+ name 'build_cookbook'
257
+ maintainer 'The Authors'
258
+ maintainer_email 'you@example.com'
259
+ license 'all_rights'
260
+ version '0.1.0'
261
261
  METADATA
262
262
  end
263
263
  end
@@ -59,19 +59,19 @@ describe ChefDK::Command::GeneratorCommands::Cookbook do
59
59
  end
60
60
 
61
61
  let(:non_delivery_breadcrumb) do
62
- <<-EOF
63
- Your cookbook is ready. Type `cd new_cookbook` to enter it.
62
+ <<~EOF
63
+ Your cookbook is ready. Type `cd new_cookbook` to enter it.
64
64
 
65
- There are several commands you can run to get started locally developing and testing your cookbook.
66
- Type `delivery local --help` to see a full list.
65
+ There are several commands you can run to get started locally developing and testing your cookbook.
66
+ Type `delivery local --help` to see a full list.
67
67
 
68
- Why not start by writing a test? Tests for the default recipe are stored at:
68
+ Why not start by writing a test? Tests for the default recipe are stored at:
69
69
 
70
- test/integration/default/default_test.rb
70
+ test/integration/default/default_test.rb
71
71
 
72
- If you'd prefer to dive right in, the default recipe can be found at:
72
+ If you'd prefer to dive right in, the default recipe can be found at:
73
73
 
74
- recipes/default.rb
74
+ recipes/default.rb
75
75
  EOF
76
76
  end
77
77
 
@@ -179,43 +179,43 @@ EOF
179
179
  let(:file) { File.join(tempdir, "new_cookbook", ".delivery", "project.toml") }
180
180
 
181
181
  let(:expected_content) do
182
- <<-PROJECT_DOT_TOML
183
- # Delivery Prototype for Local Phases Execution
184
- #
185
- # The purpose of this file is to prototype a new way to execute
186
- # phases locally on your workstation. The delivery-cli will read
187
- # this file and execute the command(s) that are configured for
188
- # each phase. You can customize them by just modifying the phase
189
- # key on this file.
190
- #
191
- # By default these phases are configured for Cookbook Workflow only
192
- #
193
- # As this is still a prototype we are not modifying the current
194
- # config.json file and it will continue working as usual.
195
-
196
- [local_phases]
197
- unit = "chef exec rspec spec/"
198
- lint = "chef exec cookstyle"
199
- # Foodcritic includes rules only appropriate for community cookbooks
200
- # uploaded to Supermarket. We turn off any rules tagged "supermarket"
201
- # by default. If you plan to share this cookbook you should remove
202
- # '-t ~supermarket' below to enable supermarket rules.
203
- syntax = "chef exec foodcritic . -t ~supermarket"
204
- provision = "chef exec kitchen create"
205
- deploy = "chef exec kitchen converge"
206
- smoke = "chef exec kitchen verify"
207
- # The functional phase is optional, you can define it by uncommenting
208
- # the line below and running the command: `delivery local functional`
209
- # functional = ""
210
- cleanup = "chef exec kitchen destroy"
211
-
212
- # Remote project.toml file
213
- #
214
- # Specify a remote URI location for the `project.toml` file.
215
- # This is useful for teams that wish to centrally manage the behavior
216
- # of the `delivery local` command across many different projects.
217
- #
218
- # remote_file = "https://url/project.toml"
182
+ <<~PROJECT_DOT_TOML
183
+ # Delivery Prototype for Local Phases Execution
184
+ #
185
+ # The purpose of this file is to prototype a new way to execute
186
+ # phases locally on your workstation. The delivery-cli will read
187
+ # this file and execute the command(s) that are configured for
188
+ # each phase. You can customize them by just modifying the phase
189
+ # key on this file.
190
+ #
191
+ # By default these phases are configured for Cookbook Workflow only
192
+ #
193
+ # As this is still a prototype we are not modifying the current
194
+ # config.json file and it will continue working as usual.
195
+
196
+ [local_phases]
197
+ unit = "chef exec rspec spec/"
198
+ lint = "chef exec cookstyle"
199
+ # Foodcritic includes rules only appropriate for community cookbooks
200
+ # uploaded to Supermarket. We turn off any rules tagged "supermarket"
201
+ # by default. If you plan to share this cookbook you should remove
202
+ # '-t ~supermarket' below to enable supermarket rules.
203
+ syntax = "chef exec foodcritic . -t ~supermarket"
204
+ provision = "chef exec kitchen create"
205
+ deploy = "chef exec kitchen converge"
206
+ smoke = "chef exec kitchen verify"
207
+ # The functional phase is optional, you can define it by uncommenting
208
+ # the line below and running the command: `delivery local functional`
209
+ # functional = ""
210
+ cleanup = "chef exec kitchen destroy"
211
+
212
+ # Remote project.toml file
213
+ #
214
+ # Specify a remote URI location for the `project.toml` file.
215
+ # This is useful for teams that wish to centrally manage the behavior
216
+ # of the `delivery local` command across many different projects.
217
+ #
218
+ # remote_file = "https://url/project.toml"
219
219
  PROJECT_DOT_TOML
220
220
  end
221
221
 
@@ -230,24 +230,24 @@ PROJECT_DOT_TOML
230
230
  let(:file) { File.join(tempdir, "new_cookbook", ".delivery", "config.json") }
231
231
 
232
232
  let(:expected_content) do
233
- <<-CONFIG_DOT_JSON
234
- {
235
- "version": "2",
236
- "build_cookbook": {
237
- "name": "build_cookbook",
238
- "path": ".delivery/build_cookbook"
239
- },
240
- "delivery-truck": {
241
- "lint": {
242
- "enable_cookstyle": true
243
- }
244
- },
245
- "skip_phases": [],
246
- "job_dispatch": {
247
- "version": "v2"
248
- },
249
- "dependencies": []
250
- }
233
+ <<~CONFIG_DOT_JSON
234
+ {
235
+ "version": "2",
236
+ "build_cookbook": {
237
+ "name": "build_cookbook",
238
+ "path": ".delivery/build_cookbook"
239
+ },
240
+ "delivery-truck": {
241
+ "lint": {
242
+ "enable_cookstyle": true
243
+ }
244
+ },
245
+ "skip_phases": [],
246
+ "job_dispatch": {
247
+ "version": "v2"
248
+ },
249
+ "dependencies": []
250
+ }
251
251
  CONFIG_DOT_JSON
252
252
  end
253
253
 
@@ -264,13 +264,13 @@ PROJECT_DOT_TOML
264
264
  end
265
265
 
266
266
  let(:expected_content) do
267
- <<-CONFIG_DOT_JSON
268
- #
269
- # Cookbook:: build_cookbook
270
- # Recipe:: publish
271
- #
272
- # Copyright:: 2018, The Authors, All Rights Reserved.
273
- include_recipe 'delivery-truck::publish'
267
+ <<~CONFIG_DOT_JSON
268
+ #
269
+ # Cookbook:: build_cookbook
270
+ # Recipe:: publish
271
+ #
272
+ # Copyright:: 2018, The Authors, All Rights Reserved.
273
+ include_recipe 'delivery-truck::publish'
274
274
  CONFIG_DOT_JSON
275
275
  end
276
276
 
@@ -287,14 +287,14 @@ include_recipe 'delivery-truck::publish'
287
287
  end
288
288
 
289
289
  let(:expected_content) do
290
- <<-CONFIG_DOT_JSON
291
- source 'https://supermarket.chef.io'
290
+ <<~CONFIG_DOT_JSON
291
+ source 'https://supermarket.chef.io'
292
292
 
293
- metadata
293
+ metadata
294
294
 
295
- group :delivery do
296
- cookbook 'test', path: './test/fixtures/cookbooks/test'
297
- end
295
+ group :delivery do
296
+ cookbook 'test', path: './test/fixtures/cookbooks/test'
297
+ end
298
298
  CONFIG_DOT_JSON
299
299
  end
300
300
 
@@ -358,17 +358,17 @@ end
358
358
  expect(cookbook_generator.run).to eq(0)
359
359
  end
360
360
 
361
- expected = <<-OUTPUT
362
- Generating cookbook new_cookbook
363
- - Ensuring correct cookbook file content
364
- - Committing cookbook files to git
365
- - Ensuring delivery configuration
366
- - Ensuring correct delivery build cookbook content
367
- - Adding delivery configuration to feature branch
368
- - Adding build cookbook to feature branch
369
- - Merging delivery content feature branch to master
361
+ expected = <<~OUTPUT
362
+ Generating cookbook new_cookbook
363
+ - Ensuring correct cookbook file content
364
+ - Committing cookbook files to git
365
+ - Ensuring delivery configuration
366
+ - Ensuring correct delivery build cookbook content
367
+ - Adding delivery configuration to feature branch
368
+ - Adding build cookbook to feature branch
369
+ - Merging delivery content feature branch to master
370
370
 
371
- #{non_delivery_breadcrumb}
371
+ #{non_delivery_breadcrumb}
372
372
  OUTPUT
373
373
 
374
374
  actual = stdout_io.string
@@ -410,17 +410,17 @@ OUTPUT
410
410
  expect(cookbook_generator.run).to eq(0)
411
411
  end
412
412
 
413
- expected = <<-OUTPUT
414
- Generating cookbook new_cookbook
415
- - Ensuring correct cookbook file content
416
- - Committing cookbook files to git
417
- - Ensuring delivery configuration
418
- - Ensuring correct delivery build cookbook content
419
- - Adding delivery configuration to feature branch
420
- - Adding build cookbook to feature branch
421
- - Merging delivery content feature branch to master
413
+ expected = <<~OUTPUT
414
+ Generating cookbook new_cookbook
415
+ - Ensuring correct cookbook file content
416
+ - Committing cookbook files to git
417
+ - Ensuring delivery configuration
418
+ - Ensuring correct delivery build cookbook content
419
+ - Adding delivery configuration to feature branch
420
+ - Adding build cookbook to feature branch
421
+ - Merging delivery content feature branch to master
422
422
 
423
- Your cookbook is ready. To setup the pipeline, type `cd new_cookbook`, then run `delivery init`
423
+ Your cookbook is ready. To setup the pipeline, type `cd new_cookbook`, then run `delivery init`
424
424
  OUTPUT
425
425
 
426
426
  actual = stdout_io.string
@@ -525,23 +525,23 @@ OUTPUT
525
525
  let(:file) { File.join(tempdir, "new_cookbook", "Policyfile.rb") }
526
526
 
527
527
  let(:expected_content) do
528
- <<-POLICYFILE_RB
529
- # Policyfile.rb - Describe how you want Chef to build your system.
530
- #
531
- # For more information on the Policyfile feature, visit
532
- # https://docs.chef.io/policyfile.html
528
+ <<~POLICYFILE_RB
529
+ # Policyfile.rb - Describe how you want Chef to build your system.
530
+ #
531
+ # For more information on the Policyfile feature, visit
532
+ # https://docs.chef.io/policyfile.html
533
533
 
534
- # A name that describes what the system you're building with Chef does.
535
- name 'new_cookbook'
534
+ # A name that describes what the system you're building with Chef does.
535
+ name 'new_cookbook'
536
536
 
537
- # Where to find external cookbooks:
538
- default_source :supermarket
537
+ # Where to find external cookbooks:
538
+ default_source :supermarket
539
539
 
540
- # run_list: chef-client will run these recipes in the order specified.
541
- run_list 'new_cookbook::default'
540
+ # run_list: chef-client will run these recipes in the order specified.
541
+ run_list 'new_cookbook::default'
542
542
 
543
- # Specify a custom source for a single cookbook:
544
- cookbook 'new_cookbook', path: '.'
543
+ # Specify a custom source for a single cookbook:
544
+ cookbook 'new_cookbook', path: '.'
545
545
  POLICYFILE_RB
546
546
  end
547
547
 
@@ -561,40 +561,40 @@ POLICYFILE_RB
561
561
  include_examples "kitchen_yml_and_integration_tests" do
562
562
 
563
563
  let(:expected_kitchen_yml_content) do
564
- <<-KITCHEN_YML
565
- ---
566
- driver:
567
- name: vagrant
564
+ <<~KITCHEN_YML
565
+ ---
566
+ driver:
567
+ name: vagrant
568
568
 
569
- ## The forwarded_port port feature lets you connect to ports on the VM guest via
570
- ## localhost on the host.
571
- ## see also: https://docs.vagrantup.com/v2/networking/forwarded_ports.html
569
+ ## The forwarded_port port feature lets you connect to ports on the VM guest via
570
+ ## localhost on the host.
571
+ ## see also: https://docs.vagrantup.com/v2/networking/forwarded_ports.html
572
572
 
573
- # network:
574
- # - ["forwarded_port", {guest: 80, host: 8080}]
573
+ # network:
574
+ # - ["forwarded_port", {guest: 80, host: 8080}]
575
575
 
576
- provisioner:
577
- name: chef_zero
576
+ provisioner:
577
+ name: chef_zero
578
578
 
579
- ## require_chef_omnibus specifies a specific chef version to install. You can
580
- ## also set this to `true` to always use the latest version.
581
- ## see also: https://docs.chef.io/config_yml_kitchen.html
579
+ ## require_chef_omnibus specifies a specific chef version to install. You can
580
+ ## also set this to `true` to always use the latest version.
581
+ ## see also: https://docs.chef.io/config_yml_kitchen.html
582
582
 
583
- # require_chef_omnibus: 12.8.1
583
+ # require_chef_omnibus: 12.8.1
584
584
 
585
- verifier:
586
- name: inspec
585
+ verifier:
586
+ name: inspec
587
587
 
588
- platforms:
589
- - name: ubuntu-16.04
590
- - name: centos-7
588
+ platforms:
589
+ - name: ubuntu-16.04
590
+ - name: centos-7
591
591
 
592
- suites:
593
- - name: default
594
- verifier:
595
- inspec_tests:
596
- - test/integration/default
597
- attributes:
592
+ suites:
593
+ - name: default
594
+ verifier:
595
+ inspec_tests:
596
+ - test/integration/default
597
+ attributes:
598
598
  KITCHEN_YML
599
599
  end
600
600
 
@@ -603,10 +603,10 @@ KITCHEN_YML
603
603
  include_examples "chefspec_spec_helper_file" do
604
604
 
605
605
  let(:expected_chefspec_spec_helper_content) do
606
- <<-SPEC_HELPER
607
- # frozen_string_literal: true
608
- require 'chefspec'
609
- require 'chefspec/policyfile'
606
+ <<~SPEC_HELPER
607
+ # frozen_string_literal: true
608
+ require 'chefspec'
609
+ require 'chefspec/policyfile'
610
610
  SPEC_HELPER
611
611
  end
612
612
 
@@ -623,11 +623,11 @@ SPEC_HELPER
623
623
  let(:file) { File.join(tempdir, "new_cookbook", "Berksfile") }
624
624
 
625
625
  let(:expected_content) do
626
- <<-POLICYFILE_RB
627
- # frozen_string_literal: true
628
- source 'https://supermarket.chef.io'
626
+ <<~POLICYFILE_RB
627
+ # frozen_string_literal: true
628
+ source 'https://supermarket.chef.io'
629
629
 
630
- metadata
630
+ metadata
631
631
  POLICYFILE_RB
632
632
  end
633
633
 
@@ -647,33 +647,33 @@ POLICYFILE_RB
647
647
  include_examples "kitchen_yml_and_integration_tests" do
648
648
 
649
649
  let(:expected_kitchen_yml_content) do
650
- <<-KITCHEN_YML
651
- ---
652
- driver:
653
- name: vagrant
654
-
655
- provisioner:
656
- name: chef_zero
657
- # You may wish to disable always updating cookbooks in CI or other testing environments.
658
- # For example:
659
- # always_update_cookbooks: <%= !ENV['CI'] %>
660
- always_update_cookbooks: true
661
-
662
- verifier:
663
- name: inspec
664
-
665
- platforms:
666
- - name: ubuntu-16.04
667
- - name: centos-7
668
-
669
- suites:
670
- - name: default
671
- run_list:
672
- - recipe[new_cookbook::default]
673
- verifier:
674
- inspec_tests:
675
- - test/integration/default
676
- attributes:
650
+ <<~KITCHEN_YML
651
+ ---
652
+ driver:
653
+ name: vagrant
654
+
655
+ provisioner:
656
+ name: chef_zero
657
+ # You may wish to disable always updating cookbooks in CI or other testing environments.
658
+ # For example:
659
+ # always_update_cookbooks: <%= !ENV['CI'] %>
660
+ always_update_cookbooks: true
661
+
662
+ verifier:
663
+ name: inspec
664
+
665
+ platforms:
666
+ - name: ubuntu-16.04
667
+ - name: centos-7
668
+
669
+ suites:
670
+ - name: default
671
+ run_list:
672
+ - recipe[new_cookbook::default]
673
+ verifier:
674
+ inspec_tests:
675
+ - test/integration/default
676
+ attributes:
677
677
  KITCHEN_YML
678
678
  end
679
679
 
@@ -682,10 +682,10 @@ KITCHEN_YML
682
682
  include_examples "chefspec_spec_helper_file" do
683
683
 
684
684
  let(:expected_chefspec_spec_helper_content) do
685
- <<-SPEC_HELPER
686
- # frozen_string_literal: true
687
- require 'chefspec'
688
- require 'chefspec/berkshelf'
685
+ <<~SPEC_HELPER
686
+ # frozen_string_literal: true
687
+ require 'chefspec'
688
+ require 'chefspec/berkshelf'
689
689
  SPEC_HELPER
690
690
  end
691
691