chef-dk 3.13.1 → 4.0.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (373) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +33 -25
  3. data/Gemfile.lock +317 -293
  4. data/LICENSE +0 -0
  5. data/Rakefile +0 -0
  6. data/bin/chef +1 -1
  7. data/chef-dk.gemspec +3 -3
  8. data/lib/chef-dk.rb +0 -0
  9. data/lib/chef-dk/authenticated_http.rb +0 -0
  10. data/lib/chef-dk/builtin_commands.rb +1 -3
  11. data/lib/chef-dk/chef_runner.rb +0 -0
  12. data/lib/chef-dk/chef_server_api_multi.rb +0 -0
  13. data/lib/chef-dk/cli.rb +2 -3
  14. data/lib/chef-dk/command/base.rb +9 -1
  15. data/lib/chef-dk/command/clean_policy_cookbooks.rb +2 -3
  16. data/lib/chef-dk/command/clean_policy_revisions.rb +3 -4
  17. data/lib/chef-dk/command/delete_policy.rb +1 -1
  18. data/lib/chef-dk/command/delete_policy_group.rb +1 -2
  19. data/lib/chef-dk/command/describe_cookbook.rb +5 -4
  20. data/lib/chef-dk/command/diff.rb +7 -9
  21. data/lib/chef-dk/command/env.rb +0 -0
  22. data/lib/chef-dk/command/exec.rb +0 -0
  23. data/lib/chef-dk/command/export.rb +0 -1
  24. data/lib/chef-dk/command/gem.rb +0 -0
  25. data/lib/chef-dk/command/generate.rb +1 -6
  26. data/lib/chef-dk/command/generator_commands.rb +0 -0
  27. data/lib/chef-dk/command/generator_commands/attribute.rb +0 -0
  28. data/lib/chef-dk/command/generator_commands/base.rb +0 -0
  29. data/lib/chef-dk/command/generator_commands/build_cookbook.rb +7 -7
  30. data/lib/chef-dk/command/generator_commands/chef_exts/generator_desc_resource.rb +4 -49
  31. data/lib/chef-dk/command/generator_commands/chef_exts/quieter_doc_formatter.rb +0 -0
  32. data/lib/chef-dk/command/generator_commands/chef_exts/recipe_dsl_ext.rb +0 -0
  33. data/lib/chef-dk/command/generator_commands/cookbook.rb +22 -23
  34. data/lib/chef-dk/command/generator_commands/cookbook_code_file.rb +0 -0
  35. data/lib/chef-dk/command/generator_commands/cookbook_file.rb +0 -0
  36. data/lib/chef-dk/command/generator_commands/generator_generator.rb +0 -0
  37. data/lib/chef-dk/command/generator_commands/helpers.rb +0 -0
  38. data/lib/chef-dk/command/generator_commands/policyfile.rb +0 -0
  39. data/lib/chef-dk/command/generator_commands/recipe.rb +0 -0
  40. data/lib/chef-dk/command/generator_commands/repo.rb +25 -9
  41. data/lib/chef-dk/command/generator_commands/resource.rb +0 -0
  42. data/lib/chef-dk/command/generator_commands/template.rb +0 -0
  43. data/lib/chef-dk/command/install.rb +1 -2
  44. data/lib/chef-dk/command/provision.rb +2 -404
  45. data/lib/chef-dk/command/push.rb +1 -2
  46. data/lib/chef-dk/command/push_archive.rb +2 -2
  47. data/lib/chef-dk/command/shell_init.rb +9 -5
  48. data/lib/chef-dk/command/show_policy.rb +0 -1
  49. data/lib/chef-dk/command/undelete.rb +0 -1
  50. data/lib/chef-dk/command/update.rb +0 -1
  51. data/lib/chef-dk/command/verify.rb +13 -110
  52. data/lib/chef-dk/commands_map.rb +0 -0
  53. data/lib/chef-dk/completions/bash.sh.erb +0 -0
  54. data/lib/chef-dk/completions/chef.fish.erb +0 -0
  55. data/lib/chef-dk/completions/zsh.zsh.erb +0 -0
  56. data/lib/chef-dk/component_test.rb +4 -2
  57. data/lib/chef-dk/configurable.rb +0 -1
  58. data/lib/chef-dk/cookbook_metadata.rb +0 -0
  59. data/lib/chef-dk/cookbook_omnifetch.rb +0 -0
  60. data/lib/chef-dk/cookbook_profiler/git.rb +0 -0
  61. data/lib/chef-dk/cookbook_profiler/identifiers.rb +0 -0
  62. data/lib/chef-dk/cookbook_profiler/null_scm.rb +0 -0
  63. data/lib/chef-dk/exceptions.rb +1 -1
  64. data/lib/chef-dk/generator.rb +1 -1
  65. data/lib/chef-dk/helpers.rb +1 -2
  66. data/lib/chef-dk/pager.rb +0 -0
  67. data/lib/chef-dk/policyfile/artifactory_cookbook_source.rb +0 -0
  68. data/lib/chef-dk/policyfile/attribute_merge_checker.rb +0 -0
  69. data/lib/chef-dk/policyfile/chef_repo_cookbook_source.rb +0 -0
  70. data/lib/chef-dk/policyfile/chef_server_cookbook_source.rb +0 -0
  71. data/lib/chef-dk/policyfile/chef_server_lock_fetcher.rb +2 -2
  72. data/lib/chef-dk/policyfile/community_cookbook_source.rb +0 -0
  73. data/lib/chef-dk/policyfile/comparison_base.rb +0 -0
  74. data/lib/chef-dk/policyfile/cookbook_location_specification.rb +0 -0
  75. data/lib/chef-dk/policyfile/cookbook_locks.rb +1 -1
  76. data/lib/chef-dk/policyfile/cookbook_sources.rb +0 -0
  77. data/lib/chef-dk/policyfile/delivery_supermarket_source.rb +0 -0
  78. data/lib/chef-dk/policyfile/differ.rb +0 -0
  79. data/lib/chef-dk/policyfile/dsl.rb +1 -1
  80. data/lib/chef-dk/policyfile/git_lock_fetcher.rb +0 -0
  81. data/lib/chef-dk/policyfile/included_policies_cookbook_source.rb +0 -0
  82. data/lib/chef-dk/policyfile/lister.rb +0 -0
  83. data/lib/chef-dk/policyfile/local_lock_fetcher.rb +0 -0
  84. data/lib/chef-dk/policyfile/lock_applier.rb +0 -0
  85. data/lib/chef-dk/policyfile/lock_fetcher_mixin.rb +0 -0
  86. data/lib/chef-dk/policyfile/null_cookbook_source.rb +0 -0
  87. data/lib/chef-dk/policyfile/policyfile_location_specification.rb +0 -0
  88. data/lib/chef-dk/policyfile/read_cookbook_for_compat_mode_upload.rb +0 -0
  89. data/lib/chef-dk/policyfile/remote_lock_fetcher.rb +0 -0
  90. data/lib/chef-dk/policyfile/reports/install.rb +0 -0
  91. data/lib/chef-dk/policyfile/reports/table_printer.rb +0 -0
  92. data/lib/chef-dk/policyfile/reports/upload.rb +0 -0
  93. data/lib/chef-dk/policyfile/solution_dependencies.rb +1 -1
  94. data/lib/chef-dk/policyfile/source_uri.rb +0 -0
  95. data/lib/chef-dk/policyfile/storage_config.rb +0 -0
  96. data/lib/chef-dk/policyfile/undo_record.rb +0 -0
  97. data/lib/chef-dk/policyfile/undo_stack.rb +0 -0
  98. data/lib/chef-dk/policyfile/uploader.rb +0 -0
  99. data/lib/chef-dk/policyfile_compiler.rb +2 -4
  100. data/lib/chef-dk/policyfile_lock.rb +1 -3
  101. data/lib/chef-dk/policyfile_services/clean_policies.rb +0 -0
  102. data/lib/chef-dk/policyfile_services/clean_policy_cookbooks.rb +0 -0
  103. data/lib/chef-dk/policyfile_services/export_repo.rb +6 -6
  104. data/lib/chef-dk/policyfile_services/install.rb +0 -0
  105. data/lib/chef-dk/policyfile_services/push.rb +0 -0
  106. data/lib/chef-dk/policyfile_services/push_archive.rb +2 -2
  107. data/lib/chef-dk/policyfile_services/rm_policy.rb +0 -0
  108. data/lib/chef-dk/policyfile_services/rm_policy_group.rb +0 -0
  109. data/lib/chef-dk/policyfile_services/show_policy.rb +0 -0
  110. data/lib/chef-dk/policyfile_services/undelete.rb +0 -0
  111. data/lib/chef-dk/policyfile_services/update_attributes.rb +0 -0
  112. data/lib/chef-dk/service_exception_inspectors.rb +0 -0
  113. data/lib/chef-dk/service_exception_inspectors/base.rb +0 -0
  114. data/lib/chef-dk/service_exception_inspectors/http.rb +0 -0
  115. data/lib/chef-dk/service_exceptions.rb +0 -0
  116. data/lib/chef-dk/shell_out.rb +0 -0
  117. data/lib/chef-dk/skeletons/code_generator/files/default/Berksfile +0 -0
  118. data/lib/chef-dk/skeletons/code_generator/files/default/build_cookbook/README.md +0 -0
  119. data/lib/chef-dk/skeletons/code_generator/files/default/build_cookbook/kitchen.yml +1 -1
  120. data/lib/chef-dk/skeletons/code_generator/files/default/build_cookbook/test-fixture-recipe.rb +0 -0
  121. data/lib/chef-dk/skeletons/code_generator/files/default/chefignore +0 -0
  122. data/lib/chef-dk/skeletons/code_generator/files/default/cookbook_readmes/README-policy.md +0 -0
  123. data/lib/chef-dk/skeletons/code_generator/files/default/cookbook_readmes/README.md +0 -0
  124. data/lib/chef-dk/skeletons/code_generator/files/default/delivery-config.json +0 -0
  125. data/lib/chef-dk/skeletons/code_generator/files/default/delivery-project.toml +0 -0
  126. data/lib/chef-dk/skeletons/code_generator/files/default/gitignore +0 -0
  127. data/lib/chef-dk/skeletons/code_generator/files/default/repo/README.md +0 -0
  128. data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/README.md +0 -0
  129. data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/attributes/default.rb +0 -0
  130. data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/metadata.rb +0 -0
  131. data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/recipes/default.rb +0 -0
  132. data/lib/chef-dk/skeletons/code_generator/files/default/repo/data_bags/README.md +0 -0
  133. data/lib/chef-dk/skeletons/code_generator/files/default/repo/data_bags/example/example_item.json +0 -0
  134. data/lib/chef-dk/skeletons/code_generator/files/default/repo/dot-chef-repo.txt +0 -0
  135. data/lib/chef-dk/skeletons/code_generator/files/default/repo/environments/README.md +0 -0
  136. data/lib/chef-dk/skeletons/code_generator/files/default/repo/environments/example.json +0 -0
  137. data/lib/chef-dk/skeletons/code_generator/files/default/repo/policyfiles/README.md +0 -0
  138. data/lib/chef-dk/skeletons/code_generator/files/default/repo/roles/README.md +0 -0
  139. data/lib/chef-dk/skeletons/code_generator/files/default/repo/roles/example.json +0 -0
  140. data/lib/chef-dk/skeletons/code_generator/files/default/spec_helper.rb +0 -0
  141. data/lib/chef-dk/skeletons/code_generator/files/default/spec_helper_policyfile.rb +0 -0
  142. data/lib/chef-dk/skeletons/code_generator/metadata.rb +0 -0
  143. data/lib/chef-dk/skeletons/code_generator/recipes/attribute.rb +0 -0
  144. data/lib/chef-dk/skeletons/code_generator/recipes/build_cookbook.rb +20 -20
  145. data/lib/chef-dk/skeletons/code_generator/recipes/cookbook.rb +24 -16
  146. data/lib/chef-dk/skeletons/code_generator/recipes/cookbook_file.rb +0 -0
  147. data/lib/chef-dk/skeletons/code_generator/recipes/helpers.rb +0 -0
  148. data/lib/chef-dk/skeletons/code_generator/recipes/policyfile.rb +0 -0
  149. data/lib/chef-dk/skeletons/code_generator/recipes/recipe.rb +0 -0
  150. data/lib/chef-dk/skeletons/code_generator/recipes/repo.rb +7 -3
  151. data/lib/chef-dk/skeletons/code_generator/recipes/resource.rb +0 -0
  152. data/lib/chef-dk/skeletons/code_generator/recipes/template.rb +0 -0
  153. data/lib/chef-dk/skeletons/code_generator/templates/default/CHANGELOG.md.erb +0 -0
  154. data/lib/chef-dk/skeletons/code_generator/templates/default/LICENSE.all_rights.erb +0 -0
  155. data/lib/chef-dk/skeletons/code_generator/templates/default/LICENSE.apachev2.erb +0 -0
  156. data/lib/chef-dk/skeletons/code_generator/templates/default/LICENSE.gplv2.erb +0 -0
  157. data/lib/chef-dk/skeletons/code_generator/templates/default/LICENSE.gplv3.erb +0 -0
  158. data/lib/chef-dk/skeletons/code_generator/templates/default/LICENSE.mit.erb +0 -0
  159. data/lib/chef-dk/skeletons/code_generator/templates/default/Policyfile.rb.erb +0 -0
  160. data/lib/chef-dk/skeletons/code_generator/templates/default/README.md.erb +0 -0
  161. data/lib/chef-dk/skeletons/code_generator/templates/default/attribute.rb.erb +0 -0
  162. data/lib/chef-dk/skeletons/code_generator/templates/default/build_cookbook/Berksfile.erb +1 -1
  163. data/lib/chef-dk/skeletons/code_generator/templates/default/build_cookbook/metadata.rb.erb +1 -1
  164. data/lib/chef-dk/skeletons/code_generator/templates/default/build_cookbook/recipe.rb.erb +0 -0
  165. data/lib/chef-dk/skeletons/code_generator/templates/default/cookbook_file.erb +0 -0
  166. data/lib/chef-dk/skeletons/code_generator/templates/default/helpers.rb.erb +0 -0
  167. data/lib/chef-dk/skeletons/code_generator/templates/default/inspec_default_test.rb.erb +0 -0
  168. data/lib/chef-dk/skeletons/code_generator/templates/default/kitchen.yml.erb +1 -1
  169. data/lib/chef-dk/skeletons/code_generator/templates/default/kitchen_dokken.yml.erb +0 -0
  170. data/lib/chef-dk/skeletons/code_generator/templates/default/kitchen_policyfile.yml.erb +1 -1
  171. data/lib/chef-dk/skeletons/code_generator/templates/default/metadata.rb.erb +1 -1
  172. data/lib/chef-dk/skeletons/code_generator/templates/default/recipe.rb.erb +0 -0
  173. data/lib/chef-dk/skeletons/code_generator/templates/default/recipe_spec.rb.erb +0 -0
  174. data/lib/chef-dk/skeletons/code_generator/templates/default/repo/gitignore.erb +0 -0
  175. data/lib/chef-dk/skeletons/code_generator/templates/default/resource.rb.erb +0 -0
  176. data/lib/chef-dk/skeletons/code_generator/templates/default/template.erb +0 -0
  177. data/lib/chef-dk/ui.rb +0 -0
  178. data/lib/chef-dk/version.rb +1 -1
  179. data/lib/kitchen/provisioner/policyfile_zero.rb +0 -0
  180. data/spec/shared/a_file_generator.rb +0 -0
  181. data/spec/shared/a_generated_file.rb +0 -0
  182. data/spec/shared/command_with_ui_object.rb +0 -0
  183. data/spec/shared/custom_generator_cookbook.rb +0 -0
  184. data/spec/shared/fixture_cookbook_checksums.rb +1 -1
  185. data/spec/shared/setup_git_committer_config.rb +0 -0
  186. data/spec/shared/setup_git_cookbooks.rb +0 -0
  187. data/spec/spec_helper.rb +0 -4
  188. data/spec/test_helpers.rb +0 -0
  189. data/spec/unit/chef_runner_spec.rb +0 -0
  190. data/spec/unit/chef_server_api_multi_spec.rb +0 -0
  191. data/spec/unit/cli_spec.rb +0 -0
  192. data/spec/unit/command/base_spec.rb +24 -1
  193. data/spec/unit/command/clean_policy_cookbooks_spec.rb +0 -0
  194. data/spec/unit/command/clean_policy_revisions_spec.rb +0 -0
  195. data/spec/unit/command/delete_policy_group_spec.rb +0 -0
  196. data/spec/unit/command/delete_policy_spec.rb +0 -0
  197. data/spec/unit/command/diff_spec.rb +0 -0
  198. data/spec/unit/command/env_spec.rb +1 -1
  199. data/spec/unit/command/exec_spec.rb +1 -1
  200. data/spec/unit/command/export_spec.rb +0 -0
  201. data/spec/unit/command/generate_spec.rb +0 -0
  202. data/spec/unit/command/generator_commands/attribute_spec.rb +0 -0
  203. data/spec/unit/command/generator_commands/base_spec.rb +0 -0
  204. data/spec/unit/command/generator_commands/build_cookbook_spec.rb +15 -15
  205. data/spec/unit/command/generator_commands/chef_exts/generator_desc_resource_spec.rb +6 -26
  206. data/spec/unit/command/generator_commands/chef_exts/recipe_dsl_ext_spec.rb +0 -0
  207. data/spec/unit/command/generator_commands/cookbook_file_spec.rb +0 -0
  208. data/spec/unit/command/generator_commands/cookbook_spec.rb +200 -203
  209. data/spec/unit/command/generator_commands/generator_generator_spec.rb +7 -7
  210. data/spec/unit/command/generator_commands/helpers_spec.rb +0 -0
  211. data/spec/unit/command/generator_commands/policyfile_spec.rb +0 -0
  212. data/spec/unit/command/generator_commands/recipe_spec.rb +1 -2
  213. data/spec/unit/command/generator_commands/repo_spec.rb +8 -8
  214. data/spec/unit/command/generator_commands/resource_spec.rb +0 -0
  215. data/spec/unit/command/generator_commands/template_spec.rb +0 -0
  216. data/spec/unit/command/install_spec.rb +0 -0
  217. data/spec/unit/command/push_archive_spec.rb +0 -0
  218. data/spec/unit/command/push_spec.rb +0 -0
  219. data/spec/unit/command/shell_init_spec.rb +0 -0
  220. data/spec/unit/command/show_policy_spec.rb +0 -0
  221. data/spec/unit/command/undelete_spec.rb +0 -0
  222. data/spec/unit/command/update_spec.rb +0 -0
  223. data/spec/unit/command/verify_spec.rb +2 -3
  224. data/spec/unit/commands_map_spec.rb +0 -0
  225. data/spec/unit/component_test_spec.rb +0 -0
  226. data/spec/unit/configurable_spec.rb +0 -0
  227. data/spec/unit/cookbook_metadata_spec.rb +0 -0
  228. data/spec/unit/cookbook_profiler/git_spec.rb +0 -0
  229. data/spec/unit/cookbook_profiler/identifiers_spec.rb +3 -3
  230. data/spec/unit/fixtures/chef-runner-cookbooks/test_cookbook/recipes/recipe_one.rb +0 -0
  231. data/spec/unit/fixtures/chef-runner-cookbooks/test_cookbook/recipes/recipe_two.rb +0 -0
  232. data/spec/unit/fixtures/command/cli_test_command.rb +0 -0
  233. data/spec/unit/fixtures/command/explicit_path_example.rb +0 -0
  234. data/spec/unit/fixtures/configurable/test_config_loader.rb +0 -0
  235. data/spec/unit/fixtures/configurable/test_configurable.rb +0 -0
  236. data/spec/unit/fixtures/cookbook_cache/baz-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/.kitchen.yml +0 -0
  237. data/spec/unit/fixtures/cookbook_cache/baz-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/Berksfile +0 -0
  238. data/spec/unit/fixtures/cookbook_cache/baz-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/README.md +0 -0
  239. data/spec/unit/fixtures/cookbook_cache/baz-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/chefignore +0 -0
  240. data/spec/unit/fixtures/cookbook_cache/baz-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/metadata.rb +0 -0
  241. data/spec/unit/fixtures/cookbook_cache/baz-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/recipes/default.rb +0 -0
  242. data/spec/unit/fixtures/cookbook_cache/dep_of_bar-1.2.3/.kitchen.yml +0 -0
  243. data/spec/unit/fixtures/cookbook_cache/dep_of_bar-1.2.3/Berksfile +0 -0
  244. data/spec/unit/fixtures/cookbook_cache/dep_of_bar-1.2.3/README.md +0 -0
  245. data/spec/unit/fixtures/cookbook_cache/dep_of_bar-1.2.3/chefignore +0 -0
  246. data/spec/unit/fixtures/cookbook_cache/dep_of_bar-1.2.3/metadata.rb +0 -0
  247. data/spec/unit/fixtures/cookbook_cache/dep_of_bar-1.2.3/recipes/default.rb +0 -0
  248. data/spec/unit/fixtures/cookbook_cache/foo-1.0.0/Berksfile +0 -0
  249. data/spec/unit/fixtures/cookbook_cache/foo-1.0.0/README.md +0 -0
  250. data/spec/unit/fixtures/cookbook_cache/foo-1.0.0/chefignore +0 -0
  251. data/spec/unit/fixtures/cookbook_cache/foo-1.0.0/{.kitchen.yml → kitchen.yml} +0 -0
  252. data/spec/unit/fixtures/cookbook_cache/foo-1.0.0/metadata.rb +0 -0
  253. data/spec/unit/fixtures/cookbook_cache/foo-1.0.0/recipes/default.rb +0 -0
  254. data/spec/unit/fixtures/cookbooks_api/chef_server_universe.json +0 -0
  255. data/spec/unit/fixtures/cookbooks_api/pruned_chef_server_universe.json +0 -0
  256. data/spec/unit/fixtures/cookbooks_api/pruned_small_universe.json +0 -0
  257. data/spec/unit/fixtures/cookbooks_api/small_universe.json +0 -0
  258. data/spec/unit/fixtures/cookbooks_api/universe.json +0 -0
  259. data/spec/unit/fixtures/cookbooks_api/update_fixtures.rb +0 -0
  260. data/spec/unit/fixtures/dev_cookbooks/README.md +0 -0
  261. data/spec/unit/fixtures/dev_cookbooks/bar-cookbook.gitbundle +0 -0
  262. data/spec/unit/fixtures/eg_omnibus_dir/missing_apps/bin/.keep +0 -0
  263. data/spec/unit/fixtures/eg_omnibus_dir/missing_apps/embedded/.keep +0 -0
  264. data/spec/unit/fixtures/eg_omnibus_dir/missing_apps/embedded/bin/.keep +0 -0
  265. data/spec/unit/fixtures/eg_omnibus_dir/missing_component/bin/.keep +0 -0
  266. data/spec/unit/fixtures/eg_omnibus_dir/missing_component/embedded/apps/berkshelf/.keep +0 -0
  267. data/spec/unit/fixtures/eg_omnibus_dir/missing_component/embedded/apps/test-kitchen/.keep +0 -0
  268. data/spec/unit/fixtures/eg_omnibus_dir/missing_component/embedded/bin/.keep +0 -0
  269. data/spec/unit/fixtures/eg_omnibus_dir/valid/bin/.keep +0 -0
  270. data/spec/unit/fixtures/eg_omnibus_dir/valid/embedded/apps/chef-dk/.keep +0 -0
  271. data/spec/unit/fixtures/eg_omnibus_dir/valid/embedded/bin/.keep +0 -0
  272. data/spec/unit/fixtures/example_app/Policyfile.rb +0 -0
  273. data/spec/unit/fixtures/example_cookbook/.gitignore +0 -0
  274. data/spec/unit/fixtures/example_cookbook/.kitchen.yml +0 -0
  275. data/spec/unit/fixtures/example_cookbook/Berksfile +0 -0
  276. data/spec/unit/fixtures/example_cookbook/README.md +0 -0
  277. data/spec/unit/fixtures/example_cookbook/chefignore +0 -0
  278. data/spec/unit/fixtures/example_cookbook/metadata.rb +0 -0
  279. data/spec/unit/fixtures/example_cookbook/recipes/default.rb +0 -0
  280. data/spec/unit/fixtures/example_cookbook_metadata_json_only/.gitignore +0 -0
  281. data/spec/unit/fixtures/example_cookbook_metadata_json_only/.kitchen.yml +0 -0
  282. data/spec/unit/fixtures/example_cookbook_metadata_json_only/Berksfile +0 -0
  283. data/spec/unit/fixtures/example_cookbook_metadata_json_only/README.md +0 -0
  284. data/spec/unit/fixtures/example_cookbook_metadata_json_only/chefignore +0 -0
  285. data/spec/unit/fixtures/example_cookbook_metadata_json_only/metadata.json +0 -0
  286. data/spec/unit/fixtures/example_cookbook_metadata_json_only/recipes/default.rb +0 -0
  287. data/spec/unit/fixtures/example_cookbook_no_metadata/.gitignore +0 -0
  288. data/spec/unit/fixtures/example_cookbook_no_metadata/.kitchen.yml +0 -0
  289. data/spec/unit/fixtures/example_cookbook_no_metadata/Berksfile +0 -0
  290. data/spec/unit/fixtures/example_cookbook_no_metadata/README.md +0 -0
  291. data/spec/unit/fixtures/example_cookbook_no_metadata/chefignore +0 -0
  292. data/spec/unit/fixtures/example_cookbook_no_metadata/recipes/default.rb +0 -0
  293. data/spec/unit/fixtures/local_path_cookbooks/another-local-cookbook/README.md +0 -0
  294. data/spec/unit/fixtures/local_path_cookbooks/another-local-cookbook/chefignore +0 -0
  295. data/spec/unit/fixtures/local_path_cookbooks/another-local-cookbook/metadata.rb +0 -0
  296. data/spec/unit/fixtures/local_path_cookbooks/another-local-cookbook/recipes/default.rb +0 -0
  297. data/spec/unit/fixtures/local_path_cookbooks/cookbook-with-a-dep/Berksfile +0 -0
  298. data/spec/unit/fixtures/local_path_cookbooks/cookbook-with-a-dep/README.md +0 -0
  299. data/spec/unit/fixtures/local_path_cookbooks/cookbook-with-a-dep/chefignore +0 -0
  300. data/spec/unit/fixtures/local_path_cookbooks/cookbook-with-a-dep/metadata.rb +0 -0
  301. data/spec/unit/fixtures/local_path_cookbooks/cookbook-with-a-dep/recipes/default.rb +0 -0
  302. data/spec/unit/fixtures/local_path_cookbooks/local-cookbook/.kitchen.yml +0 -0
  303. data/spec/unit/fixtures/local_path_cookbooks/local-cookbook/Berksfile +0 -0
  304. data/spec/unit/fixtures/local_path_cookbooks/local-cookbook/README.md +0 -0
  305. data/spec/unit/fixtures/local_path_cookbooks/local-cookbook/chefignore +0 -0
  306. data/spec/unit/fixtures/local_path_cookbooks/local-cookbook/extra/extra_file.txt +0 -0
  307. data/spec/unit/fixtures/local_path_cookbooks/local-cookbook/metadata.rb +0 -0
  308. data/spec/unit/fixtures/local_path_cookbooks/local-cookbook/recipes/default.rb +0 -0
  309. data/spec/unit/fixtures/local_path_cookbooks/metadata-missing/README.md +0 -0
  310. data/spec/unit/fixtures/local_path_cookbooks/noignore-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/.kitchen.yml +0 -0
  311. data/spec/unit/fixtures/local_path_cookbooks/noignore-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/README.md +0 -0
  312. data/spec/unit/fixtures/local_path_cookbooks/noignore-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/metadata.rb +0 -0
  313. data/spec/unit/fixtures/local_path_cookbooks/noignore-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/recipes/default.rb +0 -0
  314. data/spec/unit/generator_spec.rb +0 -0
  315. data/spec/unit/pager_spec.rb +0 -0
  316. data/spec/unit/policyfile/artifactory_cookbook_source_spec.rb +0 -0
  317. data/spec/unit/policyfile/attribute_merge_checker_spec.rb +0 -0
  318. data/spec/unit/policyfile/chef_repo_cookbook_source_spec.rb +0 -0
  319. data/spec/unit/policyfile/chef_server_cookbook_source_spec.rb +0 -0
  320. data/spec/unit/policyfile/chef_server_lock_fetcher_spec.rb +0 -0
  321. data/spec/unit/policyfile/community_cookbook_source_spec.rb +0 -0
  322. data/spec/unit/policyfile/comparison_base_spec.rb +0 -0
  323. data/spec/unit/policyfile/cookbook_location_specification_spec.rb +0 -0
  324. data/spec/unit/policyfile/cookbook_locks_spec.rb +0 -0
  325. data/spec/unit/policyfile/delivery_supermarket_source_spec.rb +0 -0
  326. data/spec/unit/policyfile/differ_spec.rb +0 -0
  327. data/spec/unit/policyfile/git_lock_fetcher_spec.rb +0 -0
  328. data/spec/unit/policyfile/included_policies_cookbook_source_spec.rb +0 -0
  329. data/spec/unit/policyfile/lister_spec.rb +0 -0
  330. data/spec/unit/policyfile/local_lock_fetcher_spec.rb +0 -0
  331. data/spec/unit/policyfile/lock_applier_spec.rb +0 -0
  332. data/spec/unit/policyfile/lock_fetcher_mixin_spec.rb +0 -0
  333. data/spec/unit/policyfile/null_cookbook_source_spec.rb +0 -0
  334. data/spec/unit/policyfile/read_cookbook_for_compat_mode_upload_spec.rb +0 -0
  335. data/spec/unit/policyfile/remote_lock_fetcher_spec.rb +0 -0
  336. data/spec/unit/policyfile/reports/install_spec.rb +0 -0
  337. data/spec/unit/policyfile/reports/upload_spec.rb +0 -0
  338. data/spec/unit/policyfile/solution_dependencies_spec.rb +0 -0
  339. data/spec/unit/policyfile/source_uri_spec.rb +0 -0
  340. data/spec/unit/policyfile/storage_config_spec.rb +0 -0
  341. data/spec/unit/policyfile/undo_record_spec.rb +0 -0
  342. data/spec/unit/policyfile/undo_stack_spec.rb +0 -0
  343. data/spec/unit/policyfile/uploader_spec.rb +0 -0
  344. data/spec/unit/policyfile_demands_spec.rb +0 -0
  345. data/spec/unit/policyfile_evaluation_spec.rb +0 -0
  346. data/spec/unit/policyfile_includes_dsl_spec.rb +0 -0
  347. data/spec/unit/policyfile_includes_spec.rb +0 -0
  348. data/spec/unit/policyfile_install_with_includes_spec.rb +0 -0
  349. data/spec/unit/policyfile_lock_build_spec.rb +2 -2
  350. data/spec/unit/policyfile_lock_install_spec.rb +0 -0
  351. data/spec/unit/policyfile_lock_serialization_spec.rb +0 -0
  352. data/spec/unit/policyfile_lock_validation_spec.rb +0 -0
  353. data/spec/unit/policyfile_services/clean_policies_spec.rb +0 -0
  354. data/spec/unit/policyfile_services/clean_policy_cookbooks_spec.rb +0 -0
  355. data/spec/unit/policyfile_services/export_repo_spec.rb +6 -6
  356. data/spec/unit/policyfile_services/install_spec.rb +0 -0
  357. data/spec/unit/policyfile_services/push_archive_spec.rb +2 -2
  358. data/spec/unit/policyfile_services/push_spec.rb +0 -0
  359. data/spec/unit/policyfile_services/rm_policy_group_spec.rb +0 -0
  360. data/spec/unit/policyfile_services/rm_policy_spec.rb +0 -0
  361. data/spec/unit/policyfile_services/show_policy_spec.rb +0 -0
  362. data/spec/unit/policyfile_services/undelete_spec.rb +0 -0
  363. data/spec/unit/policyfile_services/update_attributes_spec.rb +0 -0
  364. data/spec/unit/policyfile_services/update_spec.rb +0 -0
  365. data/spec/unit/service_exception_inspectors/base_spec.rb +0 -0
  366. data/spec/unit/service_exception_inspectors/http_spec.rb +1 -1
  367. data/spec/unit/shell_out_spec.rb +0 -0
  368. data/warning.txt +3 -2
  369. metadata +20 -19
  370. data/lib/chef-dk/command/generator_commands/app.rb +0 -106
  371. data/lib/chef-dk/skeletons/code_generator/recipes/app.rb +0 -87
  372. data/spec/unit/command/generator_commands/app_spec.rb +0 -166
  373. data/spec/unit/command/provision_spec.rb +0 -589
