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 'spec_helper'
19
- require 'chef-dk/policyfile_compiler'
18
+ require "spec_helper"
19
+ require "chef-dk/policyfile_compiler"
20
20
 
21
21
  describe ChefDK::PolicyfileCompiler do
22
22
 
@@ -52,7 +52,7 @@ describe ChefDK::PolicyfileCompiler do
52
52
  let(:policyfile_rb) { "{{{{::::{{::" }
53
53
 
54
54
  it "has a syntax error message" do
55
- expected_error=<<-E
55
+ expected_error = <<-E
56
56
  Invalid ruby syntax in policyfile 'TestPolicyfile.rb':
57
57
 
58
58
  TestPolicyfile.rb:1: syntax error, unexpected :: at EXPR_BEG, expecting tCONSTANT
@@ -248,11 +248,11 @@ E
248
248
  end
249
249
 
250
250
  it "has a run_list" do
251
- expect(policyfile.run_list).to eq(%w[foo bar])
251
+ expect(policyfile.run_list).to eq(%w{foo bar})
252
252
  end
253
253
 
254
254
  it "gives the run_list as the expanded run_list" do
255
- expect(policyfile.expanded_run_list).to eq(%w[foo bar])
255
+ expect(policyfile.expanded_run_list).to eq(%w{foo bar})
256
256
  end
257
257
 
258
258
  it "has no default cookbook source" do
@@ -452,11 +452,11 @@ E
452
452
  expect(policyfile.default_source.size).to eq(2)
453
453
 
454
454
  public_supermarket = policyfile.default_source.first
455
- expect(public_supermarket.preferred_cookbooks).to eq(%w[ foo ])
455
+ expect(public_supermarket.preferred_cookbooks).to eq(%w{ foo })
456
456
 
457
457
  private_supermarket = policyfile.default_source.last
458
458
  expect(private_supermarket.uri).to eq("https://mart.example")
459
- expect(private_supermarket.preferred_cookbooks).to eq(%w[ bar baz ])
459
+ expect(private_supermarket.preferred_cookbooks).to eq(%w{ bar baz })
460
460
  end
461
461
 
462
462
  end
@@ -507,7 +507,7 @@ MESSAGE
507
507
  end
508
508
 
509
509
  it "sets the source of the cookbook to the local path" do
510
- expected_cb_spec = ChefDK::Policyfile::CookbookLocationSpecification.new("foo", ">= 0.0.0", {path: "local_cookbooks/foo"}, storage_config)
510
+ expected_cb_spec = ChefDK::Policyfile::CookbookLocationSpecification.new("foo", ">= 0.0.0", { path: "local_cookbooks/foo" }, storage_config)
511
511
  expect(policyfile.cookbook_location_specs).to eq("foo" => expected_cb_spec)
512
512
  end
513
513
 
@@ -522,7 +522,7 @@ MESSAGE
522
522
  end
523
523
 
524
524
  it "sets the source of the cookbook to the git URL" do
525
- expected_cb_spec = ChefDK::Policyfile::CookbookLocationSpecification.new("foo", ">= 0.0.0", {git: "git://example.com:me/foo-cookbook.git"}, storage_config)
525
+ expected_cb_spec = ChefDK::Policyfile::CookbookLocationSpecification.new("foo", ">= 0.0.0", { git: "git://example.com:me/foo-cookbook.git" }, storage_config)
526
526
  expect(policyfile.cookbook_location_specs).to eq("foo" => expected_cb_spec)
527
527
  end
528
528
 
@@ -539,7 +539,7 @@ MESSAGE
539
539
  # Chef server isn't yet supported in cookbook-omnifetch (pending /universe endpoint in Chef Server)
540
540
  # We have to skip at the example definition level or else we fail in the before block
541
541
  skip "sets the source of the cookbook to the git URL" do
542
- expected_cb_spec = ChefDK::Policyfile::CookbookLocationSpecification.new("foo", ">= 0.0.0", {chef_server: "https://mychefserver.example.com"}, storage_config)
542
+ expected_cb_spec = ChefDK::Policyfile::CookbookLocationSpecification.new("foo", ">= 0.0.0", { chef_server: "https://mychefserver.example.com" }, storage_config)
543
543
  expect(policyfile.cookbook_location_specs).to eq("foo" => expected_cb_spec)
544
544
  end
545
545
 
@@ -610,8 +610,8 @@ EOH
610
610
  "abc" => { "def" => { "ghi" => "xyz" } },
611
611
  "baz" => {
612
612
  "more_nested_stuff" => "yup",
613
- "an_array" => ["a", "b", "c"]
614
- }
613
+ "an_array" => %w{a b c},
614
+ },
615
615
  }
