chef-dk 1.2.22 → 1.3.40

Sign up to get free protection for your applications and to get access to all the features.
Files changed (232) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +8 -12
  3. data/Gemfile.lock +120 -116
  4. data/README.md +4 -3
  5. data/Rakefile +54 -0
  6. data/acceptance/Gemfile.lock +36 -47
  7. data/bin/chef +1 -1
  8. data/chef-dk.gemspec +9 -9
  9. data/lib/chef-dk/authenticated_http.rb +6 -7
  10. data/lib/chef-dk/builtin_commands.rb +3 -4
  11. data/lib/chef-dk/chef_runner.rb +7 -8
  12. data/lib/chef-dk/cli.rb +11 -11
  13. data/lib/chef-dk/command/base.rb +4 -4
  14. data/lib/chef-dk/command/clean_policy_cookbooks.rb +4 -5
  15. data/lib/chef-dk/command/clean_policy_revisions.rb +4 -6
  16. data/lib/chef-dk/command/delete_policy.rb +4 -6
  17. data/lib/chef-dk/command/delete_policy_group.rb +6 -8
  18. data/lib/chef-dk/command/diff.rb +9 -10
  19. data/lib/chef-dk/command/env.rb +26 -27
  20. data/lib/chef-dk/command/exec.rb +5 -6
  21. data/lib/chef-dk/command/export.rb +8 -10
  22. data/lib/chef-dk/command/gem.rb +5 -5
  23. data/lib/chef-dk/command/generate.rb +19 -19
  24. data/lib/chef-dk/command/generator_commands.rb +8 -8
  25. data/lib/chef-dk/command/generator_commands/app.rb +2 -3
  26. data/lib/chef-dk/command/generator_commands/attribute.rb +2 -3
  27. data/lib/chef-dk/command/generator_commands/base.rb +13 -13
  28. data/lib/chef-dk/command/generator_commands/build_cookbook.rb +2 -2
  29. data/lib/chef-dk/command/generator_commands/chef_exts/generator_desc_resource.rb +2 -2
  30. data/lib/chef-dk/command/generator_commands/chef_exts/quieter_doc_formatter.rb +1 -2
  31. data/lib/chef-dk/command/generator_commands/chef_exts/recipe_dsl_ext.rb +1 -2
  32. data/lib/chef-dk/command/generator_commands/cookbook.rb +2 -2
  33. data/lib/chef-dk/command/generator_commands/cookbook_code_file.rb +3 -3
  34. data/lib/chef-dk/command/generator_commands/cookbook_file.rb +2 -2
  35. data/lib/chef-dk/command/generator_commands/generator_generator.rb +4 -7
  36. data/lib/chef-dk/command/generator_commands/lwrp.rb +2 -2
  37. data/lib/chef-dk/command/generator_commands/policyfile.rb +2 -3
  38. data/lib/chef-dk/command/generator_commands/recipe.rb +2 -2
  39. data/lib/chef-dk/command/generator_commands/repo.rb +1 -3
  40. data/lib/chef-dk/command/generator_commands/template.rb +2 -2
  41. data/lib/chef-dk/command/install.rb +4 -5
  42. data/lib/chef-dk/command/provision.rb +12 -14
  43. data/lib/chef-dk/command/push.rb +5 -6
  44. data/lib/chef-dk/command/push_archive.rb +4 -5
  45. data/lib/chef-dk/command/shell_init.rb +15 -16
  46. data/lib/chef-dk/command/show_policy.rb +5 -7
  47. data/lib/chef-dk/command/undelete.rb +6 -7
  48. data/lib/chef-dk/command/update.rb +5 -6
  49. data/lib/chef-dk/command/verify.rb +30 -31
  50. data/lib/chef-dk/commands_map.rb +1 -3
  51. data/lib/chef-dk/component_test.rb +13 -13
  52. data/lib/chef-dk/configurable.rb +2 -2
  53. data/lib/chef-dk/cookbook_metadata.rb +2 -2
  54. data/lib/chef-dk/cookbook_omnifetch.rb +7 -8
  55. data/lib/chef-dk/cookbook_profiler/git.rb +8 -8
  56. data/lib/chef-dk/cookbook_profiler/identifiers.rb +7 -7
  57. data/lib/chef-dk/cookbook_profiler/null_scm.rb +0 -1
  58. data/lib/chef-dk/exceptions.rb +1 -1
  59. data/lib/chef-dk/generator.rb +9 -7
  60. data/lib/chef-dk/helpers.rb +15 -15
  61. data/lib/chef-dk/pager.rb +2 -3
  62. data/lib/chef-dk/policyfile/chef_repo_cookbook_source.rb +4 -4
  63. data/lib/chef-dk/policyfile/chef_server_cookbook_source.rb +6 -6
  64. data/lib/chef-dk/policyfile/community_cookbook_source.rb +4 -5
  65. data/lib/chef-dk/policyfile/comparison_base.rb +3 -4
  66. data/lib/chef-dk/policyfile/cookbook_location_specification.rb +6 -6
  67. data/lib/chef-dk/policyfile/cookbook_locks.rb +11 -11
  68. data/lib/chef-dk/policyfile/cookbook_sources.rb +5 -5
  69. data/lib/chef-dk/policyfile/delivery_supermarket_source.rb +8 -9
  70. data/lib/chef-dk/policyfile/differ.rb +7 -10
  71. data/lib/chef-dk/policyfile/dsl.rb +10 -11
  72. data/lib/chef-dk/policyfile/lister.rb +3 -6
  73. data/lib/chef-dk/policyfile/null_cookbook_source.rb +3 -3
  74. data/lib/chef-dk/policyfile/read_cookbook_for_compat_mode_upload.rb +3 -3
  75. data/lib/chef-dk/policyfile/reports/install.rb +3 -4
  76. data/lib/chef-dk/policyfile/reports/table_printer.rb +0 -1
  77. data/lib/chef-dk/policyfile/reports/upload.rb +4 -4
  78. data/lib/chef-dk/policyfile/solution_dependencies.rb +22 -22
  79. data/lib/chef-dk/policyfile/source_uri.rb +2 -2
  80. data/lib/chef-dk/policyfile/storage_config.rb +4 -5
  81. data/lib/chef-dk/policyfile/undo_record.rb +6 -9
  82. data/lib/chef-dk/policyfile/undo_stack.rb +5 -7
  83. data/lib/chef-dk/policyfile/uploader.rb +8 -8
  84. data/lib/chef-dk/policyfile_compiler.rb +16 -20
  85. data/lib/chef-dk/policyfile_lock.rb +10 -11
  86. data/lib/chef-dk/policyfile_services/clean_policies.rb +3 -3
  87. data/lib/chef-dk/policyfile_services/clean_policy_cookbooks.rb +3 -5
  88. data/lib/chef-dk/policyfile_services/export_repo.rb +13 -14
  89. data/lib/chef-dk/policyfile_services/install.rb +6 -6
  90. data/lib/chef-dk/policyfile_services/push.rb +6 -8
  91. data/lib/chef-dk/policyfile_services/push_archive.rb +6 -10
  92. data/lib/chef-dk/policyfile_services/rm_policy.rb +4 -5
  93. data/lib/chef-dk/policyfile_services/rm_policy_group.rb +4 -5
  94. data/lib/chef-dk/policyfile_services/show_policy.rb +5 -6
  95. data/lib/chef-dk/policyfile_services/undelete.rb +3 -3
  96. data/lib/chef-dk/policyfile_services/update_attributes.rb +4 -6
  97. data/lib/chef-dk/service_exception_inspectors.rb +2 -3
  98. data/lib/chef-dk/service_exception_inspectors/base.rb +0 -1
  99. data/lib/chef-dk/service_exception_inspectors/http.rb +1 -3
  100. data/lib/chef-dk/service_exceptions.rb +1 -2
  101. data/lib/chef-dk/shell_out.rb +1 -1
  102. data/lib/chef-dk/skeletons/code_generator/files/default/build_cookbook/.kitchen.yml +2 -2
  103. data/lib/chef-dk/skeletons/code_generator/files/default/build_cookbook/README.md +2 -2
  104. data/lib/chef-dk/skeletons/code_generator/files/default/build_cookbook/test-fixture-recipe.rb +1 -0
  105. data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/attributes/default.rb +1 -1
  106. data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/recipes/default.rb +1 -1
  107. data/lib/chef-dk/skeletons/code_generator/metadata.rb +0 -1
  108. data/lib/chef-dk/skeletons/code_generator/recipes/app.rb +6 -6
  109. data/lib/chef-dk/skeletons/code_generator/recipes/attribute.rb +3 -3
  110. data/lib/chef-dk/skeletons/code_generator/recipes/build_cookbook.rb +43 -39
  111. data/lib/chef-dk/skeletons/code_generator/recipes/cookbook.rb +31 -22
  112. data/lib/chef-dk/skeletons/code_generator/recipes/cookbook_file.rb +5 -5
  113. data/lib/chef-dk/skeletons/code_generator/recipes/lwrp.rb +4 -4
  114. data/lib/chef-dk/skeletons/code_generator/recipes/policyfile.rb +1 -1
  115. data/lib/chef-dk/skeletons/code_generator/recipes/recipe.rb +8 -8
  116. data/lib/chef-dk/skeletons/code_generator/recipes/repo.rb +15 -15
  117. data/lib/chef-dk/skeletons/code_generator/recipes/template.rb +6 -6
  118. data/lib/chef-dk/skeletons/code_generator/templates/default/build_cookbook/Berksfile.erb +0 -2
  119. data/lib/chef-dk/skeletons/code_generator/templates/default/build_cookbook/metadata.rb.erb +1 -0
  120. data/lib/chef-dk/skeletons/code_generator/templates/default/inspec_default_test.rb.erb +4 -4
  121. data/lib/chef-dk/skeletons/code_generator/templates/default/kitchen.yml.erb +1 -1
  122. data/lib/chef-dk/skeletons/code_generator/templates/default/kitchen_policyfile.yml.erb +1 -1
  123. data/lib/chef-dk/skeletons/code_generator/templates/default/metadata.rb.erb +4 -3
  124. data/lib/chef-dk/skeletons/code_generator/templates/default/recipe_spec.rb.erb +4 -2
  125. data/lib/chef-dk/ui.rb +0 -1
  126. data/lib/chef-dk/version.rb +1 -1
  127. data/lib/kitchen/provisioner/policyfile_zero.rb +7 -7
  128. data/omnibus_overrides.rb +3 -3
  129. data/spec/shared/a_file_generator.rb +3 -3
  130. data/spec/shared/custom_generator_cookbook.rb +6 -6
  131. data/spec/shared/fixture_cookbook_checksums.rb +2 -3
  132. data/spec/shared/setup_git_committer_config.rb +1 -1
  133. data/spec/shared/setup_git_cookbooks.rb +2 -2
  134. data/spec/spec_helper.rb +5 -5
  135. data/spec/test_helpers.rb +2 -2
  136. data/spec/unit/chef_runner_spec.rb +5 -7
  137. data/spec/unit/cli_spec.rb +36 -37
  138. data/spec/unit/command/base_spec.rb +4 -5
  139. data/spec/unit/command/clean_policy_cookbooks_spec.rb +8 -9
  140. data/spec/unit/command/clean_policy_revisions_spec.rb +8 -9
  141. data/spec/unit/command/delete_policy_group_spec.rb +11 -12
  142. data/spec/unit/command/delete_policy_spec.rb +11 -12
  143. data/spec/unit/command/diff_spec.rb +5 -6
  144. data/spec/unit/command/env_spec.rb +5 -5
  145. data/spec/unit/command/exec_spec.rb +18 -19
  146. data/spec/unit/command/export_spec.rb +5 -6
  147. data/spec/unit/command/generate_spec.rb +10 -10
  148. data/spec/unit/command/generator_commands/app_spec.rb +6 -6
  149. data/spec/unit/command/generator_commands/attribute_spec.rb +3 -4
  150. data/spec/unit/command/generator_commands/base_spec.rb +46 -46
  151. data/spec/unit/command/generator_commands/build_cookbook_spec.rb +50 -16
  152. data/spec/unit/command/generator_commands/chef_exts/generator_desc_resource_spec.rb +9 -9
  153. data/spec/unit/command/generator_commands/chef_exts/recipe_dsl_ext_spec.rb +16 -16
  154. data/spec/unit/command/generator_commands/cookbook_file_spec.rb +3 -4
  155. data/spec/unit/command/generator_commands/cookbook_spec.rb +23 -26
  156. data/spec/unit/command/generator_commands/generator_generator_spec.rb +4 -6
  157. data/spec/unit/command/generator_commands/lwrp_spec.rb +3 -4
  158. data/spec/unit/command/generator_commands/policyfile_spec.rb +3 -5
  159. data/spec/unit/command/generator_commands/recipe_spec.rb +4 -4
  160. data/spec/unit/command/generator_commands/repo_spec.rb +11 -11
  161. data/spec/unit/command/generator_commands/template_spec.rb +3 -4
  162. data/spec/unit/command/install_spec.rb +6 -6
  163. data/spec/unit/command/provision_spec.rb +27 -30
  164. data/spec/unit/command/push_archive_spec.rb +3 -3
  165. data/spec/unit/command/push_spec.rb +5 -6
  166. data/spec/unit/command/shell_init_spec.rb +17 -19
  167. data/spec/unit/command/show_policy_spec.rb +11 -12
  168. data/spec/unit/command/undelete_spec.rb +12 -14
  169. data/spec/unit/command/update_spec.rb +8 -8
  170. data/spec/unit/command/verify_spec.rb +10 -10
  171. data/spec/unit/commands_map_spec.rb +4 -4
  172. data/spec/unit/component_test_spec.rb +3 -3
  173. data/spec/unit/configurable_spec.rb +7 -7
  174. data/spec/unit/cookbook_metadata_spec.rb +5 -7
  175. data/spec/unit/cookbook_profiler/git_spec.rb +6 -7
  176. data/spec/unit/cookbook_profiler/identifiers_spec.rb +5 -7
  177. data/spec/unit/fixtures/command/cli_test_command.rb +2 -2
  178. data/spec/unit/fixtures/configurable/test_configurable.rb +1 -1
  179. data/spec/unit/fixtures/cookbooks_api/update_fixtures.rb +13 -16
  180. data/spec/unit/fixtures/eg_omnibus_dir/valid/embedded/apps/berkshelf/verify_me +1 -1
  181. data/spec/unit/gemfile_util_spec.rb +4 -4
  182. data/spec/unit/generator_spec.rb +10 -10
  183. data/spec/unit/helpers_spec.rb +31 -31
  184. data/spec/unit/pager_spec.rb +5 -7
  185. data/spec/unit/policyfile/chef_repo_cookbook_source_spec.rb +11 -11
  186. data/spec/unit/policyfile/chef_server_cookbook_source_spec.rb +13 -13
  187. data/spec/unit/policyfile/community_cookbook_source_spec.rb +3 -4
  188. data/spec/unit/policyfile/comparison_base_spec.rb +3 -6
  189. data/spec/unit/policyfile/cookbook_location_specification_spec.rb +3 -3
  190. data/spec/unit/policyfile/cookbook_locks_spec.rb +7 -9
  191. data/spec/unit/policyfile/delivery_supermarket_source_spec.rb +16 -17
  192. data/spec/unit/policyfile/differ_spec.rb +4 -5
  193. data/spec/unit/policyfile/lister_spec.rb +31 -35
  194. data/spec/unit/policyfile/null_cookbook_source_spec.rb +2 -3
  195. data/spec/unit/policyfile/read_cookbook_for_compat_mode_upload_spec.rb +3 -3
  196. data/spec/unit/policyfile/reports/install_spec.rb +4 -5
  197. data/spec/unit/policyfile/reports/upload_spec.rb +4 -6
  198. data/spec/unit/policyfile/solution_dependencies_spec.rb +13 -13
  199. data/spec/unit/policyfile/source_uri_spec.rb +5 -5
  200. data/spec/unit/policyfile/storage_config_spec.rb +3 -7
  201. data/spec/unit/policyfile/undo_record_spec.rb +21 -23
  202. data/spec/unit/policyfile/undo_stack_spec.rb +5 -6
  203. data/spec/unit/policyfile/uploader_spec.rb +73 -75
  204. data/spec/unit/policyfile_demands_spec.rb +93 -99
  205. data/spec/unit/policyfile_evaluation_spec.rb +14 -14
  206. data/spec/unit/policyfile_lock_build_spec.rb +64 -65
  207. data/spec/unit/policyfile_lock_install_spec.rb +5 -6
  208. data/spec/unit/policyfile_lock_serialization_spec.rb +14 -15
  209. data/spec/unit/policyfile_lock_validation_spec.rb +17 -20
  210. data/spec/unit/policyfile_services/clean_policies_spec.rb +16 -16
  211. data/spec/unit/policyfile_services/clean_policy_cookbooks_spec.rb +26 -29
  212. data/spec/unit/policyfile_services/export_repo_spec.rb +3 -6
  213. data/spec/unit/policyfile_services/install_spec.rb +5 -7
  214. data/spec/unit/policyfile_services/push_archive_spec.rb +4 -8
  215. data/spec/unit/policyfile_services/push_spec.rb +3 -3
  216. data/spec/unit/policyfile_services/rm_policy_group_spec.rb +16 -20
  217. data/spec/unit/policyfile_services/rm_policy_spec.rb +14 -17
  218. data/spec/unit/policyfile_services/show_policy_spec.rb +78 -80
  219. data/spec/unit/policyfile_services/undelete_spec.rb +5 -7
  220. data/spec/unit/policyfile_services/update_attributes_spec.rb +34 -35
  221. data/spec/unit/service_exception_inspectors/base_spec.rb +2 -4
  222. data/spec/unit/service_exception_inspectors/http_spec.rb +9 -11
  223. data/spec/unit/shell_out_spec.rb +2 -2
  224. data/spec/unit/tasks/helpers_spec.rb +2 -2
  225. data/tasks/bin/bundle-platform +1 -1
  226. data/tasks/bundle_util.rb +1 -1
  227. data/tasks/dependencies.rb +21 -7
  228. data/tasks/gemfile_util.rb +1 -1
  229. data/tasks/helpers.rb +2 -2
  230. data/tasks/version.rb +26 -1
  231. data/version_policy.rb +6 -6
  232. metadata +3 -3