@@ -2,6 +2,6 @@ source 'https://supermarket.chef.io'
2
2
 
3
3
  metadata
4
4
 
5
- group :delivery do
5
+ group :workflow do
6
6
  cookbook 'test', path: './test/fixtures/cookbooks/test'
7
7
  end
@@ -3,7 +3,7 @@ maintainer '<%= copyright_holder %>'
3
3
  maintainer_email '<%= email %>'
4
4
  license '<%= license %>'
5
5
  version '0.1.0'
6
- chef_version '>= 13.0'
6
+ chef_version '>= 14.0'
7
7
  <% if build_cookbook_parent_is_cookbook -%>
8
8
 
9
9
  depends 'delivery-truck'
@@ -19,7 +19,7 @@ provisioner:
19
19
  ## product_name and product_version specifies a specific Chef product and version to install.
20
20
  ## see the Chef documentation for more details: https://docs.chef.io/config_yml_kitchen.html
21
21
  # product_name: chef
22
- # product_version: 14
22
+ # product_version: 15
23
23
 
24
24
  verifier:
25
25
  name: inspec
@@ -15,7 +15,7 @@ provisioner:
15
15
  ## product_name and product_version specifies a specific Chef product and version to install.
16
16
  ## see the Chef documentation for more details: https://docs.chef.io/config_yml_kitchen.html