616
616
  end
617
617
 
@@ -621,8 +621,8 @@ EOH
621
621
  "abc" => { "def" => { "ghi" => "xyz" } },
622
622
  "baz_override" => {
623
623
  "more_nested_stuff" => "yup",
624
- "an_array" => ["a", "b", "c"]
625
- }
624
+ "an_array" => %w{a b c},
625
+ },
626
626
  }
627
627
  end
628
628
 
@@ -16,11 +16,11 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require 'spec_helper'
20
- require 'shared/setup_git_cookbooks'
21
- require 'shared/fixture_cookbook_checksums'
22
- require 'chef-dk/policyfile/storage_config'
23
- require 'chef-dk/policyfile_lock.rb'
19
+ require "spec_helper"
20
+ require "shared/setup_git_cookbooks"
21
+ require "shared/fixture_cookbook_checksums"
22
+ require "chef-dk/policyfile/storage_config"
23
+ require "chef-dk/policyfile_lock.rb"
24
24
 
25
25
  describe ChefDK::PolicyfileLock, "building a lockfile" do
26
26
 
@@ -150,7 +150,7 @@ describe ChefDK::PolicyfileLock, "building a lockfile" do
150
150
 
151
151
  context "invalid floats - infinity" do
152
152
 
153
- let(:default_attributes) { {"infinity" => Float::INFINITY} }
153
+ let(:default_attributes) { { "infinity" => Float::INFINITY } }
154
154
 
155
155
  it "raises a descriptive error" do
156
156
  expect { policyfile_lock.to_lock }.to raise_error(ChefDK::InvalidPolicyfileAttribute)
@@ -159,7 +159,7 @@ describe ChefDK::PolicyfileLock, "building a lockfile" do
159
159
 
160
160
  context "invalid floats - nan" do
161
161
 
162
- let(:default_attributes) { {"infinity" => Float::NAN} }
162
+ let(:default_attributes) { { "infinity" => Float::NAN } }
163
163
 
164
164
  it "raises a descriptive error" do
165
165
  expect { policyfile_lock.to_lock }.to raise_error(ChefDK::InvalidPolicyfileAttribute)
@@ -168,7 +168,7 @@ describe ChefDK::PolicyfileLock, "building a lockfile" do
168
168
 
169
169
  context "non-string hash/object keys" do
170
170
 
171
- let(:default_attributes) { {1906 => "lol nope"} }
171
+ let(:default_attributes) { { 1906 => "lol nope" } }
172
172
 
173
173
  it "raises a descriptive error" do
174
174
  expect { policyfile_lock.to_lock }.to raise_error(ChefDK::InvalidPolicyfileAttribute)
@@ -231,13 +231,13 @@ REVISION_STRING
231
231
  "dotted_decimal_identifier" => cookbook_foo_cksum_dotted,
232
232
  "cache_key" => "foo-1.0.0",
233
233
  "origin" => nil,
234
- "source_options" => nil
234
+ "source_options" => nil,
235
235
  },
236
236
  },
237
237
  "default_attributes" => {},
238
238
  "override_attributes" => {},
239
239
 
240
- "solution_dependencies" => { "Policyfile" => [], "dependencies" => {} }
240
+ "solution_dependencies" => { "Policyfile" => [], "dependencies" => {} },
241
241
  }
242
242
  end
243
243
 
@@ -273,14 +273,14 @@ REVISION_STRING
273
273
 
274
274
  p.default_attributes = {
275
275
  "foo" => "bar",
276
- "aaa".encode('utf-16') => "aaa".encode('utf-16'),
276
+ "aaa".encode("utf-16") => "aaa".encode("utf-16"),
277
277
  "ddd" => true,
278
278
  "ccc" => false,
279
279
  "bbb" => nil,
280
280
  "e" => 1.2,
281
281
  "f" => 5,
282
282
  "g" => 1_000_000_000_000_000.0,
283
- "nested" => { "a" => "b" }
283
+ "nested" => { "a" => "b" },
284
284
  }
285
285
  p.override_attributes = { "foo2" => "baz" }
286
286
 
@@ -317,23 +317,23 @@ REVISION_STRING
317
317
  "dotted_decimal_identifier" => cookbook_foo_cksum_dotted,
318
318
  "cache_key" => "foo-1.0.0",
319
319
  "origin" => nil,
320
- "source_options" => nil
320
+ "source_options" => nil,
321
321
  },
322
322
  },