@@ -15,8 +15,8 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'chef-dk/policyfile/null_cookbook_source'
19
- require 'chef-dk/policyfile/community_cookbook_source'
20
- require 'chef-dk/policyfile/chef_server_cookbook_source'
21
- require 'chef-dk/policyfile/chef_repo_cookbook_source'
22
- require 'chef-dk/policyfile/delivery_supermarket_source'
18
+ require "chef-dk/policyfile/null_cookbook_source"
19
+ require "chef-dk/policyfile/community_cookbook_source"
20
+ require "chef-dk/policyfile/chef_server_cookbook_source"
21
+ require "chef-dk/policyfile/chef_repo_cookbook_source"
22
+ require "chef-dk/policyfile/delivery_supermarket_source"
@@ -15,11 +15,11 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'forwardable'
18
+ require "forwardable"
19
19
 
20
- require 'semverse'
20
+ require "semverse"
21
21
 
22
- require 'chef-dk/policyfile/community_cookbook_source'
22
+ require "chef-dk/policyfile/community_cookbook_source"
23
23
 
24
24
  module ChefDK
25
25
  module Policyfile
@@ -71,11 +71,11 @@ module ChefDK
71
71
  @universe_graph ||= begin
72
72
  @community_source.universe_graph.inject({}) do |truncated, (cookbook_name, version_and_deps_list)|
