test-kitchen 1.20.0 → 1.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +5 -5
  2. data/.gitattributes +0 -0
  3. data/.github/ISSUE_TEMPLATE.md +0 -0
  4. data/.gitignore +0 -0
  5. data/.kitchen.ci.yml +0 -0
  6. data/.kitchen.dokken.yml +0 -0
  7. data/.kitchen.proxy.yml +1 -1
  8. data/.rubocop.yml +1 -1
  9. data/.travis.yml +6 -2
  10. data/.yardopts +0 -0
  11. data/Berksfile +0 -0
  12. data/CHANGELOG.md +26 -0
  13. data/CONTRIBUTING.md +0 -0
  14. data/ECOSYSTEM.md +0 -0
  15. data/Gemfile +6 -2
  16. data/Gemfile.proxy_tests +0 -0
  17. data/Guardfile +0 -0
  18. data/LICENSE +0 -0
  19. data/MAINTAINERS.md +0 -0
  20. data/README.md +0 -0
  21. data/Rakefile +0 -0
  22. data/appveyor.yml +4 -3
  23. data/features/kitchen_action_commands.feature +0 -0
  24. data/features/kitchen_command.feature +0 -0
  25. data/features/kitchen_console_command.feature +0 -0
  26. data/features/kitchen_defaults.feature +2 -2
  27. data/features/kitchen_diagnose_command.feature +0 -0
  28. data/features/kitchen_help_command.feature +0 -0
  29. data/features/kitchen_init_command.feature +19 -39
  30. data/features/kitchen_list_command.feature +3 -3
  31. data/features/kitchen_login_command.feature +0 -0
  32. data/features/kitchen_sink_command.feature +0 -0
  33. data/features/kitchen_test_command.feature +0 -0
  34. data/features/step_definitions/gem_steps.rb +0 -12
  35. data/features/step_definitions/git_steps.rb +0 -0
  36. data/features/step_definitions/output_steps.rb +0 -0
  37. data/features/support/env.rb +0 -0
  38. data/lib/kitchen.rb +0 -0
  39. data/lib/kitchen/base64_stream.rb +0 -0
  40. data/lib/kitchen/cli.rb +15 -11
  41. data/lib/kitchen/collection.rb +0 -0
  42. data/lib/kitchen/color.rb +0 -0
  43. data/lib/kitchen/command.rb +1 -1
  44. data/lib/kitchen/command/action.rb +0 -0
  45. data/lib/kitchen/command/console.rb +0 -0
  46. data/lib/kitchen/command/diagnose.rb +0 -0
  47. data/lib/kitchen/command/doctor.rb +0 -0
  48. data/lib/kitchen/command/exec.rb +0 -0
  49. data/lib/kitchen/command/list.rb +0 -0
  50. data/lib/kitchen/command/login.rb +0 -0
  51. data/lib/kitchen/command/package.rb +0 -0
  52. data/lib/kitchen/command/sink.rb +0 -0
  53. data/lib/kitchen/command/test.rb +0 -0
  54. data/lib/kitchen/config.rb +1 -1
  55. data/lib/kitchen/configurable.rb +0 -0
  56. data/lib/kitchen/data_munger.rb +10 -10
  57. data/lib/kitchen/diagnostic.rb +0 -0
  58. data/lib/kitchen/driver.rb +0 -0
  59. data/lib/kitchen/driver/base.rb +0 -0
  60. data/lib/kitchen/driver/dummy.rb +0 -0
  61. data/lib/kitchen/driver/exec.rb +1 -1
  62. data/lib/kitchen/driver/proxy.rb +1 -1
  63. data/lib/kitchen/driver/ssh_base.rb +0 -0
  64. data/lib/kitchen/errors.rb +0 -0
  65. data/lib/kitchen/generator/init.rb +1 -36
  66. data/lib/kitchen/instance.rb +0 -0
  67. data/lib/kitchen/lazy_hash.rb +1 -1
  68. data/lib/kitchen/loader/yaml.rb +31 -6
  69. data/lib/kitchen/logger.rb +1 -1
  70. data/lib/kitchen/logging.rb +0 -0
  71. data/lib/kitchen/login_command.rb +0 -0
  72. data/lib/kitchen/metadata_chopper.rb +0 -0
  73. data/lib/kitchen/platform.rb +0 -0
  74. data/lib/kitchen/provisioner.rb +0 -0
  75. data/lib/kitchen/provisioner/base.rb +0 -0
  76. data/lib/kitchen/provisioner/chef/berkshelf.rb +23 -19
  77. data/lib/kitchen/provisioner/chef/common_sandbox.rb +0 -0
  78. data/lib/kitchen/provisioner/chef/librarian.rb +25 -21
  79. data/lib/kitchen/provisioner/chef/policyfile.rb +23 -18
  80. data/lib/kitchen/provisioner/chef_apply.rb +2 -2
  81. data/lib/kitchen/provisioner/chef_base.rb +3 -2
  82. data/lib/kitchen/provisioner/chef_solo.rb +1 -1
  83. data/lib/kitchen/provisioner/chef_zero.rb +0 -0
  84. data/lib/kitchen/provisioner/dummy.rb +0 -0
  85. data/lib/kitchen/provisioner/shell.rb +0 -0
  86. data/lib/kitchen/rake_tasks.rb +0 -0
  87. data/lib/kitchen/shell_out.rb +0 -0
  88. data/lib/kitchen/ssh.rb +0 -0
  89. data/lib/kitchen/state_file.rb +0 -0
  90. data/lib/kitchen/suite.rb +0 -0
  91. data/lib/kitchen/thor_tasks.rb +0 -0
  92. data/lib/kitchen/transport.rb +0 -0
  93. data/lib/kitchen/transport/base.rb +0 -0
  94. data/lib/kitchen/transport/dummy.rb +0 -0
  95. data/lib/kitchen/transport/exec.rb +0 -0
  96. data/lib/kitchen/transport/ssh.rb +0 -0
  97. data/lib/kitchen/transport/winrm.rb +11 -5
  98. data/lib/kitchen/util.rb +0 -0
  99. data/lib/kitchen/verifier.rb +0 -0
  100. data/lib/kitchen/verifier/base.rb +0 -0
  101. data/lib/kitchen/verifier/busser.rb +0 -0
  102. data/lib/kitchen/verifier/dummy.rb +0 -0
  103. data/lib/kitchen/verifier/shell.rb +0 -0
  104. data/lib/kitchen/version.rb +1 -1
  105. data/lib/vendor/hash_recursive_merge.rb +0 -0
  106. data/spec/kitchen/base64_stream_spec.rb +0 -0
  107. data/spec/kitchen/cli_spec.rb +0 -0
  108. data/spec/kitchen/collection_spec.rb +0 -0
  109. data/spec/kitchen/color_spec.rb +0 -0
  110. data/spec/kitchen/config_spec.rb +0 -0
  111. data/spec/kitchen/configurable_spec.rb +0 -0
  112. data/spec/kitchen/data_munger_spec.rb +0 -0
  113. data/spec/kitchen/diagnostic_spec.rb +0 -0
  114. data/spec/kitchen/driver/base_spec.rb +0 -0
  115. data/spec/kitchen/driver/dummy_spec.rb +0 -0
  116. data/spec/kitchen/driver/exec_spec.rb +0 -0
  117. data/spec/kitchen/driver/proxy_spec.rb +0 -0
  118. data/spec/kitchen/driver/ssh_base_spec.rb +0 -0
  119. data/spec/kitchen/driver_spec.rb +0 -0
  120. data/spec/kitchen/errors_spec.rb +0 -0
  121. data/spec/kitchen/instance_spec.rb +0 -0
  122. data/spec/kitchen/lazy_hash_spec.rb +0 -0
  123. data/spec/kitchen/loader/yaml_spec.rb +43 -0
  124. data/spec/kitchen/logger_spec.rb +6 -1
  125. data/spec/kitchen/logging_spec.rb +0 -0
  126. data/spec/kitchen/login_command_spec.rb +0 -0
  127. data/spec/kitchen/metadata_chopper_spec.rb +0 -0
  128. data/spec/kitchen/platform_spec.rb +0 -0
  129. data/spec/kitchen/provisioner/base_spec.rb +0 -0
  130. data/spec/kitchen/provisioner/chef/policyfile_spec.rb +0 -0
  131. data/spec/kitchen/provisioner/chef_apply_spec.rb +0 -0
  132. data/spec/kitchen/provisioner/chef_base_spec.rb +6 -6
  133. data/spec/kitchen/provisioner/chef_solo_spec.rb +0 -0
  134. data/spec/kitchen/provisioner/chef_zero_spec.rb +0 -0
  135. data/spec/kitchen/provisioner/dummy_spec.rb +0 -0
  136. data/spec/kitchen/provisioner/shell_spec.rb +0 -0
  137. data/spec/kitchen/provisioner_spec.rb +0 -0
  138. data/spec/kitchen/shell_out_spec.rb +0 -0
  139. data/spec/kitchen/ssh_spec.rb +0 -0
  140. data/spec/kitchen/state_file_spec.rb +0 -0
  141. data/spec/kitchen/suite_spec.rb +0 -0
  142. data/spec/kitchen/transport/base_spec.rb +0 -0
  143. data/spec/kitchen/transport/exec_spec.rb +0 -0
  144. data/spec/kitchen/transport/ssh_spec.rb +0 -0
  145. data/spec/kitchen/transport/winrm_spec.rb +22 -13
  146. data/spec/kitchen/transport_spec.rb +0 -0
  147. data/spec/kitchen/util_spec.rb +0 -0
  148. data/spec/kitchen/verifier/base_spec.rb +0 -0
  149. data/spec/kitchen/verifier/busser_spec.rb +0 -0
  150. data/spec/kitchen/verifier/dummy_spec.rb +0 -0
  151. data/spec/kitchen/verifier/shell_spec.rb +0 -0
  152. data/spec/kitchen/verifier_spec.rb +0 -0
  153. data/spec/kitchen_spec.rb +0 -0
  154. data/spec/spec_helper.rb +0 -0
  155. data/spec/support/powershell_max_size_spec.rb +0 -0
  156. data/support/busser_install_command.ps1 +0 -0
  157. data/support/busser_install_command.sh +0 -0
  158. data/support/chef-client-fail-if-update-handler.rb +0 -0
  159. data/support/chef_base_init_command.ps1 +0 -0
  160. data/support/chef_base_init_command.sh +0 -0
  161. data/support/chef_base_install_command.ps1 +0 -0
  162. data/support/chef_base_install_command.sh +0 -0
  163. data/support/chef_zero_prepare_command_legacy.ps1 +0 -0
  164. data/support/chef_zero_prepare_command_legacy.sh +0 -0
  165. data/support/download_helpers.sh +0 -0
  166. data/support/dummy-validation.pem +0 -0
  167. data/templates/driver/CHANGELOG.md.erb +0 -0
  168. data/templates/driver/Gemfile.erb +0 -0
  169. data/templates/driver/README.md.erb +0 -0
  170. data/templates/driver/Rakefile.erb +0 -0
  171. data/templates/driver/driver.rb.erb +0 -0
  172. data/templates/driver/gemspec.erb +0 -0
  173. data/templates/driver/gitignore.erb +0 -0
  174. data/templates/driver/license_apachev2.erb +0 -0
  175. data/templates/driver/license_lgplv3.erb +0 -0
  176. data/templates/driver/license_mit.erb +0 -0
  177. data/templates/driver/license_reserved.erb +0 -0
  178. data/templates/driver/tailor.erb +0 -0
  179. data/templates/driver/travis.yml.erb +0 -0
  180. data/templates/driver/version.rb.erb +0 -0
  181. data/templates/init/chefignore.erb +0 -0
  182. data/templates/init/kitchen.yml.erb +2 -2
  183. data/test-kitchen.gemspec +1 -1
  184. data/test/cookbooks/test_cookbook/metadata.rb +0 -0
  185. data/test/cookbooks/test_cookbook/recipes/default.rb +0 -0
  186. data/test/integration/default/default_spec.rb +0 -0
  187. data/testing_windows.md +0 -0
  188. metadata +5 -5
