chef-dk 3.13.1 → 4.0.60
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +33 -25
- data/Gemfile.lock +317 -293
- data/LICENSE +0 -0
- data/Rakefile +0 -0
- data/bin/chef +1 -1
- data/chef-dk.gemspec +3 -3
- data/lib/chef-dk.rb +0 -0
- data/lib/chef-dk/authenticated_http.rb +0 -0
- data/lib/chef-dk/builtin_commands.rb +1 -3
- data/lib/chef-dk/chef_runner.rb +0 -0
- data/lib/chef-dk/chef_server_api_multi.rb +0 -0
- data/lib/chef-dk/cli.rb +2 -3
- data/lib/chef-dk/command/base.rb +9 -1
- data/lib/chef-dk/command/clean_policy_cookbooks.rb +2 -3
- data/lib/chef-dk/command/clean_policy_revisions.rb +3 -4
- data/lib/chef-dk/command/delete_policy.rb +1 -1
- data/lib/chef-dk/command/delete_policy_group.rb +1 -2
- data/lib/chef-dk/command/describe_cookbook.rb +5 -4
- data/lib/chef-dk/command/diff.rb +7 -9
- data/lib/chef-dk/command/env.rb +0 -0
- data/lib/chef-dk/command/exec.rb +0 -0
- data/lib/chef-dk/command/export.rb +0 -1
- data/lib/chef-dk/command/gem.rb +0 -0
- data/lib/chef-dk/command/generate.rb +1 -6
- data/lib/chef-dk/command/generator_commands.rb +0 -0
- data/lib/chef-dk/command/generator_commands/attribute.rb +0 -0
- data/lib/chef-dk/command/generator_commands/base.rb +0 -0
- data/lib/chef-dk/command/generator_commands/build_cookbook.rb +7 -7
- data/lib/chef-dk/command/generator_commands/chef_exts/generator_desc_resource.rb +4 -49
- data/lib/chef-dk/command/generator_commands/chef_exts/quieter_doc_formatter.rb +0 -0
- data/lib/chef-dk/command/generator_commands/chef_exts/recipe_dsl_ext.rb +0 -0
- data/lib/chef-dk/command/generator_commands/cookbook.rb +22 -23
- data/lib/chef-dk/command/generator_commands/cookbook_code_file.rb +0 -0
- data/lib/chef-dk/command/generator_commands/cookbook_file.rb +0 -0
- data/lib/chef-dk/command/generator_commands/generator_generator.rb +0 -0
- data/lib/chef-dk/command/generator_commands/helpers.rb +0 -0
- data/lib/chef-dk/command/generator_commands/policyfile.rb +0 -0
- data/lib/chef-dk/command/generator_commands/recipe.rb +0 -0
- data/lib/chef-dk/command/generator_commands/repo.rb +25 -9
- data/lib/chef-dk/command/generator_commands/resource.rb +0 -0
- data/lib/chef-dk/command/generator_commands/template.rb +0 -0
- data/lib/chef-dk/command/install.rb +1 -2
- data/lib/chef-dk/command/provision.rb +2 -404
- data/lib/chef-dk/command/push.rb +1 -2
- data/lib/chef-dk/command/push_archive.rb +2 -2
- data/lib/chef-dk/command/shell_init.rb +9 -5
- data/lib/chef-dk/command/show_policy.rb +0 -1
- data/lib/chef-dk/command/undelete.rb +0 -1
- data/lib/chef-dk/command/update.rb +0 -1
- data/lib/chef-dk/command/verify.rb +13 -110
- data/lib/chef-dk/commands_map.rb +0 -0
- data/lib/chef-dk/completions/bash.sh.erb +0 -0
- data/lib/chef-dk/completions/chef.fish.erb +0 -0
- data/lib/chef-dk/completions/zsh.zsh.erb +0 -0
- data/lib/chef-dk/component_test.rb +4 -2
- data/lib/chef-dk/configurable.rb +0 -1
- data/lib/chef-dk/cookbook_metadata.rb +0 -0
- data/lib/chef-dk/cookbook_omnifetch.rb +0 -0
- data/lib/chef-dk/cookbook_profiler/git.rb +0 -0
- data/lib/chef-dk/cookbook_profiler/identifiers.rb +0 -0
- data/lib/chef-dk/cookbook_profiler/null_scm.rb +0 -0
- data/lib/chef-dk/exceptions.rb +1 -1
- data/lib/chef-dk/generator.rb +1 -1
- data/lib/chef-dk/helpers.rb +1 -2
- data/lib/chef-dk/pager.rb +0 -0
- data/lib/chef-dk/policyfile/artifactory_cookbook_source.rb +0 -0
- data/lib/chef-dk/policyfile/attribute_merge_checker.rb +0 -0
- data/lib/chef-dk/policyfile/chef_repo_cookbook_source.rb +0 -0
- data/lib/chef-dk/policyfile/chef_server_cookbook_source.rb +0 -0
- data/lib/chef-dk/policyfile/chef_server_lock_fetcher.rb +2 -2
- data/lib/chef-dk/policyfile/community_cookbook_source.rb +0 -0
- data/lib/chef-dk/policyfile/comparison_base.rb +0 -0
- data/lib/chef-dk/policyfile/cookbook_location_specification.rb +0 -0
- data/lib/chef-dk/policyfile/cookbook_locks.rb +1 -1
- data/lib/chef-dk/policyfile/cookbook_sources.rb +0 -0
- data/lib/chef-dk/policyfile/delivery_supermarket_source.rb +0 -0
- data/lib/chef-dk/policyfile/differ.rb +0 -0
- data/lib/chef-dk/policyfile/dsl.rb +1 -1
- data/lib/chef-dk/policyfile/git_lock_fetcher.rb +0 -0
- data/lib/chef-dk/policyfile/included_policies_cookbook_source.rb +0 -0
- data/lib/chef-dk/policyfile/lister.rb +0 -0
- data/lib/chef-dk/policyfile/local_lock_fetcher.rb +0 -0
- data/lib/chef-dk/policyfile/lock_applier.rb +0 -0
- data/lib/chef-dk/policyfile/lock_fetcher_mixin.rb +0 -0
- data/lib/chef-dk/policyfile/null_cookbook_source.rb +0 -0
- data/lib/chef-dk/policyfile/policyfile_location_specification.rb +0 -0
- data/lib/chef-dk/policyfile/read_cookbook_for_compat_mode_upload.rb +0 -0
- data/lib/chef-dk/policyfile/remote_lock_fetcher.rb +0 -0
- data/lib/chef-dk/policyfile/reports/install.rb +0 -0
- data/lib/chef-dk/policyfile/reports/table_printer.rb +0 -0
- data/lib/chef-dk/policyfile/reports/upload.rb +0 -0
- data/lib/chef-dk/policyfile/solution_dependencies.rb +1 -1
- data/lib/chef-dk/policyfile/source_uri.rb +0 -0
- data/lib/chef-dk/policyfile/storage_config.rb +0 -0
- data/lib/chef-dk/policyfile/undo_record.rb +0 -0
- data/lib/chef-dk/policyfile/undo_stack.rb +0 -0
- data/lib/chef-dk/policyfile/uploader.rb +0 -0
- data/lib/chef-dk/policyfile_compiler.rb +2 -4
- data/lib/chef-dk/policyfile_lock.rb +1 -3
- data/lib/chef-dk/policyfile_services/clean_policies.rb +0 -0
- data/lib/chef-dk/policyfile_services/clean_policy_cookbooks.rb +0 -0
- data/lib/chef-dk/policyfile_services/export_repo.rb +6 -6
- data/lib/chef-dk/policyfile_services/install.rb +0 -0
- data/lib/chef-dk/policyfile_services/push.rb +0 -0
- data/lib/chef-dk/policyfile_services/push_archive.rb +2 -2
- data/lib/chef-dk/policyfile_services/rm_policy.rb +0 -0
- data/lib/chef-dk/policyfile_services/rm_policy_group.rb +0 -0
- data/lib/chef-dk/policyfile_services/show_policy.rb +0 -0
- data/lib/chef-dk/policyfile_services/undelete.rb +0 -0
- data/lib/chef-dk/policyfile_services/update_attributes.rb +0 -0
- data/lib/chef-dk/service_exception_inspectors.rb +0 -0
- data/lib/chef-dk/service_exception_inspectors/base.rb +0 -0
- data/lib/chef-dk/service_exception_inspectors/http.rb +0 -0
- data/lib/chef-dk/service_exceptions.rb +0 -0
- data/lib/chef-dk/shell_out.rb +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/Berksfile +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/build_cookbook/README.md +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/build_cookbook/kitchen.yml +1 -1
- data/lib/chef-dk/skeletons/code_generator/files/default/build_cookbook/test-fixture-recipe.rb +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/chefignore +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/cookbook_readmes/README-policy.md +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/cookbook_readmes/README.md +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/delivery-config.json +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/delivery-project.toml +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/gitignore +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/repo/README.md +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/README.md +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/attributes/default.rb +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/metadata.rb +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/recipes/default.rb +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/repo/data_bags/README.md +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/repo/data_bags/example/example_item.json +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/repo/dot-chef-repo.txt +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/repo/environments/README.md +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/repo/environments/example.json +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/repo/policyfiles/README.md +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/repo/roles/README.md +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/repo/roles/example.json +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/spec_helper.rb +0 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/spec_helper_policyfile.rb +0 -0
- data/lib/chef-dk/skeletons/code_generator/metadata.rb +0 -0
- data/lib/chef-dk/skeletons/code_generator/recipes/attribute.rb +0 -0
- data/lib/chef-dk/skeletons/code_generator/recipes/build_cookbook.rb +20 -20
- data/lib/chef-dk/skeletons/code_generator/recipes/cookbook.rb +24 -16
- data/lib/chef-dk/skeletons/code_generator/recipes/cookbook_file.rb +0 -0
- data/lib/chef-dk/skeletons/code_generator/recipes/helpers.rb +0 -0
- data/lib/chef-dk/skeletons/code_generator/recipes/policyfile.rb +0 -0
- data/lib/chef-dk/skeletons/code_generator/recipes/recipe.rb +0 -0
- data/lib/chef-dk/skeletons/code_generator/recipes/repo.rb +7 -3
- data/lib/chef-dk/skeletons/code_generator/recipes/resource.rb +0 -0
- data/lib/chef-dk/skeletons/code_generator/recipes/template.rb +0 -0
- data/lib/chef-dk/skeletons/code_generator/templates/default/CHANGELOG.md.erb +0 -0
- data/lib/chef-dk/skeletons/code_generator/templates/default/LICENSE.all_rights.erb +0 -0
- data/lib/chef-dk/skeletons/code_generator/templates/default/LICENSE.apachev2.erb +0 -0
- data/lib/chef-dk/skeletons/code_generator/templates/default/LICENSE.gplv2.erb +0 -0
- data/lib/chef-dk/skeletons/code_generator/templates/default/LICENSE.gplv3.erb +0 -0
- data/lib/chef-dk/skeletons/code_generator/templates/default/LICENSE.mit.erb +0 -0
- data/lib/chef-dk/skeletons/code_generator/templates/default/Policyfile.rb.erb +0 -0
- data/lib/chef-dk/skeletons/code_generator/templates/default/README.md.erb +0 -0
- data/lib/chef-dk/skeletons/code_generator/templates/default/attribute.rb.erb +0 -0
- data/lib/chef-dk/skeletons/code_generator/templates/default/build_cookbook/Berksfile.erb +1 -1
- data/lib/chef-dk/skeletons/code_generator/templates/default/build_cookbook/metadata.rb.erb +1 -1
- data/lib/chef-dk/skeletons/code_generator/templates/default/build_cookbook/recipe.rb.erb +0 -0
- data/lib/chef-dk/skeletons/code_generator/templates/default/cookbook_file.erb +0 -0
- data/lib/chef-dk/skeletons/code_generator/templates/default/helpers.rb.erb +0 -0
- data/lib/chef-dk/skeletons/code_generator/templates/default/inspec_default_test.rb.erb +0 -0
- data/lib/chef-dk/skeletons/code_generator/templates/default/kitchen.yml.erb +1 -1
- data/lib/chef-dk/skeletons/code_generator/templates/default/kitchen_dokken.yml.erb +0 -0
- data/lib/chef-dk/skeletons/code_generator/templates/default/kitchen_policyfile.yml.erb +1 -1
- data/lib/chef-dk/skeletons/code_generator/templates/default/metadata.rb.erb +1 -1
- data/lib/chef-dk/skeletons/code_generator/templates/default/recipe.rb.erb +0 -0
- data/lib/chef-dk/skeletons/code_generator/templates/default/recipe_spec.rb.erb +0 -0
- data/lib/chef-dk/skeletons/code_generator/templates/default/repo/gitignore.erb +0 -0
- data/lib/chef-dk/skeletons/code_generator/templates/default/resource.rb.erb +0 -0
- data/lib/chef-dk/skeletons/code_generator/templates/default/template.erb +0 -0
- data/lib/chef-dk/ui.rb +0 -0
- data/lib/chef-dk/version.rb +1 -1
- data/lib/kitchen/provisioner/policyfile_zero.rb +0 -0
- data/spec/shared/a_file_generator.rb +0 -0
- data/spec/shared/a_generated_file.rb +0 -0
- data/spec/shared/command_with_ui_object.rb +0 -0
- data/spec/shared/custom_generator_cookbook.rb +0 -0
- data/spec/shared/fixture_cookbook_checksums.rb +1 -1
- data/spec/shared/setup_git_committer_config.rb +0 -0
- data/spec/shared/setup_git_cookbooks.rb +0 -0
- data/spec/spec_helper.rb +0 -4
- data/spec/test_helpers.rb +0 -0
- data/spec/unit/chef_runner_spec.rb +0 -0
- data/spec/unit/chef_server_api_multi_spec.rb +0 -0
- data/spec/unit/cli_spec.rb +0 -0
- data/spec/unit/command/base_spec.rb +24 -1
- data/spec/unit/command/clean_policy_cookbooks_spec.rb +0 -0
- data/spec/unit/command/clean_policy_revisions_spec.rb +0 -0
- data/spec/unit/command/delete_policy_group_spec.rb +0 -0
- data/spec/unit/command/delete_policy_spec.rb +0 -0
- data/spec/unit/command/diff_spec.rb +0 -0
- data/spec/unit/command/env_spec.rb +1 -1
- data/spec/unit/command/exec_spec.rb +1 -1
- data/spec/unit/command/export_spec.rb +0 -0
- data/spec/unit/command/generate_spec.rb +0 -0
- data/spec/unit/command/generator_commands/attribute_spec.rb +0 -0
- data/spec/unit/command/generator_commands/base_spec.rb +0 -0
- data/spec/unit/command/generator_commands/build_cookbook_spec.rb +15 -15
- data/spec/unit/command/generator_commands/chef_exts/generator_desc_resource_spec.rb +6 -26
- data/spec/unit/command/generator_commands/chef_exts/recipe_dsl_ext_spec.rb +0 -0
- data/spec/unit/command/generator_commands/cookbook_file_spec.rb +0 -0
- data/spec/unit/command/generator_commands/cookbook_spec.rb +200 -203
- data/spec/unit/command/generator_commands/generator_generator_spec.rb +7 -7
- data/spec/unit/command/generator_commands/helpers_spec.rb +0 -0
- data/spec/unit/command/generator_commands/policyfile_spec.rb +0 -0
- data/spec/unit/command/generator_commands/recipe_spec.rb +1 -2
- data/spec/unit/command/generator_commands/repo_spec.rb +8 -8
- data/spec/unit/command/generator_commands/resource_spec.rb +0 -0
- data/spec/unit/command/generator_commands/template_spec.rb +0 -0
- data/spec/unit/command/install_spec.rb +0 -0
- data/spec/unit/command/push_archive_spec.rb +0 -0
- data/spec/unit/command/push_spec.rb +0 -0
- data/spec/unit/command/shell_init_spec.rb +0 -0
- data/spec/unit/command/show_policy_spec.rb +0 -0
- data/spec/unit/command/undelete_spec.rb +0 -0
- data/spec/unit/command/update_spec.rb +0 -0
- data/spec/unit/command/verify_spec.rb +2 -3
- data/spec/unit/commands_map_spec.rb +0 -0
- data/spec/unit/component_test_spec.rb +0 -0
- data/spec/unit/configurable_spec.rb +0 -0
- data/spec/unit/cookbook_metadata_spec.rb +0 -0
- data/spec/unit/cookbook_profiler/git_spec.rb +0 -0
- data/spec/unit/cookbook_profiler/identifiers_spec.rb +3 -3
- data/spec/unit/fixtures/chef-runner-cookbooks/test_cookbook/recipes/recipe_one.rb +0 -0
- data/spec/unit/fixtures/chef-runner-cookbooks/test_cookbook/recipes/recipe_two.rb +0 -0
- data/spec/unit/fixtures/command/cli_test_command.rb +0 -0
- data/spec/unit/fixtures/command/explicit_path_example.rb +0 -0
- data/spec/unit/fixtures/configurable/test_config_loader.rb +0 -0
- data/spec/unit/fixtures/configurable/test_configurable.rb +0 -0
- data/spec/unit/fixtures/cookbook_cache/baz-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/.kitchen.yml +0 -0
- data/spec/unit/fixtures/cookbook_cache/baz-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/Berksfile +0 -0
- data/spec/unit/fixtures/cookbook_cache/baz-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/README.md +0 -0
- data/spec/unit/fixtures/cookbook_cache/baz-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/chefignore +0 -0
- data/spec/unit/fixtures/cookbook_cache/baz-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/metadata.rb +0 -0
- data/spec/unit/fixtures/cookbook_cache/baz-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/recipes/default.rb +0 -0
- data/spec/unit/fixtures/cookbook_cache/dep_of_bar-1.2.3/.kitchen.yml +0 -0
- data/spec/unit/fixtures/cookbook_cache/dep_of_bar-1.2.3/Berksfile +0 -0
- data/spec/unit/fixtures/cookbook_cache/dep_of_bar-1.2.3/README.md +0 -0
- data/spec/unit/fixtures/cookbook_cache/dep_of_bar-1.2.3/chefignore +0 -0
- data/spec/unit/fixtures/cookbook_cache/dep_of_bar-1.2.3/metadata.rb +0 -0
- data/spec/unit/fixtures/cookbook_cache/dep_of_bar-1.2.3/recipes/default.rb +0 -0
- data/spec/unit/fixtures/cookbook_cache/foo-1.0.0/Berksfile +0 -0
- data/spec/unit/fixtures/cookbook_cache/foo-1.0.0/README.md +0 -0
- data/spec/unit/fixtures/cookbook_cache/foo-1.0.0/chefignore +0 -0
- data/spec/unit/fixtures/cookbook_cache/foo-1.0.0/{.kitchen.yml → kitchen.yml} +0 -0
- data/spec/unit/fixtures/cookbook_cache/foo-1.0.0/metadata.rb +0 -0
- data/spec/unit/fixtures/cookbook_cache/foo-1.0.0/recipes/default.rb +0 -0
- data/spec/unit/fixtures/cookbooks_api/chef_server_universe.json +0 -0
- data/spec/unit/fixtures/cookbooks_api/pruned_chef_server_universe.json +0 -0
- data/spec/unit/fixtures/cookbooks_api/pruned_small_universe.json +0 -0
- data/spec/unit/fixtures/cookbooks_api/small_universe.json +0 -0
- data/spec/unit/fixtures/cookbooks_api/universe.json +0 -0
- data/spec/unit/fixtures/cookbooks_api/update_fixtures.rb +0 -0
- data/spec/unit/fixtures/dev_cookbooks/README.md +0 -0
- data/spec/unit/fixtures/dev_cookbooks/bar-cookbook.gitbundle +0 -0
- data/spec/unit/fixtures/eg_omnibus_dir/missing_apps/bin/.keep +0 -0
- data/spec/unit/fixtures/eg_omnibus_dir/missing_apps/embedded/.keep +0 -0
- data/spec/unit/fixtures/eg_omnibus_dir/missing_apps/embedded/bin/.keep +0 -0
- data/spec/unit/fixtures/eg_omnibus_dir/missing_component/bin/.keep +0 -0
- data/spec/unit/fixtures/eg_omnibus_dir/missing_component/embedded/apps/berkshelf/.keep +0 -0
- data/spec/unit/fixtures/eg_omnibus_dir/missing_component/embedded/apps/test-kitchen/.keep +0 -0
- data/spec/unit/fixtures/eg_omnibus_dir/missing_component/embedded/bin/.keep +0 -0
- data/spec/unit/fixtures/eg_omnibus_dir/valid/bin/.keep +0 -0
- data/spec/unit/fixtures/eg_omnibus_dir/valid/embedded/apps/chef-dk/.keep +0 -0
- data/spec/unit/fixtures/eg_omnibus_dir/valid/embedded/bin/.keep +0 -0
- data/spec/unit/fixtures/example_app/Policyfile.rb +0 -0
- data/spec/unit/fixtures/example_cookbook/.gitignore +0 -0
- data/spec/unit/fixtures/example_cookbook/.kitchen.yml +0 -0
- data/spec/unit/fixtures/example_cookbook/Berksfile +0 -0
- data/spec/unit/fixtures/example_cookbook/README.md +0 -0
- data/spec/unit/fixtures/example_cookbook/chefignore +0 -0
- data/spec/unit/fixtures/example_cookbook/metadata.rb +0 -0
- data/spec/unit/fixtures/example_cookbook/recipes/default.rb +0 -0
- data/spec/unit/fixtures/example_cookbook_metadata_json_only/.gitignore +0 -0
- data/spec/unit/fixtures/example_cookbook_metadata_json_only/.kitchen.yml +0 -0
- data/spec/unit/fixtures/example_cookbook_metadata_json_only/Berksfile +0 -0
- data/spec/unit/fixtures/example_cookbook_metadata_json_only/README.md +0 -0
- data/spec/unit/fixtures/example_cookbook_metadata_json_only/chefignore +0 -0
- data/spec/unit/fixtures/example_cookbook_metadata_json_only/metadata.json +0 -0
- data/spec/unit/fixtures/example_cookbook_metadata_json_only/recipes/default.rb +0 -0
- data/spec/unit/fixtures/example_cookbook_no_metadata/.gitignore +0 -0
- data/spec/unit/fixtures/example_cookbook_no_metadata/.kitchen.yml +0 -0
- data/spec/unit/fixtures/example_cookbook_no_metadata/Berksfile +0 -0
- data/spec/unit/fixtures/example_cookbook_no_metadata/README.md +0 -0
- data/spec/unit/fixtures/example_cookbook_no_metadata/chefignore +0 -0
- data/spec/unit/fixtures/example_cookbook_no_metadata/recipes/default.rb +0 -0
- data/spec/unit/fixtures/local_path_cookbooks/another-local-cookbook/README.md +0 -0
- data/spec/unit/fixtures/local_path_cookbooks/another-local-cookbook/chefignore +0 -0
- data/spec/unit/fixtures/local_path_cookbooks/another-local-cookbook/metadata.rb +0 -0
- data/spec/unit/fixtures/local_path_cookbooks/another-local-cookbook/recipes/default.rb +0 -0
- data/spec/unit/fixtures/local_path_cookbooks/cookbook-with-a-dep/Berksfile +0 -0
- data/spec/unit/fixtures/local_path_cookbooks/cookbook-with-a-dep/README.md +0 -0
- data/spec/unit/fixtures/local_path_cookbooks/cookbook-with-a-dep/chefignore +0 -0
- data/spec/unit/fixtures/local_path_cookbooks/cookbook-with-a-dep/metadata.rb +0 -0
- data/spec/unit/fixtures/local_path_cookbooks/cookbook-with-a-dep/recipes/default.rb +0 -0
- data/spec/unit/fixtures/local_path_cookbooks/local-cookbook/.kitchen.yml +0 -0
- data/spec/unit/fixtures/local_path_cookbooks/local-cookbook/Berksfile +0 -0
- data/spec/unit/fixtures/local_path_cookbooks/local-cookbook/README.md +0 -0
- data/spec/unit/fixtures/local_path_cookbooks/local-cookbook/chefignore +0 -0
- data/spec/unit/fixtures/local_path_cookbooks/local-cookbook/extra/extra_file.txt +0 -0
- data/spec/unit/fixtures/local_path_cookbooks/local-cookbook/metadata.rb +0 -0
- data/spec/unit/fixtures/local_path_cookbooks/local-cookbook/recipes/default.rb +0 -0
- data/spec/unit/fixtures/local_path_cookbooks/metadata-missing/README.md +0 -0
- data/spec/unit/fixtures/local_path_cookbooks/noignore-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/.kitchen.yml +0 -0
- data/spec/unit/fixtures/local_path_cookbooks/noignore-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/README.md +0 -0
- data/spec/unit/fixtures/local_path_cookbooks/noignore-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/metadata.rb +0 -0
- data/spec/unit/fixtures/local_path_cookbooks/noignore-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/recipes/default.rb +0 -0
- data/spec/unit/generator_spec.rb +0 -0
- data/spec/unit/pager_spec.rb +0 -0
- data/spec/unit/policyfile/artifactory_cookbook_source_spec.rb +0 -0
- data/spec/unit/policyfile/attribute_merge_checker_spec.rb +0 -0
- data/spec/unit/policyfile/chef_repo_cookbook_source_spec.rb +0 -0
- data/spec/unit/policyfile/chef_server_cookbook_source_spec.rb +0 -0
- data/spec/unit/policyfile/chef_server_lock_fetcher_spec.rb +0 -0
- data/spec/unit/policyfile/community_cookbook_source_spec.rb +0 -0
- data/spec/unit/policyfile/comparison_base_spec.rb +0 -0
- data/spec/unit/policyfile/cookbook_location_specification_spec.rb +0 -0
- data/spec/unit/policyfile/cookbook_locks_spec.rb +0 -0
- data/spec/unit/policyfile/delivery_supermarket_source_spec.rb +0 -0
- data/spec/unit/policyfile/differ_spec.rb +0 -0
- data/spec/unit/policyfile/git_lock_fetcher_spec.rb +0 -0
- data/spec/unit/policyfile/included_policies_cookbook_source_spec.rb +0 -0
- data/spec/unit/policyfile/lister_spec.rb +0 -0
- data/spec/unit/policyfile/local_lock_fetcher_spec.rb +0 -0
- data/spec/unit/policyfile/lock_applier_spec.rb +0 -0
- data/spec/unit/policyfile/lock_fetcher_mixin_spec.rb +0 -0
- data/spec/unit/policyfile/null_cookbook_source_spec.rb +0 -0
- data/spec/unit/policyfile/read_cookbook_for_compat_mode_upload_spec.rb +0 -0
- data/spec/unit/policyfile/remote_lock_fetcher_spec.rb +0 -0
- data/spec/unit/policyfile/reports/install_spec.rb +0 -0
- data/spec/unit/policyfile/reports/upload_spec.rb +0 -0
- data/spec/unit/policyfile/solution_dependencies_spec.rb +0 -0
- data/spec/unit/policyfile/source_uri_spec.rb +0 -0
- data/spec/unit/policyfile/storage_config_spec.rb +0 -0
- data/spec/unit/policyfile/undo_record_spec.rb +0 -0
- data/spec/unit/policyfile/undo_stack_spec.rb +0 -0
- data/spec/unit/policyfile/uploader_spec.rb +0 -0
- data/spec/unit/policyfile_demands_spec.rb +0 -0
- data/spec/unit/policyfile_evaluation_spec.rb +0 -0
- data/spec/unit/policyfile_includes_dsl_spec.rb +0 -0
- data/spec/unit/policyfile_includes_spec.rb +0 -0
- data/spec/unit/policyfile_install_with_includes_spec.rb +0 -0
- data/spec/unit/policyfile_lock_build_spec.rb +2 -2
- data/spec/unit/policyfile_lock_install_spec.rb +0 -0
- data/spec/unit/policyfile_lock_serialization_spec.rb +0 -0
- data/spec/unit/policyfile_lock_validation_spec.rb +0 -0
- data/spec/unit/policyfile_services/clean_policies_spec.rb +0 -0
- data/spec/unit/policyfile_services/clean_policy_cookbooks_spec.rb +0 -0
- data/spec/unit/policyfile_services/export_repo_spec.rb +6 -6
- data/spec/unit/policyfile_services/install_spec.rb +0 -0
- data/spec/unit/policyfile_services/push_archive_spec.rb +2 -2
- data/spec/unit/policyfile_services/push_spec.rb +0 -0
- data/spec/unit/policyfile_services/rm_policy_group_spec.rb +0 -0
- data/spec/unit/policyfile_services/rm_policy_spec.rb +0 -0
- data/spec/unit/policyfile_services/show_policy_spec.rb +0 -0
- data/spec/unit/policyfile_services/undelete_spec.rb +0 -0
- data/spec/unit/policyfile_services/update_attributes_spec.rb +0 -0
- data/spec/unit/policyfile_services/update_spec.rb +0 -0
- data/spec/unit/service_exception_inspectors/base_spec.rb +0 -0
- data/spec/unit/service_exception_inspectors/http_spec.rb +1 -1
- data/spec/unit/shell_out_spec.rb +0 -0
- data/warning.txt +3 -2
- metadata +20 -19
- data/lib/chef-dk/command/generator_commands/app.rb +0 -106
- data/lib/chef-dk/skeletons/code_generator/recipes/app.rb +0 -87
- data/spec/unit/command/generator_commands/app_spec.rb +0 -166
- data/spec/unit/command/provision_spec.rb +0 -589
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -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:
|
22
|
+
# product_version: 15
|
23
23
|
|
24
24
|
verifier:
|
25
25
|
name: inspec
|
File without changes
|
@@ -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:
|
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 '>=
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/chef-dk/ui.rb
CHANGED
File without changes
|
data/lib/chef-dk/version.rb
CHANGED
File without changes
|
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) { "
|
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
|
data/spec/spec_helper.rb
CHANGED
data/spec/test_helpers.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
data/spec/unit/cli_spec.rb
CHANGED
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
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{
|
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(
|
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{
|
113
|
+
let(:argv) { %w{workflow_project} }
|
114
114
|
|
115
|
-
let(:project_dir) { File.join(tempdir, "
|
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.
|
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}/
|
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, "
|
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, "
|
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, "
|
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 '>=
|
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, "
|
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, "
|
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, "
|
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, "
|
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.
|
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)
|
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)
|
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)
|
58
|
-
|
59
|
-
|
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
|
File without changes
|
File without changes
|
@@ -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
|
-
|
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(
|
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 "
|
166
|
+
context "when passed workflow option" do
|
167
167
|
|
168
|
-
|
168
|
+
context "generates a workflow (delivery) cookbook" do
|
169
169
|
|
170
|
-
|
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
|
-
|
172
|
+
let(:dot_delivery) { File.join(tempdir, "new_cookbook", ".delivery") }
|
178
173
|
|
179
|
-
|
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
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
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
|
-
|
221
|
-
|
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
|
-
|
262
|
+
describe "build cookbook recipes" do
|
225
263
|
|
226
|
-
|
264
|
+
let(:file) do
|
265
|
+
File.join(dot_delivery, "build_cookbook", "recipes", "publish.rb")
|
266
|
+
end
|
227
267
|
|
228
|
-
|
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
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
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
|
-
|
286
|
+
describe "build cookbook Berksfile" do
|
257
287
|
|
258
|
-
|
288
|
+
let(:file) do
|
289
|
+
File.join(dot_delivery, "build_cookbook", "Berksfile")
|
290
|
+
end
|
259
291
|
|
260
|
-
|
261
|
-
|
262
|
-
|
292
|
+
let(:expected_content) do
|
293
|
+
<<~CONFIG_DOT_JSON
|
294
|
+
source 'https://supermarket.chef.io'
|
263
295
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
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
|
-
|
277
|
-
|
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
|
-
|
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
|
-
|
340
|
+
actual = stdout_io.string
|
283
341
|
|
284
|
-
|
285
|
-
|
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
|
-
|
289
|
-
<<~CONFIG_DOT_JSON
|
290
|
-
source 'https://supermarket.chef.io'
|
348
|
+
context "when a delivery CLI config is present" do
|
291
349
|
|
292
|
-
|
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
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
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 "
|
301
|
-
|
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
|
-
|
305
|
-
|
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
|
-
|
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
|
-
|
391
|
+
Your cookbook is ready. To setup the pipeline, type `cd new_cookbook`, then run `delivery init`
|
392
|
+
OUTPUT
|
310
393
|
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
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:
|
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:
|
665
|
+
# product_version: 15
|
669
666
|
|
670
667
|
verifier:
|
671
668
|
name: inspec
|