73
73
  sorted_versions = version_and_deps_list.keys.sort_by do |version_string|
74
- Semverse::Version.new(version_string)
75
- end
76
- greatest_version = sorted_versions.last
77
- truncated[cookbook_name] = { greatest_version => version_and_deps_list[greatest_version] }
78
- truncated
74
+ Semverse::Version.new(version_string)
75
+ end
76
+ greatest_version = sorted_versions.last
77
+ truncated[cookbook_name] = { greatest_version => version_and_deps_list[greatest_version] }
78
+ truncated
79
79
  end
80
80
  end
81
81
  end
@@ -87,4 +87,3 @@ module ChefDK
87
87
  end
88
88
  end
89
89
  end
90
-
@@ -15,10 +15,10 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'diff/lcs'
19
- require 'diff/lcs/hunk'
20
- require 'paint'
21
- require 'ffi_yajl'
18
+ require "diff/lcs"
19
+ require "diff/lcs/hunk"
20
+ require "paint"
21
+ require "ffi_yajl"
22
22
 
23
23
  module ChefDK
24
24
  module Policyfile
@@ -29,7 +29,6 @@ module ChefDK
29
29
  INITIAL_FILE_LENGTH_DIFFERENCE = 0
30
30
  FORMAT = :unified
31
31
 