File without changes
data/lib/kitchen/color.rb CHANGED
File without changes
@@ -165,7 +165,7 @@ module Kitchen
165
165
  @action_errors = []
166
166
  concurrency.times do
167
167
  threads << Thread.new do
168
- while instance = queue.pop
168
+ while (instance = queue.pop)
169
169
  run_action_in_thread(action, instance, *args)
170
170
  end
171
171
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -39,7 +39,7 @@ module Kitchen
39
39
  #
40
40
  # @example fetching an instance by name
41
41
  #
42
- # Kitchen::Config.new.instances.get("default-ubuntu-12.04")
42
+ # Kitchen::Config.new.instances.get("default-ubuntu-16.04")
43
43
  #
44
44
  # @example fetching all instances matching a regular expression
45
45
  #
File without changes
@@ -151,7 +151,7 @@ module Kitchen
151
151
  #
152
152
  # :platforms => [
153
153
  # {
154
- # :name => "ubuntu-12.04",
154
+ # :name => "ubuntu-16.04",
155
155
  # :busser => "bar"
156
156
  # }
157
157
  # ],
@@ -174,7 +174,7 @@ module Kitchen
174
174
  #
175
175
  # :platforms => [
176
176
  # {
177
- # :name => "ubuntu-12.04",
177
+ # :name => "ubuntu-16.04",
178
178
  # :verifier => {