323
323
  "default_attributes" => {
324
324
  "foo" => "bar",
325
- "aaa".encode('utf-16') => "aaa".encode('utf-16'),
325
+ "aaa".encode("utf-16") => "aaa".encode("utf-16"),
326
326
  "ddd" => true,
327
327
  "ccc" => false,
328
328
  "bbb" => nil,
329
329
  "e" => 1.2,
330
330
  "f" => 5,
331
331
  "g" => 1_000_000_000_000_000.0,
332
- "nested" => { "a" => "b" }
332
+ "nested" => { "a" => "b" },
333
333
  },
334
334
  "override_attributes" => { "foo2" => "baz" },
335
335
 
336
- "solution_dependencies" => { "Policyfile" => [], "dependencies" => {} }
336
+ "solution_dependencies" => { "Policyfile" => [], "dependencies" => {} },
337
337
  }
338
338
  end
339
339
 
@@ -415,16 +415,16 @@ REVISION_STRING
415
415
  "revision" => current_rev,
416
416
  "working_tree_clean" => true,
417
417
  "published" => true,
418
- "synchronized_remote_branches"=>["origin/master"]
418
+ "synchronized_remote_branches" => ["origin/master"],
419
419
  },
420
- "source_options" => nil
420
+ "source_options" => nil,
421
421
  },
422
422
  },
423
423
 
424
424
  "default_attributes" => {},
425
425
  "override_attributes" => {},
426
426
 
427
- "solution_dependencies" => { "Policyfile" => [], "dependencies" => {} }
427
+ "solution_dependencies" => { "Policyfile" => [], "dependencies" => {} },
428
428
  }
429
429
  end
430
430
 
@@ -464,7 +464,7 @@ REVISION_STRING
464
464
  # Explicitly set the identifier and dotted decimal identifiers to the
465
465
  # version number (but it could be anything).
466
466
  cb.identifier = "1.0.0"
467
- cb.dotted_decimal_identifier ="1.0.0"
467
+ cb.dotted_decimal_identifier = "1.0.0"
468
468
  end
469
469
 
470
470
  p.local_cookbook("bar") do |cb|
@@ -508,7 +508,7 @@ REVISION_STRING
508
508
  "dotted_decimal_identifier" => "1.0.0",
509
509
  "cache_key" => "foo-1.0.0",
510
510
  "origin" => nil,
511
- "source_options" => nil
511
+ "source_options" => nil,
512
512
  },
513
513
 
514
514
  "bar" => {
@@ -524,16 +524,16 @@ REVISION_STRING
524
524
  "revision" => current_rev,
525
525
  "working_tree_clean" => true,
526
526
  "published" => false,
527
- "synchronized_remote_branches"=>[]
527
+ "synchronized_remote_branches" => [],
528
528
  },
529
- "source_options" => nil
529
+ "source_options" => nil,
530
530
  },
531
531
  },
532
532
 
533
533
  "default_attributes" => {},
534
534
  "override_attributes" => {},
535
535
 
536
- "solution_dependencies" => { "Policyfile" => [], "dependencies" => {} }
536
+ "solution_dependencies" => { "Policyfile" => [], "dependencies" => {} },
537
537
  }
538
538
  end
539
539
 
@@ -633,7 +633,7 @@ REVISION_STRING
633
633
  "dotted_decimal_identifier" => cookbook_foo_cksum_dotted,
634
634
  "origin" => "https://community.chef.io/api/cookbooks/foo/1.0.0",
635
635
  "cache_key" => "foo-1.0.0",
636
- "source_options" => nil
636
+ "source_options" => nil,
637
637
  },
638
638
 
639
639
  "bar" => {
@@ -649,18 +649,18 @@ REVISION_STRING
649
649
  "revision" => current_rev,
650
650
  "working_tree_clean" => true,
651
651
  "published" => false,
652
- "synchronized_remote_branches"=>[]
652
+ "synchronized_remote_branches" => [],
653
653
  },
654
- "source_options" => nil
654
+ "source_options" => nil,
655
655
  },
656
656
 
657
657
  "baz" => {
658
658
  "version" => "1.2.3",
659
- "identifier"=> cookbook_baz_cksum,
659
+ "identifier" => cookbook_baz_cksum,
660
660
  "dotted_decimal_identifier" => cookbook_baz_cksum_dotted,
661
661
  "cache_key" => "baz-f59ee7a5bca6a4e606b67f7f856b768d847c39bb",
662
662
  "origin" => "git://github.com/chef-cookbooks/bar.git",
663
- "source_options" => nil
663
+ "source_options" => nil,
664
664
  },
665
665
 