17
17
  # product_name: chef
18
- # product_version: 14
18
+ # product_version: 15
19
19
 
20
20
  verifier:
21
21
  name: inspec
@@ -5,7 +5,7 @@ license '<%= @spdx_license %>'
5
5
  description 'Installs/Configures <%= cookbook_name %>'
6
6
  long_description 'Installs/Configures <%= cookbook_name %>'
7
7
  version '0.1.0'
8
- chef_version '>= 13.0'
8
+ chef_version '>= 14.0'
9
9
 
10
10
  # The `issues_url` points to the location where issues for this cookbook are
11
11
  # tracked. A `View Issues` link will be displayed on this cookbook's page when
File without changes
@@ -16,5 +16,5 @@
16
16
  #
17
17
 
18
18
  module ChefDK
19
- VERSION = "3.13.1".freeze
19
+ VERSION = "4.0.60".freeze
20
20
  end
File without changes
File without changes
File without changes
File without changes
@@ -27,7 +27,7 @@ RSpec.shared_context "fixture cookbooks checksums" do
27
27
  decimal_integers.join(".")
28
28
  end
29
29
 
30
- let(:cookbook_foo_cksum) { "467dc855408ce8b74f991c5dc2fd72a6aa369b60" }
30
+ let(:cookbook_foo_cksum) { "f24326bbf81d67fcab6a5615c75092d1c6da81cc" }
31
31
 