179
179
  # :name => "busser",
180
180
  # :version => "bar
@@ -295,7 +295,7 @@ module Kitchen
295
295
  #
296
296
  # :platforms => [
297
297
  # {
298
- # :name => "ubuntu-12.04",
298
+ # :name => "ubuntu-16.04",
299
299
  # :driver_plugin => "bar"
300
300
  # }
301
301
  # ],
@@ -319,7 +319,7 @@ module Kitchen
319
319
  #
320
320
  # :platforms => [
321
321
  # {
322
- # :name => "ubuntu-12.04",
322
+ # :name => "ubuntu-16.04",
323
323
  # :driver => {
324
324
  # :name => "bar"
325
325
  # }
@@ -391,7 +391,7 @@ module Kitchen
391
391
  #
392
392
  # :platforms => [
393
393
  # {
394
- # :name => "ubuntu-12.04",
394
+ # :name => "ubuntu-16.04",
395
395
  # :driver => {
396
396
  # :http_proxy => "foo"
397
397
  # }
@@ -428,7 +428,7 @@ module Kitchen
428
428
  #
429
429
  # :platforms => [
430
430
  # {
431
- # :name => "ubuntu-12.04",
431
+ # :name => "ubuntu-16.04",
432
432
  # :driver => {
433
433
  # :http_proxy => "foo"