32
-
33
32
  attr_reader :old_lock
34
33
  attr_reader :old_name
35
34
  attr_reader :new_lock
@@ -88,7 +87,7 @@ module ChefDK
88
87
  end
89
88
 
90
89
  def report_rev_id_changes
91
- h1('REVISION ID CHANGED')
90
+ h1("REVISION ID CHANGED")
92
91
  old_rev = old_lock["revision_id"]
93
92
  new_rev = new_lock["revision_id"]
94
93
  diff_lines([ old_rev ], [ new_rev ])
@@ -179,12 +178,12 @@ module ChefDK
179
178
 
180
179
  def h1(str)
181
180
  ui.msg(str)
182
- ui.msg('=' * str.size)
181
+ ui.msg("=" * str.size)
183
182
  end
184
183
 
185
184
  def h2(str)
186
185
  ui.msg(str)
187
- ui.msg('-' * str.size)
186
+ ui.msg("-" * str.size)
188
187
  end
189
188
 
190
189
  def diff_lines(old_lines, new_lines)
@@ -259,8 +258,6 @@ module ChefDK
259
258
  end
260
259
  end
261
260
 
262
-
263
261
  end
264
262
  end
265
263
  end
266
-
@@ -15,18 +15,18 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'chef-dk/policyfile/cookbook_sources'
19
- require 'chef-dk/policyfile/cookbook_location_specification'
20
- require 'chef-dk/policyfile/storage_config'
18
+ require "chef-dk/policyfile/cookbook_sources"
19
+ require "chef-dk/policyfile/cookbook_location_specification"
20
+ require "chef-dk/policyfile/storage_config"
21
21
 