32
32
  let(:cookbook_foo_cksum_dotted) { id_to_dotted(cookbook_foo_cksum) }
33
33
 
File without changes
File without changes
@@ -48,8 +48,4 @@ RSpec.configure do |c|
48
48
  mocks.verify_partial_doubles = true
49
49
  end
50
50
 
51
- # better diffs when expects fail
52
- c.expect_with :rspec do |r|
53
- r.max_formatted_output_length = 400
54
- end
55
51
  end
File without changes
File without changes
File without changes
File without changes
@@ -42,6 +42,7 @@ describe ChefDK::Command::Base do
42
42
  let(:stderr_io) { StringIO.new }
43
43
  let(:stdout_io) { StringIO.new }
44
44
  let(:command_instance) { TestCommand.new() }
45
+ let(:enforce_license) { false }
45
46
 
46
47
  def stdout
47
48
  stdout_io.string
@@ -57,7 +58,7 @@ describe ChefDK::Command::Base do
57
58
  end
58
59
 
59
60
  def run_command(options)
60
- command_instance.run_with_default_options(options)
61
+ command_instance.run_with_default_options(enforce_license, options)
61
62
  end
62
63
 
63
64
  it "should print the banner for -h" do
@@ -95,6 +96,26 @@ describe ChefDK::Command::Base do
95
96
  expect(stdout).to eq("thanks for passing me true\n")