434
434
  # },
@@ -512,7 +512,7 @@ module Kitchen
512
512
  #
513
513
  # :platforms => [
514
514
  # {
515
- # :name => "ubuntu-12.04",
515
+ # :name => "ubuntu-16.04",
516
516
  # :driver => {
517
517
  # :require_chef_omnibus => "10.8.2"
518
518
  # }
@@ -538,7 +538,7 @@ module Kitchen
538
538
  #
539
539
  # :platforms => [
540
540
  # {
541
- # :name => "ubuntu-12.04",
541
+ # :name => "ubuntu-16.04",
542
542
  # :provisioner => {
543
543
  # :require_chef_omnibus => "10.8.2"
544
544
  # }
@@ -635,7 +635,7 @@ module Kitchen
635
635
  # {
636
636
  # :platforms => [
637
637
  # {
638
- # :name => "ubuntu-12.04",
638
+ # :name => "ubuntu-16.04",
639
639
  # :attributes => { :one => "two" },
640
640
  # :run_list => ["alpha", "bravo"]
641
641
  # }
@@ -655,7 +655,7 @@ module Kitchen
655
655
  # {
656
656
  # :platforms => [
657
657
  # {
658
- # :name => "ubuntu-12.04",
658
+ # :name => "ubuntu-16.04",
659
659
  # :provisioner => {