22
- require 'chef/node/attribute'
23
- require 'chef/run_list/run_list_item'
22
+ require "chef/node/attribute"
23
+ require "chef/run_list/run_list_item"
24
24
 
25
25
  module ChefDK
26
26
  module Policyfile
27
27
  class DSL
28
28
 
29
- RUN_LIST_ITEM_COMPONENT = %r/^[.[:alnum:]_-]+$/.freeze
29
+ RUN_LIST_ITEM_COMPONENT = %r{^[.[:alnum:]_-]+$}
30
30
 
31
31
  include StorageConfigDelegation
32
32
 
@@ -108,7 +108,6 @@ module ChefDK
108
108
  constraint = version_and_source_opts.first || ">= 0.0.0"
109
109
  spec = CookbookLocationSpecification.new(name, constraint, source_options, storage_config)
110
110
 
111
-
112
111
  if existing_source = @cookbook_location_specs[name]
113
112
  err = "Cookbook '#{name}' assigned to conflicting sources\n\n"
114
113
  err << "Previous source: #{existing_source.source_options.inspect}\n"
@@ -140,7 +139,7 @@ module ChefDK
140
139
  raise
141
140
  rescue Exception => e
142
141
  error_message = "Evaluation of policyfile '#{policyfile_filename}' raised an exception\n"
143
- error_message << " Exception: #{e.class.name} \"#{e.to_s}\"\n\n"
142
+ error_message << " Exception: #{e.class.name} \"#{e}\"\n\n"
144
143
  trace = filtered_bt(policyfile_filename, e)