96
97
  end
97
98
 
99
+ describe "when enforce_license is true" do
100
+ let(:enforce_license) { true }
101
+
102
+ it "calls the license acceptance library" do
103
+ expect(LicenseAcceptance::Acceptor).to receive(:check_and_persist!).with("chef-dk", ChefDK::VERSION.to_s)
104
+ run_command([])
105
+ expect(stdout).to eq("thanks for passing me \n")
106
+ end
107
+ end
108
+
109
+ describe "when enforce_license is false" do
110
+ let(:enforce_license) { false }
111
+
112
+ it "does not call the license acceptance library" do
113
+ expect(LicenseAcceptance::Acceptor).to_not receive(:check_and_persist!)
114
+ run_command([])
115
+ expect(stdout).to eq("thanks for passing me \n")
116
+ end
117
+ end
118
+
98
119
  describe "when given invalid options" do
99
120
 
100
121
  it "prints the help banner and exits gracefully" do
@@ -105,6 +126,7 @@ describe ChefDK::Command::Base do
105
126
  expected = <<~E
106
127
  use me please
107
128
  -a, --arg ARG An option with a required argument
129
+ --chef-license ACCEPTANCE Accept the license for this product and any contained products ('accept', 'accept-no-persist', or 'accept-silent')
108
130
  -h, --help Show this message
109
131
  -u, --user If the user exists
110
132
  -v, --version Show chef version
@@ -125,6 +147,7 @@ describe ChefDK::Command::Base do
125
147
  expected = <<~E
126
148
  use me please
127
149
  -a, --arg ARG An option with a required argument
150
+ --chef-license ACCEPTANCE Accept the license for this product and any contained products ('accept', 'accept-no-persist', or 'accept-silent')
128
151
  -h, --help Show this message
129
152
  -u, --user If the user exists
130
153
  -v, --version Show chef version
File without changes
File without changes
@@ -36,7 +36,7 @@ describe ChefDK::Command::Env do
36
36
  end
37
37
 
38
38
  def run_command
39
- command_instance.run_with_default_options(command_options)
39
+ command_instance.run_with_default_options(false, command_options)
40
40
  end
41
41
 
42
42
  it "has a usage banner" do
@@ -24,7 +24,7 @@ describe ChefDK::Command::Exec do
24
24
  let(:command_options) { [] }
25
25
 
26
26
  def run_command
27
- command_instance.run_with_default_options(command_options)
27
+ command_instance.run_with_default_options(false, command_options)
28
28
  end
29
29
 
30
30
  it "has a usage banner" do
File without changes
File without changes
@@ -25,7 +25,7 @@ describe ChefDK::Command::GeneratorCommands::BuildCookbook do
25
25
 
26
26
  include_context("setup_git_committer_config")
27
27
 
28
- let(:argv) { %w{delivery_project} }
28
+ let(:argv) { %w{workflow_project} }
29
29
 
30
30
  let(:stdout_io) { StringIO.new }
31
31
  let(:stderr_io) { StringIO.new }
@@ -67,7 +67,7 @@ describe ChefDK::Command::GeneratorCommands::BuildCookbook do
67
67
 
68
68
  let(:expected_cookbook_files) do
69
69
  expected_cookbook_file_relpaths.map do |relpath|
70
- File.join(Dir["#{tempdir}"], "delivery_project", ".delivery", "build_cookbook", relpath)
70
+ File.join(tempdir, "workflow_project", ".delivery", "build_cookbook", relpath)
71
71
  end
72
72
  end
73
73
 
@@ -110,9 +110,9 @@ describe ChefDK::Command::GeneratorCommands::BuildCookbook do
110
110
 
111
111
  context "when given the name of the delivery project" do
112
112
 
113
- let(:argv) { %w{delivery_project} }
113
+ let(:argv) { %w{workflow_project} }
114
114
 
115
- let(:project_dir) { File.join(tempdir, "delivery_project") }
115
+ let(:project_dir) { File.join(tempdir, "workflow_project") }
116
116
 
117
117
  before do
118
118
  reset_tempdir
@@ -122,7 +122,7 @@ describe ChefDK::Command::GeneratorCommands::BuildCookbook do
122
122
  it "configures the generator context" do
123
123
  cookbook_generator.read_and_validate_params
124
124
  cookbook_generator.setup_context
125
- expect(generator_context.delivery_project_dir).to eq(File.join(Dir.pwd, "delivery_project"))
125
+ expect(generator_context.workflow_project_dir).to eq(File.join(Dir.pwd, "workflow_project"))
126
126
  end
127
127
 
128
128
  it "creates a build cookbook" do
@@ -130,7 +130,7 @@ describe ChefDK::Command::GeneratorCommands::BuildCookbook do
130
130
  allow(cookbook_generator.chef_runner).to receive(:stdout).and_return(stdout_io)
131
131
  expect(cookbook_generator.run).to eq(0)
132
132
  end
133
- generated_files = Dir.glob("#{tempdir}/delivery_project/**/*", File::FNM_DOTMATCH)
133
+ generated_files = Dir.glob("#{tempdir}/workflow_project/**/*", File::FNM_DOTMATCH)
134
134
  expected_cookbook_files.each do |expected_file|
135
135
  expect(generated_files).to include(expected_file)
136
136
  end
@@ -162,7 +162,7 @@ describe ChefDK::Command::GeneratorCommands::BuildCookbook do
162
162
  end
163
163
  end
164
164
 
