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
data/lib/chef-dk/command/base.rb
CHANGED
@@ -15,10 +15,10 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
18
|
+
require "mixlib/cli"
|
19
|
+
require "chef-dk/helpers"
|
20
|
+
require "chef-dk/version"
|
21
|
+
require "chef/exceptions"
|
22
22
|
|
23
23
|
module ChefDK
|
24
24
|
module Command
|
@@ -15,15 +15,14 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
18
|
+
require "chef-dk/command/base"
|
19
|
+
require "chef-dk/ui"
|
20
|
+
require "chef-dk/configurable"
|
21
|
+
require "chef-dk/policyfile_services/clean_policy_cookbooks"
|
22
22
|
|
23
23
|
module ChefDK
|
24
24
|
module Command
|
25
25
|
|
26
|
-
|
27
26
|
class CleanPolicyCookbooks < Base
|
28
27
|
|
29
28
|
banner(<<-BANNER)
|
@@ -15,15 +15,14 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
18
|
+
require "chef-dk/command/base"
|
19
|
+
require "chef-dk/ui"
|
20
|
+
require "chef-dk/configurable"
|
21
|
+
require "chef-dk/policyfile_services/clean_policies"
|
22
22
|
|
23
23
|
module ChefDK
|
24
24
|
module Command
|
25
25
|
|
26
|
-
|
27
26
|
class CleanPolicyRevisions < Base
|
28
27
|
|
29
28
|
banner(<<-BANNER)
|
@@ -110,4 +109,3 @@ BANNER
|
|
110
109
|
end
|
111
110
|
end
|
112
111
|
end
|
113
|
-
|
@@ -15,15 +15,14 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
18
|
+
require "chef-dk/command/base"
|
19
|
+
require "chef-dk/ui"
|
20
|
+
require "chef-dk/configurable"
|
21
|
+
require "chef-dk/policyfile_services/rm_policy"
|
22
22
|
|
23
23
|
module ChefDK
|
24
24
|
module Command
|
25
25
|
|
26
|
-
|
27
26
|
class DeletePolicy < Base
|
28
27
|
|
29
28
|
banner(<<-BANNER)
|
@@ -119,4 +118,3 @@ BANNER
|
|
119
118
|
end
|
120
119
|
end
|
121
120
|
end
|
122
|
-
|
@@ -15,15 +15,14 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
18
|
+
require "chef-dk/command/base"
|
19
|
+
require "chef-dk/ui"
|
20
|
+
require "chef-dk/configurable"
|
21
|
+
require "chef-dk/policyfile_services/rm_policy_group"
|
22
22
|
|
23
23
|
module ChefDK
|
24
24
|
module Command
|
25
25
|
|
26
|
-
|
27
26
|
class DeletePolicyGroup < Base
|
28
27
|
|
29
28
|
banner(<<-BANNER)
|
@@ -79,8 +78,8 @@ BANNER
|
|
79
78
|
def rm_policy_group_service
|
80
79
|
@rm_policy_group_service ||=
|
81
80
|
PolicyfileServices::RmPolicyGroup.new(config: chef_config,
|
82
|
-
|
83
|
-
|
81
|
+
ui: ui,
|
82
|
+
policy_group: policy_group)
|
84
83
|
end
|
85
84
|
|
86
85
|
def debug?
|
@@ -119,4 +118,3 @@ BANNER
|
|
119
118
|
end
|
120
119
|
end
|
121
120
|
end
|
122
|
-
|
data/lib/chef-dk/command/diff.rb
CHANGED
@@ -15,14 +15,14 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
22
|
-
require
|
23
|
-
require
|
24
|
-
require
|
25
|
-
require
|
18
|
+
require "chef-dk/command/base"
|
19
|
+
require "chef-dk/ui"
|
20
|
+
require "chef-dk/pager"
|
21
|
+
require "chef-dk/policyfile/differ"
|
22
|
+
require "chef-dk/policyfile/comparison_base"
|
23
|
+
require "chef-dk/policyfile/storage_config"
|
24
|
+
require "chef-dk/configurable"
|
25
|
+
require "chef-dk/authenticated_http"
|
26
26
|
|
27
27
|
module ChefDK
|
28
28
|
module Command
|
@@ -152,7 +152,7 @@ BANNER
|
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
|
-
def differ(ui = ui())
|
155
|
+
def differ(ui = self.ui())
|
156
156
|
Policyfile::Differ.new(old_name: old_base.name,
|
157
157
|
old_lock: old_lock,
|
158
158
|
new_name: new_base.name,
|
@@ -313,4 +313,3 @@ BANNER
|
|
313
313
|
|
314
314
|
end
|
315
315
|
end
|
316
|
-
|
data/lib/chef-dk/command/env.rb
CHANGED
@@ -15,12 +15,12 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
22
|
-
require
|
23
|
-
require
|
18
|
+
require "chef-dk/command/base"
|
19
|
+
require "chef-dk/cookbook_omnifetch"
|
20
|
+
require "chef-dk/ui"
|
21
|
+
require "chef-dk/version"
|
22
|
+
require "mixlib/shellout"
|
23
|
+
require "yaml"
|
24
24
|
|
25
25
|
module ChefDK
|
26
26
|
module Command
|
@@ -36,55 +36,54 @@ module ChefDK
|
|
36
36
|
|
37
37
|
def run(params)
|
38
38
|
info = {}
|
39
|
-
info[
|
40
|
-
chefdk_env[
|
41
|
-
chefdk_env[
|
42
|
-
chefdk_env[
|
39
|
+
info["Chef Development Kit"] = Hash.new.tap do |chefdk_env|
|
40
|
+
chefdk_env["ChefDK"] = chefdk_info
|
41
|
+
chefdk_env["Ruby"] = ruby_info
|
42
|
+
chefdk_env["Path"] = paths
|
43
43
|
end
|
44
44
|
ui.msg info.to_yaml
|
45
45
|
end
|
46
46
|
|
47
47
|
def chefdk_info
|
48
48
|
Hash.new.tap do |chefdk|
|
49
|
-
chefdk[
|
50
|
-
chefdk[
|
51
|
-
chefdk[
|
52
|
-
chefdk[
|
49
|
+
chefdk["ChefDK Version"] = ChefDK::VERSION
|
50
|
+
chefdk["ChefDK Home"] = chefdk_home
|
51
|
+
chefdk["ChefDK Install Directory"] = omnibus_root
|
52
|
+
chefdk["Policyfile Config"] = policyfile_config
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
56
|
def ruby_info
|
57
57
|
Hash.new.tap do |ruby|
|
58
|
-
ruby[
|
59
|
-
ruby[
|
60
|
-
ruby[
|
61
|
-
rubygems[
|
62
|
-
rubygems[
|
63
|
-
rubygems[
|
58
|
+
ruby["Ruby Executable"] = Gem.ruby
|
59
|
+
ruby["Ruby Version"] = RUBY_VERSION
|
60
|
+
ruby["RubyGems"] = Hash.new.tap do |rubygems|
|
61
|
+
rubygems["RubyGems Version"] = Gem::VERSION
|
62
|
+
rubygems["RubyGems Platforms"] = Gem.platforms.map(&:to_s)
|
63
|
+
rubygems["Gem Environment"] = gem_environment
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
68
|
def gem_environment
|
69
69
|
Hash.new.tap do |h|
|
70
|
-
h[
|
71
|
-
h[
|
72
|
-
h[
|
70
|
+
h["GEM ROOT"] = omnibus_env["GEM_ROOT"]
|
71
|
+
h["GEM HOME"] = omnibus_env["GEM_HOME"]
|
72
|
+
h["GEM PATHS"] = omnibus_env["GEM_PATH"].split(File::PATH_SEPARATOR)
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
76
|
def paths
|
77
|
-
omnibus_env[
|
77
|
+
omnibus_env["PATH"].split(File::PATH_SEPARATOR)
|
78
78
|
end
|
79
79
|
|
80
80
|
def policyfile_config
|
81
81
|
Hash.new.tap do |h|
|
82
|
-
h[
|
83
|
-
h[
|
82
|
+
h["Cache Path"] = CookbookOmnifetch.cache_path
|
83
|
+
h["Storage Path"] = CookbookOmnifetch.storage_path.to_s
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
90
|
-
|
data/lib/chef-dk/command/exec.rb
CHANGED
@@ -15,8 +15,8 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
18
|
+
require "chef-dk/command/base"
|
19
|
+
require "mixlib/shellout"
|
20
20
|
|
21
21
|
module ChefDK
|
22
22
|
module Command
|
@@ -26,9 +26,9 @@ module ChefDK
|
|
26
26
|
def run(params)
|
27
27
|
# Set ENV directly on the "parent" process (us) before running #exec to
|
28
28
|
# ensure the custom PATH is honored when finding the command to exec
|
29
|
-
omnibus_env.each {|var, value| ENV[var] = value }
|
29
|
+
omnibus_env.each { |var, value| ENV[var] = value }
|
30
30
|
exec(*params)
|
31
|
-
raise "Exec failed without an exception, your ruby is buggy"
|
31
|
+
raise "Exec failed without an exception, your ruby is buggy" # should never get here
|
32
32
|
end
|
33
33
|
|
34
34
|
def needs_version?(params)
|
@@ -37,9 +37,8 @@ module ChefDK
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def needs_help?(params)
|
40
|
-
[
|
40
|
+
["-h", "--help"].include? params[0]
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
45
|
-
|
@@ -15,10 +15,10 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
18
|
+
require "chef-dk/command/base"
|
19
|
+
require "chef-dk/ui"
|
20
|
+
require "chef-dk/policyfile_services/export_repo"
|
21
|
+
require "chef-dk/configurable"
|
22
22
|
|
23
23
|
module ChefDK
|
24
24
|
module Command
|
@@ -119,10 +119,10 @@ E
|
|
119
119
|
|
120
120
|
def export_service
|
121
121
|
@export_service ||= PolicyfileServices::ExportRepo.new(policyfile: policyfile_relative_path,
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
122
|
+
export_dir: export_dir,
|
123
|
+
root_dir: Dir.pwd,
|
124
|
+
archive: archive?,
|
125
|
+
force: config[:force])
|
126
126
|
end
|
127
127
|
|
128
128
|
def handle_error(error)
|
@@ -153,5 +153,3 @@ E
|
|
153
153
|
end
|
154
154
|
end
|
155
155
|
end
|
156
|
-
|
157
|
-
|
data/lib/chef-dk/command/gem.rb
CHANGED
@@ -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 "chef-dk/command/base"
|
19
|
+
require "rubygems"
|
20
|
+
require "rubygems/gem_runner"
|
21
|
+
require "rubygems/exceptions"
|
22
|
+
require "pp"
|
23
23
|
|
24
24
|
module ChefDK
|
25
25
|
module Command
|
@@ -15,21 +15,21 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
22
|
-
require
|
23
|
-
require
|
24
|
-
require
|
25
|
-
require
|
26
|
-
require
|
27
|
-
require
|
28
|
-
require
|
29
|
-
require
|
30
|
-
require
|
31
|
-
require
|
32
|
-
require
|
18
|
+
require "chef-dk/command/base"
|
19
|
+
require "chef-dk/command/generator_commands"
|
20
|
+
require "chef-dk/command/generator_commands/base"
|
21
|
+
require "chef-dk/command/generator_commands/cookbook_code_file"
|
22
|
+
require "chef-dk/command/generator_commands/cookbook"
|
23
|
+
require "chef-dk/command/generator_commands/app"
|
24
|
+
require "chef-dk/command/generator_commands/attribute"
|
25
|
+
require "chef-dk/command/generator_commands/cookbook_file"
|
26
|
+
require "chef-dk/command/generator_commands/lwrp"
|
27
|
+
require "chef-dk/command/generator_commands/recipe"
|
28
|
+
require "chef-dk/command/generator_commands/template"
|
29
|
+
require "chef-dk/command/generator_commands/repo"
|
30
|
+
require "chef-dk/command/generator_commands/policyfile"
|
31
|
+
require "chef-dk/command/generator_commands/generator_generator"
|
32
|
+
require "chef-dk/command/generator_commands/build_cookbook"
|
33
33
|
|
34
34
|
module ChefDK
|
35
35
|
module Command
|
@@ -66,8 +66,8 @@ E
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def self.generator_list
|
69
|
-
justify_size = generators.map {|g| g.name.size }.max + 2
|
70
|
-
generators.map {|g| " #{g.name.to_s.ljust(justify_size)}#{g.description}"}.join("\n")
|
69
|
+
justify_size = generators.map { |g| g.name.size }.max + 2
|
70
|
+
generators.map { |g| " #{g.name.to_s.ljust(justify_size)}#{g.description}" }.join("\n")
|
71
71
|
end
|
72
72
|
|
73
73
|
def self.banner
|
@@ -101,7 +101,7 @@ E
|
|
101
101
|
end
|
102
102
|
|
103
103
|
def generator_for(arg)
|
104
|
-
self.class.generators.find {|g| g.name.to_s == arg}
|
104
|
+
self.class.generators.find { |g| g.name.to_s == arg }
|
105
105
|
end
|
106
106
|
|
107
107
|
# In the Base class, this is defined to be true if any args match "-h" or
|
@@ -114,7 +114,7 @@ E
|
|
114
114
|
end
|
115
115
|
|
116
116
|
def have_generator?(name)
|
117
|
-
self.class.generators.map {|g| g.name.to_s}.include?(name)
|
117
|
+
self.class.generators.map { |g| g.name.to_s }.include?(name)
|
118
118
|
end
|
119
119
|
|
120
120
|
end
|
@@ -15,12 +15,12 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
22
|
-
require
|
23
|
-
require
|
18
|
+
require "mixlib/cli"
|
19
|
+
require "rbconfig"
|
20
|
+
require "pathname"
|
21
|
+
require "chef-dk/command/base"
|
22
|
+
require "chef-dk/chef_runner"
|
23
|
+
require "chef-dk/generator"
|
24
24
|
|
25
25
|
module ChefDK
|
26
26
|
module Command
|
@@ -38,7 +38,7 @@ module ChefDK
|
|
38
38
|
:long => "--license LICENSE",
|
39
39
|
:description => "all_rights, apachev2, mit, gplv2, gplv3 - defaults to all_rights",
|
40
40
|
:proc => Proc.new { |l|
|
41
|
-
l
|
41
|
+
l =~ /apache2/ ? "apachev2" : l
|
42
42
|
},
|
43
43
|
:default => nil
|
44
44
|
|
@@ -68,7 +68,7 @@ module ChefDK
|
|
68
68
|
:long => "--generator-arg KEY=VALUE",
|
69
69
|
:description => "Use to set arbitrary attribute KEY to VALUE in the code_generator cookbook",
|
70
70
|
:default => [],
|
71
|
-
:proc => Proc.new { |s| generator_args <<
|
71
|
+
:proc => Proc.new { |s| generator_args << s.split("=").map(&:strip) }
|
72
72
|
end
|
73
73
|
|
74
74
|
# ## GeneratorCommands
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
18
|
+
require "chef-dk/command/generator_commands/base"
|
19
19
|
|
20
20
|
module ChefDK
|
21
21
|
module Command
|
@@ -80,7 +80,7 @@ module ChefDK
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def cookbook_root
|
83
|
-
File.join(app_full_path,
|
83
|
+
File.join(app_full_path, "cookbooks")
|
84
84
|
end
|
85
85
|
|
86
86
|
def cookbook_name
|
@@ -104,4 +104,3 @@ module ChefDK
|
|
104
104
|
end
|
105
105
|
end
|
106
106
|
end
|
107
|
-
|