145
144
  error_message << " Relevant Code:\n"
146
145
  error_message << " #{error_context(policyfile_string, policyfile_filename, e)}\n\n"
@@ -201,7 +200,7 @@ module ChefDK
201
200
  run_list_desc = run_list_name.nil? ? "Run List Item '#{item}'" : "Named Run List '#{run_list_name}' Item '#{item}'"
202
201
 
203
202
  item_name = Chef::RunList::RunListItem.new(item).name
204
- cookbook, separator, recipe = item_name.partition('::')
203
+ cookbook, separator, recipe = item_name.partition("::")
205
204
 
206
205
  if RUN_LIST_ITEM_COMPONENT.match(cookbook).nil?
207
206
  message = "#{run_list_desc} has invalid cookbook name '#{cookbook}'.\nCookbook names can only contain alphanumerics, hyphens, and underscores."
@@ -247,7 +246,7 @@ module ChefDK
247
246
 
248
247
  def culprit_line_number(policyfile_filename, exception)
249
248
  if most_proximate_backtrace_line = filtered_bt(policyfile_filename, exception).first
250
- most_proximate_backtrace_line[/^(?:.\:)?[^:]+:([\d]+)/,1].to_i
249
+ most_proximate_backtrace_line[/^(?:.\:)?[^:]+:([\d]+)/, 1].to_i
251
250
  else
252
251
  nil
253
252
  end
@@ -255,7 +254,7 @@ module ChefDK
255
254
 
256
255
  def filtered_bt(policyfile_filename, exception)
257
256
  policyfile_filename_matcher = /^#{Regexp.escape(policyfile_filename)}/
258
- exception.backtrace.select {|line| line =~ policyfile_filename_matcher }
257
+ exception.backtrace.select { |line| line =~ policyfile_filename_matcher }
259
258
  end
260
259
 
261
260
  end
@@ -15,10 +15,10 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'set'
18
+ require "set"
19
19
 
20
- require 'chef-dk/authenticated_http'
21
- require 'chef-dk/service_exceptions'
20
+ require "chef-dk/authenticated_http"
21
+ require "chef-dk/service_exceptions"
22
22
 
23
23
  module ChefDK
24
24
  module Policyfile
@@ -33,7 +33,6 @@ module ChefDK
33
33
  @lock_info_by_rev_id = lock_info_by_rev_id
34
34
  end
35
35
 
36
-
37
36
  def cb_info_for(rev_id, cookbook_name)
38
37
  lock = lock_info_by_rev_id[rev_id]
39
38
  cookbook_lock = lock["cookbook_locks"][cookbook_name]
@@ -228,5 +227,3 @@ module ChefDK
228
227
  end
229
228
  end
230
229
  end
231
-
232
-
@@ -15,13 +15,13 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'chef-dk/exceptions'
18
+ require "chef-dk/exceptions"
19
19
 
20
20
  module ChefDK
21
21
  module Policyfile
22
22
  class NullCookbookSource
23
23
 
24
- def initialize(_uri=nil)
24
+ def initialize(_uri = nil)
25
25
  end
26
26
 
27
27
  def universe_graph
@@ -29,7 +29,7 @@ module ChefDK
29
29
  end
30
30
 
31
31
  def source_options_for(cookbook_name, cookbook_version)
32
- raise UnsupportedFeature, 'You must set a default_source in your Policyfile to download cookbooks without explicit sources'
32
+ raise UnsupportedFeature, "You must set a default_source in your Policyfile to download cookbooks without explicit sources"
33
33
  end
34
34
 
35
35
  def null?
@@ -16,9 +16,9 @@
16
16
  #
17
17
 
18
18
  # This fixes a missing require in chef/digester:
19
- require 'singleton'
20
- require 'chef/cookbook/cookbook_version_loader'
21
- require 'chef/cookbook/chefignore'
19
+ require "singleton"
20
+ require "chef/cookbook/cookbook_version_loader"
21
+ require "chef/cookbook/chefignore"
22
22
 
23
23
  module ChefDK
24
24
  module Policyfile
@@ -15,7 +15,7 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'chef-dk/policyfile/reports/table_printer'
18
+ require "chef-dk/policyfile/reports/table_printer"
19
19
 
20
20
  module ChefDK
21
21
  module Policyfile
@@ -48,7 +48,7 @@ module ChefDK
48
48
 
49
49
  def fixed_version_install_table
50
50
  @fixed_version_install_table ||= TablePrinter.new(ui) do |t|
51
- t.column(["Using", "Installing"])
51
+ t.column(%w{Using Installing})
52
52
  t.column(policyfile_compiler.fixed_version_cookbooks_specs.keys)
53
53
  t.column
54
54
  t.column
@@ -57,7 +57,7 @@ module ChefDK
57
57
 
58
58
  def install_table
59
59
  @install_table ||= TablePrinter.new(ui) do |t|