165
- let(:file) { File.join(tempdir, "delivery_project", ".delivery", "build_cookbook", "kitchen.yml") }
165
+ let(:file) { File.join(tempdir, "workflow_project", ".delivery", "build_cookbook", "kitchen.yml") }
166
166
 
167
167
  it "creates a kitchen.yml with the expected content" do
168
168
  expect(IO.read(file)).to eq(expected_kitchen_yml_content)
@@ -173,7 +173,7 @@ describe ChefDK::Command::GeneratorCommands::BuildCookbook do
173
173
 
174
174
  context "when the delivery project is a cookbook" do
175
175
 
176
- let(:parent_metadata_rb) { File.join(tempdir, "delivery_project", "metadata.rb") }
176
+ let(:parent_metadata_rb) { File.join(tempdir, "workflow_project", "metadata.rb") }
177
177
 
178
178
  before do
179
179
  FileUtils.touch(parent_metadata_rb)
@@ -188,7 +188,7 @@ describe ChefDK::Command::GeneratorCommands::BuildCookbook do
188
188
  end
189
189
 
190
190
  describe "metadata.rb" do
191
- let(:file) { File.join(tempdir, "delivery_project", ".delivery", "build_cookbook", "metadata.rb") }
191
+ let(:file) { File.join(tempdir, "workflow_project", ".delivery", "build_cookbook", "metadata.rb") }
192
192
 
193
193
  include_examples "a generated file", :cookbook_name do
194
194
  let(:line) do
@@ -198,7 +198,7 @@ describe ChefDK::Command::GeneratorCommands::BuildCookbook do
198
198
  maintainer_email 'you@example.com'
199
199
  license 'all_rights'
200
200
  version '0.1.0'
201
- chef_version '>= 13.0'
201
+ chef_version '>= 14.0'
202
202
 
203
203
  depends 'delivery-truck'
204
204
  METADATA
@@ -228,7 +228,7 @@ describe ChefDK::Command::GeneratorCommands::BuildCookbook do
228
228
  syntax.rb
229
229
  unit.rb
230
230
  }.each do |phase_recipe|
231
- recipe_file = File.join(tempdir, "delivery_project", ".delivery", "build_cookbook", "recipes", phase_recipe)
231
+ recipe_file = File.join(tempdir, "workflow_project", ".delivery", "build_cookbook", "recipes", phase_recipe)
232
232
  phase = File.basename(phase_recipe, ".rb")
233
233
  expected_content = %Q{include_recipe 'delivery-truck::#{phase}'}
234
234
  expect(IO.read(recipe_file)).to include(expected_content)
@@ -248,7 +248,7 @@ describe ChefDK::Command::GeneratorCommands::BuildCookbook do
248
248
  end
249
249
 
250
250
  describe "metadata.rb" do
251
- let(:file) { File.join(tempdir, "delivery_project", ".delivery", "build_cookbook", "metadata.rb") }
251
+ let(:file) { File.join(tempdir, "workflow_project", ".delivery", "build_cookbook", "metadata.rb") }
252
252
 
253
253
  include_examples "a generated file", :cookbook_name do
254
254
  let(:line) do
@@ -285,7 +285,7 @@ describe ChefDK::Command::GeneratorCommands::BuildCookbook do
285
285
  syntax.rb
286
286
  unit.rb
287
287
  }.each do |phase_recipe|
288
- recipe_file = File.join(tempdir, "delivery_project", ".delivery", "build_cookbook", "recipes", phase_recipe)
288
+ recipe_file = File.join(tempdir, "workflow_project", ".delivery", "build_cookbook", "recipes", phase_recipe)
289
289
  expect(IO.read(recipe_file)).to_not include("include_recipe")
290
290
  end
291
291
  end
@@ -360,7 +360,7 @@ describe ChefDK::Command::GeneratorCommands::BuildCookbook do
360
360
  end
361
361
 
362
362
  context "when given a path including the .delivery directory" do
363
- let(:argv) { [ File.join(tempdir, "delivery_project", ".delivery", "build_cookbook") ] }
363
+ let(:argv) { [ File.join(tempdir, "workflow_project", ".delivery", "build_cookbook") ] }
364
364
 
365
365
  before do
366
366
  reset_tempdir
@@ -369,7 +369,7 @@ describe ChefDK::Command::GeneratorCommands::BuildCookbook do
369
369
  it "correctly sets the delivery project dir to the parent of the .delivery dir" do
370
370
  cookbook_generator.read_and_validate_params
371
371
  cookbook_generator.setup_context
372
- expect(generator_context.delivery_project_dir).to eq(File.join(tempdir, "delivery_project"))
372
+ expect(generator_context.workflow_project_dir).to eq(File.join(tempdir, "workflow_project"))
373
373
  end
374
374
 
375
375
  end
@@ -36,9 +36,7 @@ describe ChefDK::ChefResource::GeneratorDesc do
36
36
 
37
37
  let(:stderr) { StringIO.new }
38
38
 
39
- let(:null_formatter) do
40
- Chef::Formatters.new(:null, stdout, stderr)
41
- end
39
+ let(:null_formatter) { Chef::Formatters.new(:null, stdout, stderr) }
42
40
 
43
41
  let(:events) do
44
42
  Chef::EventDispatch::Dispatcher.new.tap do |d|
@@ -48,15 +46,13 @@ describe ChefDK::ChefResource::GeneratorDesc do
48
46
 
49
47
  let(:cookbook_collection) { Chef::CookbookCollection.new }
50
48
 
51
- let(:run_context) do
52
- Chef::RunContext.new(node, cookbook_collection, events)
53
- end
49
+ let(:run_context) { Chef::RunContext.new(node, cookbook_collection, events) }
54
50
 
55
51
  let(:message) { "this part of the cookbook does a thing" }
56
52
 
57
- let(:resource) do
58
- described_class.new(message, run_context)
59
- end
53
+ let(:resource) { described_class.new(message, run_context) }
54
+
55
+ let(:provider) { resource.provider_for_action(:write) }
60
56
 
61
57
  describe "resource" do
62
58
 
@@ -72,26 +68,10 @@ describe ChefDK::ChefResource::GeneratorDesc do
72
68
  expect(resource.identity).to eq(message)
73
69
  end
74
70
 
75
- end
76
-
77
- describe "provider" do
78
-
79
- let(:provider) do
80
- ChefDK::ChefProvider::GeneratorDesc.new(resource, run_context)
81
- end
82
-
83
- it "supports why run" do
84
- expect(provider.whyrun_supported?).to be(true)
85
- end
86
-
87
- it "does nothing for load current resource" do
88
- expect(provider.load_current_resource).to be(true)
89
- end
90
-
91
71
  it "writes the message to the formatter" do
92
72
  provider.action_write
93
73
  expect(stdout.string).to include(message)
94
74
  end
95
- end
96
75
 
76
+ end
97
77
  end
@@ -36,7 +36,7 @@ describe ChefDK::Command::GeneratorCommands::Cookbook do
36
36
  test
37
37
  test/integration
38
38
  test/integration/default/default_test.rb
39
- Berksfile
39
+ Policyfile.rb
40
40
  chefignore
41
41
  LICENSE
42
42
  metadata.rb
@@ -54,7 +54,7 @@ describe ChefDK::Command::GeneratorCommands::Cookbook do
54
54
 
55
55
  let(:expected_cookbook_files) do
56
56
  expected_cookbook_file_relpaths.map do |relpath|
57
- File.join(Dir["#{tempdir}"], "new_cookbook", relpath)
57
+ File.join(tempdir, "new_cookbook", relpath)
58
58
  end
59
59
  end
60
60
 
@@ -163,155 +163,239 @@ describe ChefDK::Command::GeneratorCommands::Cookbook do
163
163
  end
164
164
  end
165
165
 
166
- context "by default configure for delivery" do
166
+ context "when passed workflow option" do
167
167
 
168
- let(:dot_delivery) { File.join(tempdir, "new_cookbook", ".delivery") }
168
+ context "generates a workflow (delivery) cookbook" do
169
169
 
170
- before do
171
- Dir.chdir(tempdir) do
172
- allow(cookbook_generator.chef_runner).to receive(:stdout).and_return(stdout_io)
173
- expect(cookbook_generator.run).to eq(0)
174
- end
175
- end
170
+ let(:argv) { %w{new_cookbook --workflow} }
176
171
 
177
- describe ".delivery/project.toml" do
172
+ let(:dot_delivery) { File.join(tempdir, "new_cookbook", ".delivery") }
178
173
 