660
660
  # :attributes => { :one => "two" },
661
661
  # :run_list => ["alpha", "bravo"]
File without changes
File without changes
File without changes
File without changes
@@ -61,7 +61,7 @@ module Kitchen
61
61
  # @param state [Hash] the state hash
62
62
  # @api private
63
63
  def reset_instance(state)
64
- if cmd = config[:reset_command]
64
+ if (cmd = config[:reset_command])
65
65
  info("Resetting instance state with command: #{cmd}")
66
66
  run_command(cmd)
67
67
  end
@@ -60,7 +60,7 @@ module Kitchen
60
60
  # @param state [Hash] the state hash
61
61
  # @api private
62
62
  def reset_instance(state)
63
- if cmd = config[:reset_command]
63
+ if (cmd = config[:reset_command])
64
64
  info("Resetting instance state with command: #{cmd}")
65
65
  ssh(build_ssh_args(state), cmd)
66
66
  end
File without changes
File without changes
@@ -64,7 +64,6 @@ module Kitchen
64
64
  create_test_dir
65
65
  prepare_gitignore
66
66
  prepare_gemfile
67
- add_drivers
68
67
  display_bundle_message
69
68
  end
70
69
 
@@ -80,7 +79,7 @@ module Kitchen
80
79
  run_list = cookbook_name ? "recipe[#{cookbook_name}::default]" : nil
81
80
  driver_plugin = Array(options[:driver]).first || "dummy"
82
81
 