60
- t.column(["Using", "Installing"])
60
+ t.column(%w{Using Installing})
61
61
  t.column(policyfile_compiler.graph_solution.keys)
62
62
  t.column(policyfile_compiler.graph_solution.values)
63
63
  end
@@ -67,4 +67,3 @@ module ChefDK
67
67
  end
68
68
  end
69
69
  end
70
-
@@ -55,4 +55,3 @@ module ChefDK
55
55
  end
56
56
  end
57
57
  end
58
-
@@ -15,7 +15,7 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'chef-dk/policyfile/reports/table_printer'
18
+ require "chef-dk/policyfile/reports/table_printer"
19
19
 
20
20
  module ChefDK
21
21
  module Policyfile
@@ -38,18 +38,18 @@ module ChefDK
38
38
  def show
39
39
  reused_cbs.each do |cb_with_lock|
40
40
  lock = cb_with_lock.lock
41
- table.print_row("Using", lock.name, lock.version, "(#{lock.identifier[0,8]})")
41
+ table.print_row("Using", lock.name, lock.version, "(#{lock.identifier[0, 8]})")
42
42
  end
43
43
 
44
44
  uploaded_cbs.each do |cb_with_lock|
45
45
  lock = cb_with_lock.lock
46
- table.print_row("Uploaded", lock.name, lock.version, "(#{lock.identifier[0,8]})")
46
+ table.print_row("Uploaded", lock.name, lock.version, "(#{lock.identifier[0, 8]})")
47
47
  end
48
48
  end
49
49
 
50
50
  def table
51
51
  @table ||= TablePrinter.new(ui) do |t|
52
- t.column(%w[ Using Uploaded ])
52
+ t.column(%w{ Using Uploaded })
53
53
  t.column(cookbook_names)
54
54
  t.column(cookbook_version_numbers)
55
55
  t.column
@@ -15,9 +15,9 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'semverse'
18
+ require "semverse"
19
19
 
20
- require 'chef-dk/exceptions'
20
+ require "chef-dk/exceptions"
21
21
 
22
22
  module ChefDK
23
23
  module Policyfile
@@ -35,7 +35,7 @@ module ChefDK
35
35
  end
36
36
 
37
37
  def self.parse(str)
38
- name, version_w_parens = str.split(' ')
38
+ name, version_w_parens = str.split(" ")
39
39
  version = version_w_parens[/\(([^)]+)\)/, 1]
40
40
  new(name, version)
41
41
  end
@@ -45,8 +45,8 @@ module ChefDK
45
45
  end
46
46
 
47
47
  def eql?(other)
48
- other.kind_of?(self.class) and
49
- other.name == name and
48
+ other.kind_of?(self.class) &&
49
+ other.name == name &&
50
50
  other.version == version
51
51
  end
52
52
 
@@ -57,7 +57,7 @@ module ChefDK
57
57
  end
58
58
 
59
59
  def self.from_lock(lock_data)
60
- new.tap {|e| e.consume_lock_data(lock_data) }
60
+ new.tap { |e| e.consume_lock_data(lock_data) }
61
61
  end
62
62
 
63
63
  attr_reader :policyfile_dependencies
@@ -84,7 +84,7 @@ module ChefDK
84
84
  end
85
85
 
86
86
  def consume_lock_data(lock_data)