179
- let(:file) { File.join(tempdir, "new_cookbook", ".delivery", "project.toml") }
174
+ before do
175
+ Dir.chdir(tempdir) do
176
+ allow(cookbook_generator.chef_runner).to receive(:stdout).and_return(stdout_io)
177
+ expect(cookbook_generator.run).to eq(0)
178
+ end
179
+ end
180
180
 
181
- let(:expected_content) do
182
- <<~PROJECT_DOT_TOML
183
- # Delivery for Local Phases Execution
184
- #
185
- # This file allows you to execute test phases locally on a workstation or
186
- # in a CI pipeline. The delivery-cli will read this file and execute the
187
- # command(s) that are configured for each phase. You can customize them
188
- # by just modifying the phase key on this file.
189
- #
190
- # By default these phases are configured for Cookbook Workflow only
191
- #
181
+ describe ".delivery/project.toml" do
182
+
183
+ let(:file) { File.join(tempdir, "new_cookbook", ".delivery", "project.toml") }
184
+
185
+ let(:expected_content) do
186
+ <<~PROJECT_DOT_TOML
187
+ # Delivery for Local Phases Execution
188
+ #
189
+ # This file allows you to execute test phases locally on a workstation or
190
+ # in a CI pipeline. The delivery-cli will read this file and execute the
191
+ # command(s) that are configured for each phase. You can customize them
192
+ # by just modifying the phase key on this file.
193
+ #
194
+ # By default these phases are configured for Cookbook Workflow only
195
+ #
196
+
197
+ [local_phases]
198
+ unit = "chef exec rspec spec/"
199
+ lint = "chef exec cookstyle"
200
+ # Foodcritic includes rules only appropriate for community cookbooks
201
+ # uploaded to Supermarket. We turn off any rules tagged "supermarket"
202
+ # by default. If you plan to share this cookbook you should remove
203
+ # '-t ~supermarket' below to enable supermarket rules.
204
+ syntax = "chef exec foodcritic . -t ~supermarket"
205
+ provision = "chef exec kitchen create"
206
+ deploy = "chef exec kitchen converge"
207
+ smoke = "chef exec kitchen verify"
208
+ # The functional phase is optional, you can define it by uncommenting
209
+ # the line below and running the command: `delivery local functional`
210
+ # functional = ""
211
+ cleanup = "chef exec kitchen destroy"
212
+
213
+ # Remote project.toml file
214
+ #
215
+ # Instead of the local phases above, you may specify a remote URI location for
216
+ # the `project.toml` file. This is useful for teams that wish to centrally
217
+ # manage the behavior of the `delivery local` command across many different
218
+ # projects.
219
+ #
220
+ # remote_file = "https://url/project.toml"
221
+ PROJECT_DOT_TOML
222
+ end
223
+
224
+ it "exists with default config for Cookbook Workflow" do
225
+ expect(IO.read(file)).to eq(expected_content)
226
+ end
192
227
 
193
- [local_phases]
194
- unit = "chef exec rspec spec/"
195
- lint = "chef exec cookstyle"
196
- # Foodcritic includes rules only appropriate for community cookbooks
197
- # uploaded to Supermarket. We turn off any rules tagged "supermarket"
198
- # by default. If you plan to share this cookbook you should remove
199
- # '-t ~supermarket' below to enable supermarket rules.
200
- syntax = "chef exec foodcritic . -t ~supermarket"
201
- provision = "chef exec kitchen create"
202
- deploy = "chef exec kitchen converge"
203
- smoke = "chef exec kitchen verify"
204
- # The functional phase is optional, you can define it by uncommenting
205
- # the line below and running the command: `delivery local functional`
206
- # functional = ""
207
- cleanup = "chef exec kitchen destroy"
208
-
209
- # Remote project.toml file
210
- #
211
- # Instead of the local phases above, you may specify a remote URI location for
212
- # the `project.toml` file. This is useful for teams that wish to centrally
213
- # manage the behavior of the `delivery local` command across many different
214
- # projects.
215
- #
216
- # remote_file = "https://url/project.toml"
217
- PROJECT_DOT_TOML
218
228
  end
219
229
 
220
- it "exists with default config for Cookbook Workflow" do
221
- expect(IO.read(file)).to eq(expected_content)
230
+ describe ".delivery/config.json" do
231
+
232
+ let(:file) { File.join(tempdir, "new_cookbook", ".delivery", "config.json") }
233
+
234
+ let(:expected_content) do
235
+ <<~CONFIG_DOT_JSON
236
+ {
237
+ "version": "2",
238
+ "build_cookbook": {
239
+ "name": "build_cookbook",
240
+ "path": ".delivery/build_cookbook"
241
+ },
242
+ "delivery-truck": {
243
+ "lint": {
244
+ "enable_cookstyle": true
245
+ }
246
+ },
247
+ "skip_phases": [],
248
+ "job_dispatch": {
249
+ "version": "v2"
250
+ },
251
+ "dependencies": []
252
+ }
253
+ CONFIG_DOT_JSON
254
+ end
255
+
256
+ it "configures delivery to use a local build cookbook" do
257
+ expect(IO.read(file)).to eq(expected_content)
258
+ end
259
+
222
260
  end
223
261
 
224
- end
262
+ describe "build cookbook recipes" do
225
263
 
226
- describe ".delivery/config.json" do
264
+ let(:file) do
265
+ File.join(dot_delivery, "build_cookbook", "recipes", "publish.rb")
266
+ end
227
267
 
228
- let(:file) { File.join(tempdir, "new_cookbook", ".delivery", "config.json") }
268
+ let(:expected_content) do
269
+ <<~CONFIG_DOT_JSON
270
+ #
271
+ # Cookbook:: build_cookbook
272
+ # Recipe:: publish
273
+ #
274
+ # Copyright:: 2019, The Authors, All Rights Reserved.
229
275
 
230
- let(:expected_content) do
231
- <<~CONFIG_DOT_JSON
232
- {
233
- "version": "2",
234
- "build_cookbook": {
235
- "name": "build_cookbook",
236
- "path": ".delivery/build_cookbook"
237
- },
238
- "delivery-truck": {
239
- "lint": {
240
- "enable_cookstyle": true
241
- }
242
- },
243
- "skip_phases": [],
244
- "job_dispatch": {
245
- "version": "v2"
246
- },
247
- "dependencies": []
248
- }
249
- CONFIG_DOT_JSON
250
- end
276
+ include_recipe 'delivery-truck::publish'
277
+ CONFIG_DOT_JSON
278
+ end
279
+
280
+ it "delegates functionality to delivery-truck" do
281
+ expect(IO.read(file)).to include(expected_content)
282
+ end
251
283
 
252
- it "configures delivery to use a local build cookbook" do
253
- expect(IO.read(file)).to eq(expected_content)
254
284
  end
255
285
 
256
- end
286
+ describe "build cookbook Berksfile" do
257
287
 
258
- describe "build cookbook recipes" do
288
+ let(:file) do
289
+ File.join(dot_delivery, "build_cookbook", "Berksfile")
290
+ end
259
291
 
260
- let(:file) do
261
- File.join(dot_delivery, "build_cookbook", "recipes", "publish.rb")
262
- end
292
+ let(:expected_content) do
293
+ <<~CONFIG_DOT_JSON
294
+ source 'https://supermarket.chef.io'
263
295
 
264
- let(:expected_content) do
265
- <<~CONFIG_DOT_JSON
266
- #
267
- # Cookbook:: build_cookbook
268
- # Recipe:: publish
269
- #
270
- # Copyright:: 2020, The Authors, All Rights Reserved.
296
+ metadata
297
+
298
+ group :workflow do
299
+ cookbook 'test', path: './test/fixtures/cookbooks/test'
300
+ end
301
+ CONFIG_DOT_JSON
302
+ end
303
+
304
+ it "sets the sources for delivery library cookbooks to github" do
305
+ expect(IO.read(file)).to include(expected_content)
306
+ end
271
307
 
272
- include_recipe 'delivery-truck::publish'
273
- CONFIG_DOT_JSON
274
308
  end
309
+ end
275
310
 
276
- it "delegates functionality to delivery-truck" do
277
- expect(IO.read(file)).to include(expected_content)
311
+ context "when no delivery CLI configuration is present" do
312
+
313
+ let(:argv) { %w{new_cookbook --workflow} }
314
+
315
+ it "detects no delivery config" do
316
+ Dir.chdir(tempdir) do
317
+ expect(cookbook_generator.have_delivery_config?).to be(false)
318
+ end
278
319
  end
279
320
 