83
- template("kitchen.yml.erb", ".kitchen.yml",
82
+ template("kitchen.yml.erb", "kitchen.yml",
84
83
  driver_plugin: driver_plugin.sub(/^kitchen-/, ""),
85
84
  provisioner: options[:provisioner],
86
85
  run_list: Array(run_list)
@@ -222,40 +221,6 @@ module Kitchen
222
221
  end
223
222
  end
224
223
 
225
- # Appends driver gems to a Gemfile or installs them.
226
- #
227
- # @api private
228
- def add_drivers
229
- return if options[:driver].nil? || options[:driver].empty?
230
-
231
- Array(options[:driver]).each do |driver_gem|
232
- if File.exist?(File.join(destination_root, "Gemfile")) || options[:create_gemfile]
233
- add_driver_to_gemfile(driver_gem)
234
- else
235
- install_gem(driver_gem)
236
- end
237
- end
238
- end
239
-
240
- # Appends a driver gem to a Gemfile.
241
- #
242
- # @api private
243
- def add_driver_to_gemfile(driver_gem)
244
- if not_in_file?("Gemfile", /gem ('|")#{driver_gem}('|")/)
245
- append_to_file("Gemfile", %{gem "#{driver_gem}"\n})
246
- @display_bundle_msg = true
247
- end
248
- end
249
-
250
- # Installs a driver gem.
251
- #
252
- # @api private
253
- def install_gem(driver_gem)
254
- unbundlerize { Gem::GemRunner.new.run(["install", driver_gem]) }
255
- rescue Gem::SystemExitException => e
256
- raise unless e.exit_code == 0
257
- end
258
-
259
224
  # Displays a bundle warning message to the user.
260
225
  #
261
226
  # @api private
File without changes
@@ -101,7 +101,7 @@ module Kitchen
101
101
  # @return [Hash] a new hash
102
102
  def to_hash
103
103
  hash = {}
104
- __getobj__.keys.each { |key| hash[key] = self[key] }
104
+ __getobj__.each_key { |key| hash[key] = self[key] }
105
105
  hash
106
106
  end
107
107
 
@@ -34,9 +34,9 @@ module Kitchen
34
34
  #
35
35
  # @param options [Hash] configuration for a new loader
36
36
  # @option options [String] :project_config path to the Kitchen
37
- # config YAML file (default: `./.kitchen.yml`)
37
+ # config YAML file (default: `./kitchen.yml`)
38
38
  # @option options [String] :local_config path to the Kitchen local
39
- # config YAML file (default: `./.kitchen.local.yml`)
39
+ # config YAML file (default: `./kitchen.local.yml`)
40
40
  # @option options [String] :global_config path to the Kitchen global
41
41
  # config YAML file (default: `$HOME/.kitchen/config.yml`)
42
42
  # @option options [String] :process_erb whether or not to process YAML
@@ -186,21 +186,46 @@ module Kitchen
186
186
  end
187
187
 
188
188
  # Determines the default absolute path to the Kitchen config YAML file,
189
- # based on current working directory.
189
+ # based on current working directory. We prefer `kitchen.yml` to the
190
+ # older `.kitchen.yml`.
190
191
  #
191
192
  # @return [String] an absolute path to a Kitchen config YAML file
192
193
  # @api private
193
194
  def default_config_file
195
+ if File.exist?(kitchen_yml) && File.exist?(dot_kitchen_yml)
196
+ raise UserError, "Both #{kitchen_yml} and #{dot_kitchen_yml} found. Please use the un-dotted variant: #{kitchen_yml}."
197
+ end
198
+
199
+ File.exist?(kitchen_yml) ? kitchen_yml : dot_kitchen_yml
200
+ end
201
+
202
+ # The absolute path to an un-hidden Kitchen config YAML file.
203
+ def kitchen_yml
204
+ File.join(Dir.pwd, "kitchen.yml")
205
+ end
206
+
207
+ # The absolute path to an hidden Kitchen config YAML file.
208
+ def dot_kitchen_yml
194
209
  File.join(Dir.pwd, ".kitchen.yml")
195
210
  end
196
211
 
197
212
  # Determines the default absolute path to the Kitchen local YAML file,
198
213
  # based on the base Kitchen config YAML file.
199
- #
214
+
200
215
  # @return [String] an absolute path to a Kitchen local YAML file
216
+ # @raise [UserError] if both dotted and undotted versions of the default
217
+ # local YAML file exist, e.g. both kitchen.local.yml and .kitchen.local.yml
201
218
  # @api private
202
219
  def default_local_config_file
203
- config_file.sub(/(#{File.extname(config_file)})$/, '.local\1')
220
+ config_dir, default_local_config = File.split(config_file.sub(/(#{File.extname(config_file)})$/, '.local\1'))
221
+
222
+ undot_config = default_local_config.sub(/^\./, "")
223
+ dot_config = ".#{undot_config}"
224
+ if File.exist?(File.join(config_dir, undot_config)) && File.exist?(File.join(config_dir, dot_config))
225
+ raise UserError, "Both #{undot_config} and #{dot_config} found in #{config_dir}. Please use #{default_local_config} which matches your #{config_file}."
226
+ end
227
+
228
+ File.join(config_dir, default_local_config)
204
229
  end
205
230
 
206
231
  # Determines the default absolute path to the Kitchen global YAML file,
@@ -322,7 +347,7 @@ module Kitchen
322
347
  def parse_yaml_string(string, file_name)
323
348
  return {} if string.nil? || string.empty?
324
349
 
325
- result = ::YAML.safe_load(string, [Symbol]) || {}
350
+ result = ::YAML.safe_load(string, [Symbol], [], true) || {}
326
351
  unless result.is_a?(Hash)
327
352
  raise UserError, "Error parsing #{file_name} as YAML " \
328
353
  "(Result of parse was not a Hash, but was a #{result.class}).\n" \
@@ -345,7 +345,7 @@ module Kitchen
345
345
  def <<(msg)
346
346
  @buffer ||= ""
347
347
  @buffer += msg
348
- while i = @buffer.index("\n")
348
+ while (i = @buffer.index("\n"))
349
349
  format_line(@buffer[0, i].chomp)
350
350
  @buffer[0, i + 1] = ""
351
351
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -85,27 +85,31 @@ module Kitchen
85
85
  # @api private
86
86
  attr_reader :always_update
87
87
 
88
- # Load the Berkshelf-specific libary code.
89
- #
90
- # @param logger [Kitchen::Logger] the logger to use
91
- # @raise [UserError] if the library couldn't be loaded
92
- # @api private
93
- def self.load_berkshelf!(logger)
94
- first_load = require "berkshelf"
88
+ class << self
89
+ private
95
90
 
96
- version = ::Berkshelf::VERSION
97
- if first_load
98
- logger.debug("Berkshelf #{version} library loaded")
99
- else
100
- logger.debug("Berkshelf #{version} previously loaded")
91
+ # Load the Berkshelf-specific libary code.
92
+ #
93
+ # @param logger [Kitchen::Logger] the logger to use
94
+ # @raise [UserError] if the library couldn't be loaded
95
+ # @api private
96
+ def load_berkshelf!(logger)
97
+ first_load = require "berkshelf"
98
+
99
+ version = ::Berkshelf::VERSION
100
+ if first_load
101
+ logger.debug("Berkshelf #{version} library loaded")
102
+ else
103
+ logger.debug("Berkshelf #{version} previously loaded")
104
+ end
105
+ rescue LoadError => e
106
+ logger.fatal("The `berkshelf' gem is missing and must be installed" \
107
+ " or cannot be properly activated. Run" \
108
+ " `gem install berkshelf` or add the following to your" \
109
+ " Gemfile if you are using Bundler: `gem 'berkshelf'`.")
110
+ raise UserError,
111
+ "Could not load or activate Berkshelf (#{e.message})"
101
112
  end
102
- rescue LoadError => e
103
- logger.fatal("The `berkshelf' gem is missing and must be installed" \
104
- " or cannot be properly activated. Run" \
105
- " `gem install berkshelf` or add the following to your" \
106
- " Gemfile if you are using Bundler: `gem 'berkshelf'`.")
107
- raise UserError,
108
- "Could not load or activate Berkshelf (#{e.message})"
109
113
  end
110
114
  end
111
115
  end
File without changes
@@ -78,29 +78,33 @@ module Kitchen
78
78
  # @api private
79
79
  attr_reader :logger
80
80
 
81
- # Load the Librarian-specific libary code.
82
- #
83
- # @param logger [Kitchen::Logger] the logger to use
84
- # @raise [UserError] if the library couldn't be loaded
85
- # @api private
86
- def self.load_librarian!(logger)
87
- first_load = require "librarian/chef/environment"
88
- require "librarian/action/resolve"
89
- require "librarian/action/install"
81
+ class << self
82
+ private
90
83
 
91
- version = ::Librarian::Chef::VERSION
92
- if first_load
93
- logger.debug("Librarian-Chef #{version} library loaded")
94
- else
95
- logger.debug("Librarian-Chef #{version} previously loaded")
84
+ # Load the Librarian-specific libary code.
85
+ #
86
+ # @param logger [Kitchen::Logger] the logger to use
87
+ # @raise [UserError] if the library couldn't be loaded
88
+ # @api private
89
+ def load_librarian!(logger)
90
+ first_load = require "librarian/chef/environment"
91
+ require "librarian/action/resolve"
92
+ require "librarian/action/install"
93
+
94
+ version = ::Librarian::Chef::VERSION
95
+ if first_load
96
+ logger.debug("Librarian-Chef #{version} library loaded")
97
+ else
98
+ logger.debug("Librarian-Chef #{version} previously loaded")
99
+ end
100
+ rescue LoadError => e
101
+ logger.fatal("The `librarian-chef' gem is missing and must be installed" \
102
+ " or cannot be properly activated. Run" \
103
+ " `gem install librarian-chef` or add the following to your" \
104
+ " Gemfile if you are using Bundler: `gem 'librarian-chef'`.")
105
+ raise UserError,
106
+ "Could not load or activate Librarian-Chef (#{e.message})"
96
107
  end
97
- rescue LoadError => e
98
- logger.fatal("The `librarian-chef' gem is missing and must be installed" \
99
- " or cannot be properly activated. Run" \
100
- " `gem install librarian-chef` or add the following to your" \
101
- " Gemfile if you are using Bundler: `gem 'librarian-chef'`.")
102
- raise UserError,
103
- "Could not load or activate Librarian-Chef (#{e.message})"
104
108
  end
105
109
  end
106
110
  end