87
- unless lock_data.key?("Policyfile") and lock_data.key?("dependencies")
87
+ unless lock_data.key?("Policyfile") && lock_data.key?("dependencies")
88
88
  msg = %Q|lockfile solution_dependencies must be a Hash of the form `{"Policyfile": [], "dependencies": {} }' (got: #{lock_data.inspect})|
89
89
  raise InvalidLockfile, msg
90
90
  end
@@ -154,8 +154,8 @@ module ChefDK
154
154
  policyfile_conflicts = []
155
155
 
156
156
  @policyfile_dependencies.each do |dep_name, constraint|
157
- if dep_name == cookbook_name and !constraint.satisfies?(version)
158
- policyfile_conflicts << ['Policyfile', dep_name, constraint]
157
+ if dep_name == cookbook_name && !constraint.satisfies?(version)
158
+ policyfile_conflicts << ["Policyfile", dep_name, constraint]
159
159
  end
160
160
  end
161
161
 
@@ -167,7 +167,7 @@ module ChefDK
167
167
 
168
168
  @cookbook_dependencies.each do |top_level_dep_name, dependencies|
169
169
  dependencies.each do |dep_name, constraint|
170
- if dep_name == cookbook_name and !constraint.satisfies?(version)
170
+ if dep_name == cookbook_name && !constraint.satisfies?(version)
171
171
  cookbook_conflicts << [top_level_dep_name, dep_name, constraint]
172
172
  end
173
173
  end
@@ -195,7 +195,7 @@ module ChefDK
195
195
  end
196
196
 
197
197
  def find_cookbook_dep_by_name(name)
198
- @cookbook_dependencies.find { |k,v| k.name == name }
198
+ @cookbook_dependencies.find { |k, v| k.name == name }
199
199
  end
200
200
 
201
201
  def find_cookbook_dep_by_name_and_version(name, version)
@@ -216,19 +216,19 @@ module ChefDK
216
216
  end
217
217
 
218
218
  def add_policyfile_dep_from_lock_data(entry)
219
- unless entry.kind_of?(Array) and entry.size == 2
220
- msg = %Q(lockfile solution_dependencies Policyfile dependencies entry must be like [ "$COOKBOOK_NAME", "$CONSTRAINT" ] (got: #{entry.inspect}))
219
+ unless entry.kind_of?(Array) && entry.size == 2
220
+ msg = %Q{lockfile solution_dependencies Policyfile dependencies entry must be like [ "$COOKBOOK_NAME", "$CONSTRAINT" ] (got: #{entry.inspect})}
221
221
  raise InvalidLockfile, msg
222
222
  end
223
223
 
224
224
  cookbook_name, constraint = entry
225
225
 
226
- unless cookbook_name.kind_of?(String) and !cookbook_name.empty?
226
+ unless cookbook_name.kind_of?(String) && !cookbook_name.empty?
227
227
  msg = "lockfile solution_dependencies Policyfile dependencies entry. Cookbook name portion must be a string (got: #{entry.inspect})"
228
228
  raise InvalidLockfile, msg
229
229
  end
230
230
 
231
- unless constraint.kind_of?(String) and !constraint.empty?
231
+ unless constraint.kind_of?(String) && !constraint.empty?
232
232
  msg = "malformed lockfile solution_dependencies Policyfile dependencies entry. Version constraint portion must be a string (got: #{entry.inspect})"
233
233
  raise InvalidLockfile, msg
234
234
  end
@@ -254,35 +254,35 @@ module ChefDK
254
254
  def add_cookbook_dep_from_lock_data(name_and_version, deps_list)
255
255
  unless name_and_version.kind_of?(String)
256
256
  show = "#{name_and_version.inspect} => #{deps_list.inspect}"
257
- msg = %Q(lockfile cookbook_dependencies entries must be of the form "$COOKBOOK_NAME ($VERSION)" => [ $dependency, ...] (got: #{show}) )
257
+ msg = %Q{lockfile cookbook_dependencies entries must be of the form "$COOKBOOK_NAME ($VERSION)" => [ $dependency, ...] (got: #{show}) }
258
258
  raise InvalidLockfile, msg
259
259
  end
260
260
 
261
261
  unless Cookbook.valid_str?(name_and_version)
262
- msg = %Q(lockfile cookbook_dependencies entry keys must be of the form "$COOKBOOK_NAME ($VERSION)" (got: #{name_and_version.inspect}) )
262
+ msg = %Q{lockfile cookbook_dependencies entry keys must be of the form "$COOKBOOK_NAME ($VERSION)" (got: #{name_and_version.inspect}) }
263
263
  raise InvalidLockfile, msg
264
264
  end
265
265
 
266
266
  unless deps_list.kind_of?(Array)
267
- msg = %Q(lockfile cookbook_dependencies entry values must be an Array like [ [ "$COOKBOOK_NAME", "$CONSTRAINT" ], ... ] (got: #{deps_list.inspect}) )
267
+ msg = %Q{lockfile cookbook_dependencies entry values must be an Array like [ [ "$COOKBOOK_NAME", "$CONSTRAINT" ], ... ] (got: #{deps_list.inspect}) }
268
268
  raise InvalidLockfile, msg
269
269
  end
270
270
 
271
271
  deps_list.each do |entry|
272
272
 
273
- unless entry.kind_of?(Array) and entry.size == 2
274
- msg = %Q(lockfile solution_dependencies dependencies entry must be like [ "$COOKBOOK_NAME", "$CONSTRAINT" ] (got: #{entry.inspect}))
273
+ unless entry.kind_of?(Array) && entry.size == 2
274
+ msg = %Q{lockfile solution_dependencies dependencies entry must be like [ "$COOKBOOK_NAME", "$CONSTRAINT" ] (got: #{entry.inspect})}
275
275
  raise InvalidLockfile, msg
276
276
  end
277
277
 
278
278
  dep_name, constraint = entry
279
279
 
280
- unless dep_name.kind_of?(String) and !dep_name.empty?
280
+ unless dep_name.kind_of?(String) && !dep_name.empty?
281
281
  msg = "malformed lockfile solution_dependencies dependencies entry. Cookbook name portion must be a string (got: #{entry.inspect})"
282
282
  raise InvalidLockfile, msg
283
283
  end
284
284
 
285
- unless constraint.kind_of?(String) and !constraint.empty?
285
+ unless constraint.kind_of?(String) && !constraint.empty?
286
286
  msg = "malformed lockfile solution_dependencies dependencies entry. Version constraint portion must be a string (got: #{entry.inspect})"
287
287
  raise InvalidLockfile, msg
288
288
  end