280
- end
321
+ it "emits concise output" do
322
+ Dir.chdir(tempdir) do
323
+ allow(cookbook_generator.chef_runner).to receive(:stdout).and_return(stdout_io)
324
+ expect(cookbook_generator.run).to eq(0)
325
+ end
326
+
327
+ expected = <<~OUTPUT
328
+ Generating cookbook new_cookbook
329
+ - Ensuring correct cookbook content
330
+ - Committing cookbook files to git
331
+ - Ensuring delivery CLI configuration
332
+ - Ensuring correct Workflow (Delivery) build cookbook content
333
+ - Adding delivery configuration to feature branch
334
+ - Adding build cookbook to feature branch
335
+ - Merging delivery content feature branch to master
336
+
337
+ #{non_delivery_breadcrumb}
338
+ OUTPUT
281
339
 
282
- describe "build cookbook Berksfile" do
340
+ actual = stdout_io.string
283
341
 
284
- let(:file) do
285
- File.join(dot_delivery, "build_cookbook", "Berksfile")
342
+ # the formatter will add escape sequences to turn off any colors
343
+ actual.gsub!("\e[0m", "")
344
+ expect(actual).to eq(expected)
286
345
  end
346
+ end
287
347
 
288
- let(:expected_content) do
289
- <<~CONFIG_DOT_JSON
290
- source 'https://supermarket.chef.io'
348
+ context "when a delivery CLI config is present" do
291
349
 
292
- metadata
350
+ # Setup a situation like this:
351
+ # there is a dir for the delivery organization with the
352
+ # `.delivery/cli.toml` in it. Inside that is another dir (maybe IRL this
353
+ # would be "cookbooks"), then we create the cookbook inside that.
293
354
 
294
- group :delivery do
295
- cookbook 'test', path: './test/fixtures/cookbooks/test'
296
- end
297
- CONFIG_DOT_JSON
355
+ let(:argv) { %w{new_cookbook --workflow} }
356
+
357
+ let(:tempdir_subdir) { File.join(tempdir, "subdirectory") }
358
+
359
+ let(:dot_delivery_dir) { File.join(tempdir, ".delivery") }
360
+
361
+ let(:dot_delivery_cli_toml) { File.join(dot_delivery_dir, "cli.toml") }
362
+
363
+ before do
364
+ Dir.mkdir(tempdir_subdir)
365
+ Dir.mkdir(dot_delivery_dir)
366
+ FileUtils.touch(dot_delivery_cli_toml)
298
367
  end
299
368
 
300
- it "sets the sources for delivery library cookbooks to github" do
301
- expect(IO.read(file)).to include(expected_content)
369
+ it "detects the delivery config" do
370
+ Dir.chdir(tempdir_subdir) do
371
+ expect(cookbook_generator.have_delivery_config?).to be(true)
372
+ end
302
373
  end
303
374
 
304
- end
305
- end
375
+ it "emits concise output" do
376
+ Dir.chdir(tempdir) do
377
+ allow(cookbook_generator.chef_runner).to receive(:stdout).and_return(stdout_io)
378
+ expect(cookbook_generator.run).to eq(0)
379
+ end
306
380
 
307
- context "when passed delivery option" do
381
+ expected = <<~OUTPUT
382
+ Generating cookbook new_cookbook
383
+ - Ensuring correct cookbook content
384
+ - Committing cookbook files to git
385
+ - Ensuring delivery CLI configuration
386
+ - Ensuring correct Workflow (Delivery) build cookbook content
387
+ - Adding delivery configuration to feature branch
388
+ - Adding build cookbook to feature branch
389
+ - Merging delivery content feature branch to master
308
390
 
309
- let(:argv) { %w{new_cookbook --delivery} }
391
+ Your cookbook is ready. To setup the pipeline, type `cd new_cookbook`, then run `delivery init`
392
+ OUTPUT
310
393
 
311
- it "still works with no action" do
312
- Dir.chdir(tempdir) do
313
- allow(cookbook_generator.chef_runner).to receive(:stdout).and_return(stdout_io)
314
- expect(cookbook_generator.run).to eq(0)
394
+ actual = stdout_io.string
395
+
396
+ # the formatter will add escape sequences to turn off any colors
397
+ actual.gsub!("\e[0m", "")
398
+ expect(actual).to eq(expected)
315
399
  end
316
400
  end
317
401
  end
@@ -343,93 +427,6 @@ describe ChefDK::Command::GeneratorCommands::Cookbook do
343
427
  end
344
428
  end
345
429
 
346
- context "when no delivery CLI configuration is present" do
347
-
348
- it "detects no delivery config" do
349
- Dir.chdir(tempdir) do
350
- expect(cookbook_generator.have_delivery_config?).to be(false)
351
- end
352
- end
353
-
354
- it "emits concise output" do
355
- Dir.chdir(tempdir) do
356
- allow(cookbook_generator.chef_runner).to receive(:stdout).and_return(stdout_io)
357
- expect(cookbook_generator.run).to eq(0)
358
- end
359
-
360
- expected = <<~OUTPUT
361
- Generating cookbook new_cookbook
362
- - Ensuring correct cookbook content
363
- - Committing cookbook files to git
364
- - Ensuring delivery configuration
365
- - Ensuring correct delivery build cookbook content
366
- - Adding delivery configuration to feature branch
367
- - Adding build cookbook to feature branch
368
- - Merging delivery content feature branch to master
369
-
370
- #{non_delivery_breadcrumb}
371
- OUTPUT
372
-
373
- actual = stdout_io.string
374
-
375
- # the formatter will add escape sequences to turn off any colors
376
- actual.gsub!("\e[0m", "")
377
- expect(actual).to eq(expected)
378
- end
379
- end
380
-
381
- context "when a delivery CLI config is present" do
382
-
383
- # Setup a situation like this:
384
- # there is a dir for the delivery organization with the
385
- # `.delivery/cli.toml` in it. Inside that is another dir (maybe IRL this
386
- # would be "cookbooks"), then we create the cookbook inside that.
387
-
388
- let(:tempdir_subdir) { File.join(tempdir, "subdirectory") }
389
-
390
- let(:dot_delivery_dir) { File.join(tempdir, ".delivery") }
391
-
392
- let(:dot_delivery_cli_toml) { File.join(dot_delivery_dir, "cli.toml") }
393
-
394
- before do
395
- Dir.mkdir(tempdir_subdir)
396
- Dir.mkdir(dot_delivery_dir)
397
- FileUtils.touch(dot_delivery_cli_toml)
398
- end
399
-
400
- it "detects the delivery config" do
401
- Dir.chdir(tempdir_subdir) do
402
- expect(cookbook_generator.have_delivery_config?).to be(true)
403
- end
404
- end
405
-
406
- it "emits concise output" do
407
- Dir.chdir(tempdir) do
408
- allow(cookbook_generator.chef_runner).to receive(:stdout).and_return(stdout_io)
409
- expect(cookbook_generator.run).to eq(0)
410
- end
411
-
412
- expected = <<~OUTPUT
413
- Generating cookbook new_cookbook
414
- - Ensuring correct cookbook content
415
- - Committing cookbook files to git
416
- - Ensuring delivery configuration
417
- - Ensuring correct delivery build cookbook content
418
- - Adding delivery configuration to feature branch
419
- - Adding build cookbook to feature branch
420
- - Merging delivery content feature branch to master
421
-
422
- Your cookbook is ready. To setup the pipeline, type `cd new_cookbook`, then run `delivery init`
423
- OUTPUT
424
-
425
- actual = stdout_io.string
426
-
427
- # the formatter will add escape sequences to turn off any colors
428
- actual.gsub!("\e[0m", "")
429
- expect(actual).to eq(expected)
430
- end
431
- end
432
-
433
430
  shared_examples_for "a generated file" do |context_var|
434
431
  before do
435
432
  Dir.chdir(tempdir) do
@@ -578,7 +575,7 @@ describe ChefDK::Command::GeneratorCommands::Cookbook do
578
575
  ## product_name and product_version specifies a specific Chef product and version to install.
579
576
  ## see the Chef documentation for more details: https://docs.chef.io/config_yml_kitchen.html
580
577
  # product_name: chef
581
- # product_version: 14
578
+ # product_version: 15
582
579
 
583
580
  verifier:
584
581
  name: inspec
@@ -665,7 +662,7 @@ describe ChefDK::Command::GeneratorCommands::Cookbook do
665
662
  ## product_name and product_version specifies a specific Chef product and version to install.
666
663
  ## see the Chef documentation for more details: https://docs.chef.io/config_yml_kitchen.html
667
664
  # product_name: chef
668
- # product_version: 14
665
+ # product_version: 15
669
666
 
670
667
  verifier:
671
668
  name: inspec