666
666
  "dep_of_bar" => {
@@ -669,7 +669,7 @@ REVISION_STRING
669
669
  "dotted_decimal_identifier" => cookbook_dep_of_bar_cksum_dotted,
670
670
  "origin" => "https://chef-server.example.com/cookbooks/dep_of_bar/1.2.3",
671
671
  "cache_key" => "dep_of_bar-1.2.3",
672
- "source_options" => nil
672
+ "source_options" => nil,
673
673
 
674
674
  },
675
675
 
@@ -678,24 +678,24 @@ REVISION_STRING
678
678
  "default_attributes" => {},
679
679
  "override_attributes" => {},
680
680
 
681
- "solution_dependencies" => { "Policyfile" => [], "dependencies" => {} }
681
+ "solution_dependencies" => { "Policyfile" => [], "dependencies" => {} },
682
682
 
683
683
  }
684
684
  end
685
685
 
686
686
  it "generates a lockfile with the relevant profile data for each cookbook" do
687
687
  generated = policyfile_lock.to_lock
688
- expect(generated['name']).to eq(compiled_policyfile['name'])
689
- expect(generated['run_list']).to eq(compiled_policyfile['run_list'])
688
+ expect(generated["name"]).to eq(compiled_policyfile["name"])
689
+ expect(generated["run_list"]).to eq(compiled_policyfile["run_list"])
690
690
 
691
- generated_locks = generated['cookbook_locks']
692
- expected_locks = compiled_policyfile['cookbook_locks']
691
+ generated_locks = generated["cookbook_locks"]
692
+ expected_locks = compiled_policyfile["cookbook_locks"]
693
693
 
694
694
  # test individually so failures are easier to read
695
- expect(generated_locks['foo']).to eq(expected_locks['foo'])
696
- expect(generated_locks['bar']).to eq(expected_locks['bar'])
697
- expect(generated_locks['baz']).to eq(expected_locks['baz'])
698
- expect(generated_locks['dep_of_bar']).to eq(expected_locks['dep_of_bar'])
695
+ expect(generated_locks["foo"]).to eq(expected_locks["foo"])
696
+ expect(generated_locks["bar"]).to eq(expected_locks["bar"])
697
+ expect(generated_locks["baz"]).to eq(expected_locks["baz"])
698
+ expect(generated_locks["dep_of_bar"]).to eq(expected_locks["dep_of_bar"])
699
699
 
700
700
  expect(policyfile_lock.to_lock).to eq(compiled_policyfile)
701
701
  end
@@ -760,7 +760,7 @@ REVISION_STRING
760
760
  "dotted_decimal_identifier" => cookbook_foo_cksum_dotted,
761
761
  "cache_key" => "foo-1.0.0",
762
762
  "origin" => nil,
763
- "source_options" => nil
763
+ "source_options" => nil,
764
764
  },
765
765
  },
766
766
 
@@ -769,8 +769,8 @@ REVISION_STRING
769
769
 
770
770
  "solution_dependencies" => {
771
771
  "Policyfile" => [],
772
- "dependencies" => {"foo (1.0.0)" => []}
773
- }
772
+ "dependencies" => { "foo (1.0.0)" => [] },
773
+ },
774
774
  }
775
775
  end
776
776
 
@@ -832,14 +832,14 @@ REVISION_STRING
832
832
  "dotted_decimal_identifier" => cookbook_foo_cksum_dotted,
833
833
  "cache_key" => "foo-1.0.0",
834
834
  "origin" => nil,
835
- "source_options" => nil
835
+ "source_options" => nil,
836
836
  },
837
837
  },
838
838
 
839
839
  "default_attributes" => {},
840
840
  "override_attributes" => {},
841
841
 
842
- "solution_dependencies" => { "Policyfile" => [], "dependencies" => {} }
842
+ "solution_dependencies" => { "Policyfile" => [], "dependencies" => {} },
843
843
  }
844
844
  end
845
845
 
@@ -897,8 +897,8 @@ REVISION_STRING
897
897
  "abc" => { "def" => { "ghi" => "xyz" } },
898
898
  "baz" => {
899
899
  "more_nested_stuff" => "yup",
900
- "an_array" => ["a", "b", "c"]
901
- }
900
+ "an_array" => %w{a b c},
901
+ },
902
902
  }
903
903
  end
904
904
 
@@ -906,9 +906,9 @@ REVISION_STRING
906
906
  elements = [
907
907
  %q{"abc":{"def":{"ghi":"xyz"}}},
908
908
  %q{"baz":{"an_array":["a","b","c"],"more_nested_stuff":"yup"}},
909
- %q{"foo":"bar"}
909
+ %q{"foo":"bar"},
910
910
  ]
911
- "{" + elements.join(',') + "}"
911
+ "{" + elements.join(",") + "}"
912
912
  end
913
913
 
