chef-dk 1.2.22 → 1.3.40
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +8 -12
- data/Gemfile.lock +120 -116
- data/README.md +4 -3
- data/Rakefile +54 -0
- data/acceptance/Gemfile.lock +36 -47
- data/bin/chef +1 -1
- data/chef-dk.gemspec +9 -9
- data/lib/chef-dk/authenticated_http.rb +6 -7
- data/lib/chef-dk/builtin_commands.rb +3 -4
- data/lib/chef-dk/chef_runner.rb +7 -8
- data/lib/chef-dk/cli.rb +11 -11
- data/lib/chef-dk/command/base.rb +4 -4
- data/lib/chef-dk/command/clean_policy_cookbooks.rb +4 -5
- data/lib/chef-dk/command/clean_policy_revisions.rb +4 -6
- data/lib/chef-dk/command/delete_policy.rb +4 -6
- data/lib/chef-dk/command/delete_policy_group.rb +6 -8
- data/lib/chef-dk/command/diff.rb +9 -10
- data/lib/chef-dk/command/env.rb +26 -27
- data/lib/chef-dk/command/exec.rb +5 -6
- data/lib/chef-dk/command/export.rb +8 -10
- data/lib/chef-dk/command/gem.rb +5 -5
- data/lib/chef-dk/command/generate.rb +19 -19
- data/lib/chef-dk/command/generator_commands.rb +8 -8
- data/lib/chef-dk/command/generator_commands/app.rb +2 -3
- data/lib/chef-dk/command/generator_commands/attribute.rb +2 -3
- data/lib/chef-dk/command/generator_commands/base.rb +13 -13
- data/lib/chef-dk/command/generator_commands/build_cookbook.rb +2 -2
- data/lib/chef-dk/command/generator_commands/chef_exts/generator_desc_resource.rb +2 -2
- data/lib/chef-dk/command/generator_commands/chef_exts/quieter_doc_formatter.rb +1 -2
- data/lib/chef-dk/command/generator_commands/chef_exts/recipe_dsl_ext.rb +1 -2
- data/lib/chef-dk/command/generator_commands/cookbook.rb +2 -2
- data/lib/chef-dk/command/generator_commands/cookbook_code_file.rb +3 -3
- data/lib/chef-dk/command/generator_commands/cookbook_file.rb +2 -2
- data/lib/chef-dk/command/generator_commands/generator_generator.rb +4 -7
- data/lib/chef-dk/command/generator_commands/lwrp.rb +2 -2
- data/lib/chef-dk/command/generator_commands/policyfile.rb +2 -3
- data/lib/chef-dk/command/generator_commands/recipe.rb +2 -2
- data/lib/chef-dk/command/generator_commands/repo.rb +1 -3
- data/lib/chef-dk/command/generator_commands/template.rb +2 -2
- data/lib/chef-dk/command/install.rb +4 -5
- data/lib/chef-dk/command/provision.rb +12 -14
- data/lib/chef-dk/command/push.rb +5 -6
- data/lib/chef-dk/command/push_archive.rb +4 -5
- data/lib/chef-dk/command/shell_init.rb +15 -16
- data/lib/chef-dk/command/show_policy.rb +5 -7
- data/lib/chef-dk/command/undelete.rb +6 -7
- data/lib/chef-dk/command/update.rb +5 -6
- data/lib/chef-dk/command/verify.rb +30 -31
- data/lib/chef-dk/commands_map.rb +1 -3
- data/lib/chef-dk/component_test.rb +13 -13
- data/lib/chef-dk/configurable.rb +2 -2
- data/lib/chef-dk/cookbook_metadata.rb +2 -2
- data/lib/chef-dk/cookbook_omnifetch.rb +7 -8
- data/lib/chef-dk/cookbook_profiler/git.rb +8 -8
- data/lib/chef-dk/cookbook_profiler/identifiers.rb +7 -7
- data/lib/chef-dk/cookbook_profiler/null_scm.rb +0 -1
- data/lib/chef-dk/exceptions.rb +1 -1
- data/lib/chef-dk/generator.rb +9 -7
- data/lib/chef-dk/helpers.rb +15 -15
- data/lib/chef-dk/pager.rb +2 -3
- data/lib/chef-dk/policyfile/chef_repo_cookbook_source.rb +4 -4
- data/lib/chef-dk/policyfile/chef_server_cookbook_source.rb +6 -6
- data/lib/chef-dk/policyfile/community_cookbook_source.rb +4 -5
- data/lib/chef-dk/policyfile/comparison_base.rb +3 -4
- data/lib/chef-dk/policyfile/cookbook_location_specification.rb +6 -6
- data/lib/chef-dk/policyfile/cookbook_locks.rb +11 -11
- data/lib/chef-dk/policyfile/cookbook_sources.rb +5 -5
- data/lib/chef-dk/policyfile/delivery_supermarket_source.rb +8 -9
- data/lib/chef-dk/policyfile/differ.rb +7 -10
- data/lib/chef-dk/policyfile/dsl.rb +10 -11
- data/lib/chef-dk/policyfile/lister.rb +3 -6
- data/lib/chef-dk/policyfile/null_cookbook_source.rb +3 -3
- data/lib/chef-dk/policyfile/read_cookbook_for_compat_mode_upload.rb +3 -3
- data/lib/chef-dk/policyfile/reports/install.rb +3 -4
- data/lib/chef-dk/policyfile/reports/table_printer.rb +0 -1
- data/lib/chef-dk/policyfile/reports/upload.rb +4 -4
- data/lib/chef-dk/policyfile/solution_dependencies.rb +22 -22
- data/lib/chef-dk/policyfile/source_uri.rb +2 -2
- data/lib/chef-dk/policyfile/storage_config.rb +4 -5
- data/lib/chef-dk/policyfile/undo_record.rb +6 -9
- data/lib/chef-dk/policyfile/undo_stack.rb +5 -7
- data/lib/chef-dk/policyfile/uploader.rb +8 -8
- data/lib/chef-dk/policyfile_compiler.rb +16 -20
- data/lib/chef-dk/policyfile_lock.rb +10 -11
- data/lib/chef-dk/policyfile_services/clean_policies.rb +3 -3
- data/lib/chef-dk/policyfile_services/clean_policy_cookbooks.rb +3 -5
- data/lib/chef-dk/policyfile_services/export_repo.rb +13 -14
- data/lib/chef-dk/policyfile_services/install.rb +6 -6
- data/lib/chef-dk/policyfile_services/push.rb +6 -8
- data/lib/chef-dk/policyfile_services/push_archive.rb +6 -10
- data/lib/chef-dk/policyfile_services/rm_policy.rb +4 -5
- data/lib/chef-dk/policyfile_services/rm_policy_group.rb +4 -5
- data/lib/chef-dk/policyfile_services/show_policy.rb +5 -6
- data/lib/chef-dk/policyfile_services/undelete.rb +3 -3
- data/lib/chef-dk/policyfile_services/update_attributes.rb +4 -6
- data/lib/chef-dk/service_exception_inspectors.rb +2 -3
- data/lib/chef-dk/service_exception_inspectors/base.rb +0 -1
- data/lib/chef-dk/service_exception_inspectors/http.rb +1 -3
- data/lib/chef-dk/service_exceptions.rb +1 -2
- data/lib/chef-dk/shell_out.rb +1 -1
- data/lib/chef-dk/skeletons/code_generator/files/default/build_cookbook/.kitchen.yml +2 -2
- data/lib/chef-dk/skeletons/code_generator/files/default/build_cookbook/README.md +2 -2
- data/lib/chef-dk/skeletons/code_generator/files/default/build_cookbook/test-fixture-recipe.rb +1 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/attributes/default.rb +1 -1
- data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/recipes/default.rb +1 -1
- data/lib/chef-dk/skeletons/code_generator/metadata.rb +0 -1
- data/lib/chef-dk/skeletons/code_generator/recipes/app.rb +6 -6
- data/lib/chef-dk/skeletons/code_generator/recipes/attribute.rb +3 -3
- data/lib/chef-dk/skeletons/code_generator/recipes/build_cookbook.rb +43 -39
- data/lib/chef-dk/skeletons/code_generator/recipes/cookbook.rb +31 -22
- data/lib/chef-dk/skeletons/code_generator/recipes/cookbook_file.rb +5 -5
- data/lib/chef-dk/skeletons/code_generator/recipes/lwrp.rb +4 -4
- data/lib/chef-dk/skeletons/code_generator/recipes/policyfile.rb +1 -1
- data/lib/chef-dk/skeletons/code_generator/recipes/recipe.rb +8 -8
- data/lib/chef-dk/skeletons/code_generator/recipes/repo.rb +15 -15
- data/lib/chef-dk/skeletons/code_generator/recipes/template.rb +6 -6
- data/lib/chef-dk/skeletons/code_generator/templates/default/build_cookbook/Berksfile.erb +0 -2
- data/lib/chef-dk/skeletons/code_generator/templates/default/build_cookbook/metadata.rb.erb +1 -0
- data/lib/chef-dk/skeletons/code_generator/templates/default/inspec_default_test.rb.erb +4 -4
- data/lib/chef-dk/skeletons/code_generator/templates/default/kitchen.yml.erb +1 -1
- 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 +4 -3
- data/lib/chef-dk/skeletons/code_generator/templates/default/recipe_spec.rb.erb +4 -2
- data/lib/chef-dk/ui.rb +0 -1
- data/lib/chef-dk/version.rb +1 -1
- data/lib/kitchen/provisioner/policyfile_zero.rb +7 -7
- data/omnibus_overrides.rb +3 -3
- data/spec/shared/a_file_generator.rb +3 -3
- data/spec/shared/custom_generator_cookbook.rb +6 -6
- data/spec/shared/fixture_cookbook_checksums.rb +2 -3
- data/spec/shared/setup_git_committer_config.rb +1 -1
- data/spec/shared/setup_git_cookbooks.rb +2 -2
- data/spec/spec_helper.rb +5 -5
- data/spec/test_helpers.rb +2 -2
- data/spec/unit/chef_runner_spec.rb +5 -7
- data/spec/unit/cli_spec.rb +36 -37
- data/spec/unit/command/base_spec.rb +4 -5
- data/spec/unit/command/clean_policy_cookbooks_spec.rb +8 -9
- data/spec/unit/command/clean_policy_revisions_spec.rb +8 -9
- data/spec/unit/command/delete_policy_group_spec.rb +11 -12
- data/spec/unit/command/delete_policy_spec.rb +11 -12
- data/spec/unit/command/diff_spec.rb +5 -6
- data/spec/unit/command/env_spec.rb +5 -5
- data/spec/unit/command/exec_spec.rb +18 -19
- data/spec/unit/command/export_spec.rb +5 -6
- data/spec/unit/command/generate_spec.rb +10 -10
- data/spec/unit/command/generator_commands/app_spec.rb +6 -6
- data/spec/unit/command/generator_commands/attribute_spec.rb +3 -4
- data/spec/unit/command/generator_commands/base_spec.rb +46 -46
- data/spec/unit/command/generator_commands/build_cookbook_spec.rb +50 -16
- data/spec/unit/command/generator_commands/chef_exts/generator_desc_resource_spec.rb +9 -9
- data/spec/unit/command/generator_commands/chef_exts/recipe_dsl_ext_spec.rb +16 -16
- data/spec/unit/command/generator_commands/cookbook_file_spec.rb +3 -4
- data/spec/unit/command/generator_commands/cookbook_spec.rb +23 -26
- data/spec/unit/command/generator_commands/generator_generator_spec.rb +4 -6
- data/spec/unit/command/generator_commands/lwrp_spec.rb +3 -4
- data/spec/unit/command/generator_commands/policyfile_spec.rb +3 -5
- data/spec/unit/command/generator_commands/recipe_spec.rb +4 -4
- data/spec/unit/command/generator_commands/repo_spec.rb +11 -11
- data/spec/unit/command/generator_commands/template_spec.rb +3 -4
- data/spec/unit/command/install_spec.rb +6 -6
- data/spec/unit/command/provision_spec.rb +27 -30
- data/spec/unit/command/push_archive_spec.rb +3 -3
- data/spec/unit/command/push_spec.rb +5 -6
- data/spec/unit/command/shell_init_spec.rb +17 -19
- data/spec/unit/command/show_policy_spec.rb +11 -12
- data/spec/unit/command/undelete_spec.rb +12 -14
- data/spec/unit/command/update_spec.rb +8 -8
- data/spec/unit/command/verify_spec.rb +10 -10
- data/spec/unit/commands_map_spec.rb +4 -4
- data/spec/unit/component_test_spec.rb +3 -3
- data/spec/unit/configurable_spec.rb +7 -7
- data/spec/unit/cookbook_metadata_spec.rb +5 -7
- data/spec/unit/cookbook_profiler/git_spec.rb +6 -7
- data/spec/unit/cookbook_profiler/identifiers_spec.rb +5 -7
- data/spec/unit/fixtures/command/cli_test_command.rb +2 -2
- data/spec/unit/fixtures/configurable/test_configurable.rb +1 -1
- data/spec/unit/fixtures/cookbooks_api/update_fixtures.rb +13 -16
- data/spec/unit/fixtures/eg_omnibus_dir/valid/embedded/apps/berkshelf/verify_me +1 -1
- data/spec/unit/gemfile_util_spec.rb +4 -4
- data/spec/unit/generator_spec.rb +10 -10
- data/spec/unit/helpers_spec.rb +31 -31
- data/spec/unit/pager_spec.rb +5 -7
- data/spec/unit/policyfile/chef_repo_cookbook_source_spec.rb +11 -11
- data/spec/unit/policyfile/chef_server_cookbook_source_spec.rb +13 -13
- data/spec/unit/policyfile/community_cookbook_source_spec.rb +3 -4
- data/spec/unit/policyfile/comparison_base_spec.rb +3 -6
- data/spec/unit/policyfile/cookbook_location_specification_spec.rb +3 -3
- data/spec/unit/policyfile/cookbook_locks_spec.rb +7 -9
- data/spec/unit/policyfile/delivery_supermarket_source_spec.rb +16 -17
- data/spec/unit/policyfile/differ_spec.rb +4 -5
- data/spec/unit/policyfile/lister_spec.rb +31 -35
- data/spec/unit/policyfile/null_cookbook_source_spec.rb +2 -3
- data/spec/unit/policyfile/read_cookbook_for_compat_mode_upload_spec.rb +3 -3
- data/spec/unit/policyfile/reports/install_spec.rb +4 -5
- data/spec/unit/policyfile/reports/upload_spec.rb +4 -6
- data/spec/unit/policyfile/solution_dependencies_spec.rb +13 -13
- data/spec/unit/policyfile/source_uri_spec.rb +5 -5
- data/spec/unit/policyfile/storage_config_spec.rb +3 -7
- data/spec/unit/policyfile/undo_record_spec.rb +21 -23
- data/spec/unit/policyfile/undo_stack_spec.rb +5 -6
- data/spec/unit/policyfile/uploader_spec.rb +73 -75
- data/spec/unit/policyfile_demands_spec.rb +93 -99
- data/spec/unit/policyfile_evaluation_spec.rb +14 -14
- data/spec/unit/policyfile_lock_build_spec.rb +64 -65
- data/spec/unit/policyfile_lock_install_spec.rb +5 -6
- data/spec/unit/policyfile_lock_serialization_spec.rb +14 -15
- data/spec/unit/policyfile_lock_validation_spec.rb +17 -20
- data/spec/unit/policyfile_services/clean_policies_spec.rb +16 -16
- data/spec/unit/policyfile_services/clean_policy_cookbooks_spec.rb +26 -29
- data/spec/unit/policyfile_services/export_repo_spec.rb +3 -6
- data/spec/unit/policyfile_services/install_spec.rb +5 -7
- data/spec/unit/policyfile_services/push_archive_spec.rb +4 -8
- data/spec/unit/policyfile_services/push_spec.rb +3 -3
- data/spec/unit/policyfile_services/rm_policy_group_spec.rb +16 -20
- data/spec/unit/policyfile_services/rm_policy_spec.rb +14 -17
- data/spec/unit/policyfile_services/show_policy_spec.rb +78 -80
- data/spec/unit/policyfile_services/undelete_spec.rb +5 -7
- data/spec/unit/policyfile_services/update_attributes_spec.rb +34 -35
- data/spec/unit/service_exception_inspectors/base_spec.rb +2 -4
- data/spec/unit/service_exception_inspectors/http_spec.rb +9 -11
- data/spec/unit/shell_out_spec.rb +2 -2
- data/spec/unit/tasks/helpers_spec.rb +2 -2
- data/tasks/bin/bundle-platform +1 -1
- data/tasks/bundle_util.rb +1 -1
- data/tasks/dependencies.rb +21 -7
- data/tasks/gemfile_util.rb +1 -1
- data/tasks/helpers.rb +2 -2
- data/tasks/version.rb +26 -1
- data/version_policy.rb +6 -6
- metadata +3 -3
@@ -15,9 +15,9 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
18
|
+
require "spec_helper"
|
19
|
+
require "chef-dk/commands_map"
|
20
|
+
require "stringio"
|
21
21
|
|
22
22
|
describe ChefDK::CommandsMap do
|
23
23
|
|
@@ -43,7 +43,7 @@ describe ChefDK::CommandsMap do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it "lists the available commands" do
|
46
|
-
expect(mapping.command_names).to match_array(%w
|
46
|
+
expect(mapping.command_names).to match_array(%w{example hypenated-example explicit-path-example documented-example})
|
47
47
|
end
|
48
48
|
|
49
49
|
it "keeps the docstring of a command" do
|
@@ -15,9 +15,9 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
18
|
+
require "spec_helper"
|
19
|
+
require "chef-dk/component_test"
|
20
|
+
require "pathname"
|
21
21
|
|
22
22
|
describe ChefDK::ComponentTest do
|
23
23
|
|
@@ -15,27 +15,27 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
18
|
+
require "spec_helper"
|
19
|
+
require "chef-dk/configurable"
|
20
|
+
require "unit/fixtures/configurable/test_configurable"
|
21
21
|
|
22
22
|
describe ChefDK::Configurable do
|
23
23
|
|
24
24
|
let(:includer) { TestConfigurable.new }
|
25
25
|
|
26
|
-
it
|
26
|
+
it "provides chef_config" do
|
27
27
|
expect(includer.chef_config).to eq Chef::Config
|
28
28
|
end
|
29
29
|
|
30
|
-
it
|
30
|
+
it "provides chefdk_config" do
|
31
31
|
expect(includer.chefdk_config).to eq Chef::Config.chefdk
|
32
32
|
end
|
33
33
|
|
34
|
-
it
|
34
|
+
it "provides knife_config" do
|
35
35
|
expect(includer.knife_config).to eq Chef::Config.knife
|
36
36
|
end
|
37
37
|
|
38
|
-
it
|
38
|
+
it "provides generator_config" do
|
39
39
|
expect(includer.generator_config).to eq Chef::Config.chefdk.generator
|
40
40
|
end
|
41
41
|
end
|
@@ -15,8 +15,8 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
18
|
+
require "spec_helper"
|
19
|
+
require "chef-dk/cookbook_metadata"
|
20
20
|
|
21
21
|
describe ChefDK::CookbookMetadata do
|
22
22
|
|
@@ -40,12 +40,11 @@ describe ChefDK::CookbookMetadata do
|
|
40
40
|
|
41
41
|
describe "when a cookbook is loaded" do
|
42
42
|
|
43
|
-
|
44
43
|
let(:cookbook) { described_class.from_path(cookbook_root) }
|
45
44
|
|
46
45
|
context "and the cookbook has only a metadata.rb" do
|
47
46
|
|
48
|
-
let(:cookbook_root) { File.join(fixtures_path,
|
47
|
+
let(:cookbook_root) { File.join(fixtures_path, "example_cookbook") }
|
49
48
|
|
50
49
|
it "has a name" do
|
51
50
|
expect(cookbook.name).to eq("example_cookbook")
|
@@ -64,7 +63,7 @@ describe ChefDK::CookbookMetadata do
|
|
64
63
|
|
65
64
|
context "and the cookbook has only a metadata.json" do
|
66
65
|
|
67
|
-
let(:cookbook_root) { File.join(fixtures_path,
|
66
|
+
let(:cookbook_root) { File.join(fixtures_path, "example_cookbook_metadata_json_only") }
|
68
67
|
|
69
68
|
it "has a name" do
|
70
69
|
expect(cookbook.name).to eq("example_cookbook")
|
@@ -83,7 +82,7 @@ describe ChefDK::CookbookMetadata do
|
|
83
82
|
|
84
83
|
context "and the cookbook has no metadata" do
|
85
84
|
|
86
|
-
let(:cookbook_root) { File.join(fixtures_path,
|
85
|
+
let(:cookbook_root) { File.join(fixtures_path, "example_cookbook_no_metadata") }
|
87
86
|
|
88
87
|
it "raises a MalformedCookbook error" do
|
89
88
|
msg = "Cookbook at #{cookbook_root} has neither metadata.json or metadata.rb"
|
@@ -95,4 +94,3 @@ describe ChefDK::CookbookMetadata do
|
|
95
94
|
|
96
95
|
end
|
97
96
|
end
|
98
|
-
|
@@ -15,11 +15,11 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
22
|
-
require
|
18
|
+
require "spec_helper"
|
19
|
+
require "shared/setup_git_cookbooks"
|
20
|
+
require "fileutils"
|
21
|
+
require "chef-dk/helpers"
|
22
|
+
require "chef-dk/cookbook_profiler/git"
|
23
23
|
|
24
24
|
describe ChefDK::CookbookProfiler::Git do
|
25
25
|
|
@@ -96,7 +96,7 @@ describe ChefDK::CookbookProfiler::Git do
|
|
96
96
|
end
|
97
97
|
|
98
98
|
it "lists the remotes that commits are published to" do
|
99
|
-
expect(git_profiler.synchronized_remotes).to eq(%w
|
99
|
+
expect(git_profiler.synchronized_remotes).to eq(%w{origin/master})
|
100
100
|
end
|
101
101
|
|
102
102
|
end
|
@@ -173,4 +173,3 @@ describe ChefDK::CookbookProfiler::Git do
|
|
173
173
|
end
|
174
174
|
|
175
175
|
end
|
176
|
-
|
@@ -15,9 +15,9 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
18
|
+
require "spec_helper"
|
19
|
+
require "chef-dk/cookbook_profiler/identifiers"
|
20
|
+
require "chef-dk/policyfile/read_cookbook_for_compat_mode_upload"
|
21
21
|
|
22
22
|
describe ChefDK::CookbookProfiler::Identifiers do
|
23
23
|
|
@@ -36,7 +36,6 @@ describe ChefDK::CookbookProfiler::Identifiers do
|
|
36
36
|
cbvl.cookbook_version
|
37
37
|
end
|
38
38
|
|
39
|
-
|
40
39
|
let(:identifiers) do
|
41
40
|
ChefDK::CookbookProfiler::Identifiers.new(cookbook_version)
|
42
41
|
end
|
@@ -48,7 +47,7 @@ describe ChefDK::CookbookProfiler::Identifiers do
|
|
48
47
|
"README.md" => "0f15038071e5a131bef176cbe2a956d1",
|
49
48
|
"chefignore" => "03485640b005eb1083c76518764053dd",
|
50
49
|
"metadata.rb" => "4879d0004b177546cfbcfb2fd26df7c8",
|
51
|
-
"recipes/default.rb" => "9a0f27d741deaca21461073f7452474f"
|
50
|
+
"recipes/default.rb" => "9a0f27d741deaca21461073f7452474f",
|
52
51
|
}
|
53
52
|
end
|
54
53
|
|
@@ -67,7 +66,7 @@ describe ChefDK::CookbookProfiler::Identifiers do
|
|
67
66
|
# Verify that the keys are sorted in our expected data, otherwise our test
|
68
67
|
# is wrong.
|
69
68
|
expect(cookbook_files_with_cksums.keys).to eq(cookbook_files_with_cksums.keys.sort)
|
70
|
-
expected = cookbook_files_with_cksums.map { |path,cksum| "#{path}:#{cksum}\n" }.join("")
|
69
|
+
expected = cookbook_files_with_cksums.map { |path, cksum| "#{path}:#{cksum}\n" }.join("")
|
71
70
|
expect(identifiers.fingerprint_text).to eq(expected)
|
72
71
|
end
|
73
72
|
|
@@ -80,4 +79,3 @@ describe ChefDK::CookbookProfiler::Identifiers do
|
|
80
79
|
end
|
81
80
|
|
82
81
|
end
|
83
|
-
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "chef-dk/command/base"
|
2
2
|
|
3
3
|
module ChefDK
|
4
4
|
module Command
|
@@ -17,7 +17,7 @@ module ChefDK
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def run(params)
|
20
|
-
self.class.test_result = {:status => :success, :params => params}
|
20
|
+
self.class.test_result = { :status => :success, :params => params }
|
21
21
|
23
|
22
22
|
end
|
23
23
|
|
@@ -1,16 +1,16 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
1
|
+
require "openssl"
|
2
|
+
require "net/https"
|
3
|
+
require "json"
|
4
|
+
require "pp"
|
5
|
+
require "uri"
|
6
6
|
|
7
7
|
THIS_DIR = File.expand_path(File.dirname(__FILE__))
|
8
8
|
|
9
|
-
UNIVERSE_JSON_PATH = File.join(THIS_DIR,
|
10
|
-
SMALL_UNIVERSE_JSON_PATH = File.join(THIS_DIR,
|
11
|
-
PRUNED_UNIVERSE_PATH = File.join(THIS_DIR,
|
9
|
+
UNIVERSE_JSON_PATH = File.join(THIS_DIR, "universe.json")
|
10
|
+
SMALL_UNIVERSE_JSON_PATH = File.join(THIS_DIR, "small_universe.json")
|
11
|
+
PRUNED_UNIVERSE_PATH = File.join(THIS_DIR, "pruned_small_universe.json")
|
12
12
|
|
13
|
-
COOKBOOKS_IN_SMALL_UNIVERSE =
|
13
|
+
COOKBOOKS_IN_SMALL_UNIVERSE = %w{apache2 application apt database mysql nginx postgresql yum}.freeze
|
14
14
|
|
15
15
|
universe = URI("https://supermarket.chef.io/universe")
|
16
16
|
|
@@ -18,7 +18,7 @@ universe_serialized = Net::HTTP.get(universe)
|
|
18
18
|
|
19
19
|
universe = JSON.parse(universe_serialized)
|
20
20
|
|
21
|
-
smaller_universe = universe.keep_if {|k,v| COOKBOOKS_IN_SMALL_UNIVERSE.include?(k) }
|
21
|
+
smaller_universe = universe.keep_if { |k, v| COOKBOOKS_IN_SMALL_UNIVERSE.include?(k) }
|
22
22
|
|
23
23
|
pruned_universe = smaller_universe.inject({}) do |pruned_graph, (cookbook_name, graph_info)|
|
24
24
|
pruned_graph[cookbook_name] = graph_info.inject({}) do |per_version_graph, (version_number, version_info)|
|
@@ -28,9 +28,6 @@ pruned_universe = smaller_universe.inject({}) do |pruned_graph, (cookbook_name,
|
|
28
28
|
pruned_graph
|
29
29
|
end
|
30
30
|
|
31
|
-
|
32
|
-
File.open(
|
33
|
-
File.open(
|
34
|
-
File.open(PRUNED_UNIVERSE_PATH, 'w+') { |f| f.print(JSON.pretty_generate(pruned_universe)) }
|
35
|
-
|
36
|
-
|
31
|
+
File.open(UNIVERSE_JSON_PATH, "w+") { |f| f.print(universe_serialized) }
|
32
|
+
File.open(SMALL_UNIVERSE_JSON_PATH, "w+") { |f| f.print(JSON.pretty_generate(smaller_universe)) }
|
33
|
+
File.open(PRUNED_UNIVERSE_PATH, "w+") { |f| f.print(JSON.pretty_generate(pruned_universe)) }
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require_relative
|
1
|
+
require "spec_helper"
|
2
|
+
require_relative "../../tasks/gemfile_util"
|
3
3
|
|
4
4
|
class GemfileSuper
|
5
5
|
def gem(*args)
|
@@ -31,11 +31,11 @@ describe GemfileUtil do
|
|
31
31
|
it "overrides gems with :override" do
|
32
32
|
expect(gemfile_util).to receive(:warn_if_replacing)
|
33
33
|
expect(gemfile_util.gem(gem_name, override: true)).to be_nil
|
34
|
-
expect(gemfile_util.overridden_gems).to eq({ gem_name => [{
|
34
|
+
expect(gemfile_util.overridden_gems).to eq({ gem_name => [{}] })
|
35
35
|
end
|
36
36
|
|
37
37
|
it "does not override gems with :overrideable" do
|
38
38
|
expect(gemfile_util.gem(gem_name, override: true)).to be_nil
|
39
39
|
end
|
40
40
|
end
|
41
|
-
end
|
41
|
+
end
|
data/spec/unit/generator_spec.rb
CHANGED
@@ -15,8 +15,8 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
18
|
+
require "spec_helper"
|
19
|
+
require "chef-dk/generator"
|
20
20
|
|
21
21
|
describe ChefDK::Generator do
|
22
22
|
|
@@ -49,17 +49,17 @@ class TmplTest
|
|
49
49
|
end
|
50
50
|
|
51
51
|
describe ChefDK::Generator::TemplateHelper do
|
52
|
-
let(:license) {
|
53
|
-
let(:copyright_holder) {
|
52
|
+
let(:license) { "all_rights" }
|
53
|
+
let(:copyright_holder) { "Adam Jacob" }
|
54
54
|
let(:helper) { TmplTest.new }
|
55
55
|
|
56
56
|
before(:each) do
|
57
57
|
ChefDK::Generator.reset
|
58
58
|
ChefDK::Generator.add_attr_to_context(:license, license)
|
59
|
-
ChefDK::Generator.add_attr_to_context(:copyright_holder,
|
59
|
+
ChefDK::Generator.add_attr_to_context(:copyright_holder, "Adam Jacob")
|
60
60
|
end
|
61
61
|
|
62
|
-
describe
|
62
|
+
describe "license_description" do
|
63
63
|
let(:license) { "all_rights" }
|
64
64
|
context "all_rights" do
|
65
65
|
it "should match the license" do
|
@@ -72,7 +72,7 @@ describe ChefDK::Generator::TemplateHelper do
|
|
72
72
|
end
|
73
73
|
|
74
74
|
context "apachev2" do
|
75
|
-
let(:license) {
|
75
|
+
let(:license) { "apachev2" }
|
76
76
|
it "should match the license" do
|
77
77
|
expect(helper.license_description).to match(/Licensed under the Apache/)
|
78
78
|
end
|
@@ -83,7 +83,7 @@ describe ChefDK::Generator::TemplateHelper do
|
|
83
83
|
end
|
84
84
|
|
85
85
|
context "mit" do
|
86
|
-
let(:license) {
|
86
|
+
let(:license) { "mit" }
|
87
87
|
it "should match the license" do
|
88
88
|
expect(helper.license_description).to match(/Permission is hereby granted/)
|
89
89
|
end
|
@@ -94,7 +94,7 @@ describe ChefDK::Generator::TemplateHelper do
|
|
94
94
|
end
|
95
95
|
|
96
96
|
context "gplv2" do
|
97
|
-
let(:license) {
|
97
|
+
let(:license) { "gplv2" }
|
98
98
|
it "should match the license" do
|
99
99
|
expect(helper.license_description).to match(/This program is free software;/)
|
100
100
|
end
|
@@ -105,7 +105,7 @@ describe ChefDK::Generator::TemplateHelper do
|
|
105
105
|
end
|
106
106
|
|
107
107
|
context "gplv3" do
|
108
|
-
let(:license) {
|
108
|
+
let(:license) { "gplv3" }
|
109
109
|
it "should match the license" do
|
110
110
|
expect(helper.license_description).to match(/This program is free software:/)
|
111
111
|
end
|
data/spec/unit/helpers_spec.rb
CHANGED
@@ -15,8 +15,8 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
18
|
+
require "spec_helper"
|
19
|
+
require "chef-dk/helpers"
|
20
20
|
|
21
21
|
describe ChefDK::Helpers do
|
22
22
|
|
@@ -35,55 +35,55 @@ describe ChefDK::Helpers do
|
|
35
35
|
allow(Chef::Platform).to receive(:windows?).and_return(false)
|
36
36
|
end
|
37
37
|
|
38
|
-
context
|
39
|
-
let(:env) { {
|
38
|
+
context "when CHEFDK_HOME is set" do
|
39
|
+
let(:env) { { "CHEFDK_HOME" => "foo" } }
|
40
40
|
it "returns CHEFDK_HOME" do
|
41
|
-
expect(helpers.chefdk_home).to eq(env[
|
41
|
+
expect(helpers.chefdk_home).to eq(env["CHEFDK_HOME"])
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
context
|
46
|
-
context
|
45
|
+
context "when CHEFDK_HOME is not set" do
|
46
|
+
context "on windows" do
|
47
47
|
before do
|
48
48
|
allow(Chef::Platform).to receive(:windows?).and_return(true)
|
49
49
|
end
|
50
50
|
|
51
|
-
let(:env) { {
|
51
|
+
let(:env) { { "LOCALAPPDATA" => 'C:\\foo' } }
|
52
52
|
|
53
|
-
it
|
54
|
-
expect(File).to receive(:join).with(env[
|
55
|
-
expect(helpers.chefdk_home).to eq(
|
53
|
+
it "uses LOCALAPPDATA" do
|
54
|
+
expect(File).to receive(:join).with(env["LOCALAPPDATA"], "chefdk").and_return("chefdkdefaulthome")
|
55
|
+
expect(helpers.chefdk_home).to eq("chefdkdefaulthome")
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
context
|
60
|
-
it
|
61
|
-
expect(File).to receive(:expand_path).with(
|
62
|
-
expect(helpers.chefdk_home).to eq(
|
59
|
+
context "on *nix" do
|
60
|
+
it "uses LOCALAPPDATA" do
|
61
|
+
expect(File).to receive(:expand_path).with("~/.chefdk").and_return("chefdkdefaulthome")
|
62
|
+
expect(helpers.chefdk_home).to eq("chefdkdefaulthome")
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
context
|
67
|
+
context "using usr_bin_prefix" do
|
68
68
|
before do
|
69
|
-
stub_const(
|
69
|
+
stub_const("RUBY_PLATFORM", ruby_platform_string)
|
70
70
|
end
|
71
71
|
|
72
|
-
context
|
73
|
-
let(:ruby_platform_string) {
|
72
|
+
context "on Mac" do
|
73
|
+
let(:ruby_platform_string) { "x86_64-darwin12.0" }
|
74
74
|
|
75
|
-
it
|
76
|
-
expect(helpers.usr_bin_prefix).to eq(
|
77
|
-
expect(helpers.usr_bin_path(
|
75
|
+
it "uses /usr/local/bin" do
|
76
|
+
expect(helpers.usr_bin_prefix).to eq("/usr/local/bin")
|
77
|
+
expect(helpers.usr_bin_path("berks")).to eq("/usr/local/bin/berks")
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
context
|
82
|
-
let(:ruby_platform_string) {
|
81
|
+
context "on other systems" do
|
82
|
+
let(:ruby_platform_string) { "x86_64-linux" }
|
83
83
|
|
84
|
-
it
|
85
|
-
expect(helpers.usr_bin_prefix).to eq(
|
86
|
-
expect(helpers.usr_bin_path(
|
84
|
+
it "uses /usr/bin" do
|
85
|
+
expect(helpers.usr_bin_prefix).to eq("/usr/bin")
|
86
|
+
expect(helpers.usr_bin_path("berks")).to eq("/usr/bin/berks")
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
@@ -94,26 +94,26 @@ describe ChefDK::Helpers do
|
|
94
94
|
let(:git_tools_path) { File.join("embedded", "git", "usr", "bin") }
|
95
95
|
let(:custom_gitbin_path) { File.join("gitbin") }
|
96
96
|
before do
|
97
|
-
allow(helpers).to receive(:omnibus_expand_path) {|*paths| File.expand_path(File.join(paths)) }
|
97
|
+
allow(helpers).to receive(:omnibus_expand_path) { |*paths| File.expand_path(File.join(paths)) }
|
98
98
|
allow(Dir).to receive(:exists?).with(/#{custom_gitbin_path}/).and_return false
|
99
99
|
allow(Dir).to receive(:exists?).with(/#{git_tools_path}/).and_return false
|
100
100
|
end
|
101
101
|
|
102
102
|
it "does not include the git tools in the path" do
|
103
|
-
expect(helpers.omnibus_env[
|
103
|
+
expect(helpers.omnibus_env["PATH"]).to_not match(/#{git_tools_path}/)
|
104
104
|
end
|
105
105
|
|
106
106
|
context "when the custom gitbin directory exists" do
|
107
107
|
it "includes them in the path" do
|
108
108
|
expect(Dir).to receive(:exists?).with(/#{custom_gitbin_path}/).and_return true
|
109
|
-
expect(helpers.omnibus_env[
|
109
|
+
expect(helpers.omnibus_env["PATH"]).to match(/#{custom_gitbin_path}$/)
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
113
|
context "when the git tools directory exists" do
|
114
114
|
it "includes them in the path" do
|
115
115
|
expect(Dir).to receive(:exists?).with(/#{git_tools_path}/).and_return true
|
116
|
-
expect(helpers.omnibus_env[
|
116
|
+
expect(helpers.omnibus_env["PATH"]).to match(/#{git_tools_path}$/)
|
117
117
|
end
|
118
118
|
end
|
119
119
|
end
|