914
914
  let(:policyfile_override_attrs) do
@@ -917,8 +917,8 @@ REVISION_STRING
917
917
  "abc" => { "def" => { "ghi" => "xyz" } },
918
918
  "baz" => {
919
919
  "more_nested_stuff" => "yup",
920
- "an_array" => ["a", "b", "c"]
921
- }
920
+ "an_array" => %w{a b c},
921
+ },
922
922
  }
923
923
  end
924
924
 
@@ -927,9 +927,9 @@ REVISION_STRING
927
927
  let(:policyfile_compiler) do
928
928
  double( "ChefDK::PolicyfileCompiler",
929
929
  name: "my-policyfile",
930
- normalized_run_list: %w[recipe[foo::default] recipe[bar::default]],
931
- normalized_named_run_lists: { "rl2" => %w[recipe[bar::default]] },
932
- all_cookbook_location_specs: {"foo" => cached_location_spec, "bar" => local_location_spec},
930
+ normalized_run_list: %w{recipe[foo::default] recipe[bar::default]},
931
+ normalized_named_run_lists: { "rl2" => %w{recipe[bar::default]} },
932
+ all_cookbook_location_specs: { "foo" => cached_location_spec, "bar" => local_location_spec },
933
933
  solution_dependencies: policyfile_solution_dependencies,
934
934
  default_attributes: policyfile_default_attrs,
935
935
  override_attributes: policyfile_override_attrs )
@@ -939,7 +939,6 @@ REVISION_STRING
939
939
  ChefDK::PolicyfileLock.build_from_compiler(policyfile_compiler, storage_config)
940
940
  end
941
941
 
942
-
943
942
  let(:expected_canonical_revision_string) do
944
943
  <<-REVISION_STRING
945
944
  name:my-policyfile
@@ -976,7 +975,7 @@ REVISION_STRING
976
975
  "dotted_decimal_identifier" => cookbook_foo_cksum_dotted,
977
976
  "cache_key" => "foo-1.0.0",
978
977
  "origin" => cached_cookbook_uri,
979
- "source_options" => { "artifactserver" => cached_cookbook_uri, "version" => "1.0.0" }
978
+ "source_options" => { "artifactserver" => cached_cookbook_uri, "version" => "1.0.0" },
980
979
  },
981
980
 
982
981
  "bar" => {
@@ -992,10 +991,10 @@ REVISION_STRING
992
991
  "revision" => current_rev,
993
992
  "working_tree_clean" => true,
994
993
  "published" => false,
995
- "synchronized_remote_branches"=>[]
994
+ "synchronized_remote_branches" => [],
996
995
  },
997
- "source_options" => { "path" => "bar" }
998
- }
996
+ "source_options" => { "path" => "bar" },
997
+ },
999
998
  },
1000
999
 
1001
1000
  "default_attributes" => {
@@ -1003,8 +1002,8 @@ REVISION_STRING
1003
1002
  "abc" => { "def" => { "ghi" => "xyz" } },
1004
1003
  "baz" => {
1005
1004
  "more_nested_stuff" => "yup",
1006
- "an_array" => ["a", "b", "c"]
1007
- }
1005
+ "an_array" => %w{a b c},
1006
+ },
1008
1007
  },
1009
1008
 
1010
1009
  "override_attributes" => {
@@ -1012,13 +1011,13 @@ REVISION_STRING
1012
1011
  "abc" => { "def" => { "ghi" => "xyz" } },
1013
1012
  "baz" => {
1014
1013
  "more_nested_stuff" => "yup",
1015
- "an_array" => ["a", "b", "c"]
1016
- }
1014
+ "an_array" => %w{a b c},
1015
+ },
1017
1016
  },
1018
1017
  "solution_dependencies" => {
1019
1018
  "Policyfile" => [ [ "foo", "~> 1.0" ] ],
1020
- "dependencies" => { "foo (1.0.0)" => [], "bar (0.1.0)" => [] }
1021
- }
1019
+ "dependencies" => { "foo (1.0.0)" => [], "bar (0.1.0)" => [] },
1020
+ },
1022
1021
  }
1023
1022
  end
1024
1023
 
@@ -1036,7 +1035,7 @@ REVISION_STRING
1036
1035
  end
1037
1036
 
1038
1037
  it "sets named run lists on the policyfile lock" do
1039
- expect(policyfile_lock.named_run_lists).to eq("rl2" => %w[recipe[bar::default]])
1038
+ expect(policyfile_lock.named_run_lists).to eq("rl2" => %w{recipe[bar::default]})
1040
1039
  end
1041
1040
 
1042
1041
  it "generates a lockfile data structure" do