chef-dk 3.3.23 → 3.4.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +7 -7
- data/Gemfile.lock +91 -82
- data/lib/chef-dk/cli.rb +13 -13
- data/lib/chef-dk/command/base.rb +8 -8
- data/lib/chef-dk/command/clean_policy_cookbooks.rb +10 -10
- data/lib/chef-dk/command/clean_policy_revisions.rb +9 -9
- data/lib/chef-dk/command/delete_policy.rb +9 -9
- data/lib/chef-dk/command/delete_policy_group.rb +9 -9
- data/lib/chef-dk/command/diff.rb +35 -35
- data/lib/chef-dk/command/export.rb +11 -11
- data/lib/chef-dk/command/generate.rb +3 -3
- data/lib/chef-dk/command/generator_commands.rb +24 -24
- data/lib/chef-dk/command/generator_commands/build_cookbook.rb +3 -3
- data/lib/chef-dk/command/generator_commands/chef_exts/generator_desc_resource.rb +1 -1
- data/lib/chef-dk/command/generator_commands/cookbook.rb +3 -3
- data/lib/chef-dk/command/generator_commands/cookbook_file.rb +3 -3
- data/lib/chef-dk/command/generator_commands/generator_generator.rb +5 -5
- data/lib/chef-dk/command/generator_commands/template.rb +3 -3
- data/lib/chef-dk/command/install.rb +11 -11
- data/lib/chef-dk/command/provision.rb +32 -32
- data/lib/chef-dk/command/push.rb +9 -9
- data/lib/chef-dk/command/push_archive.rb +9 -9
- data/lib/chef-dk/command/shell_init.rb +21 -21
- data/lib/chef-dk/command/show_policy.rb +11 -11
- data/lib/chef-dk/command/undelete.rb +17 -17
- data/lib/chef-dk/command/update.rb +12 -12
- data/lib/chef-dk/command/verify.rb +63 -63
- data/lib/chef-dk/component_test.rb +3 -3
- data/lib/chef-dk/exceptions.rb +5 -5
- data/lib/chef-dk/generator.rb +61 -61
- data/lib/chef-dk/helpers.rb +1 -1
- data/lib/chef-dk/policyfile/cookbook_location_specification.rb +1 -1
- data/lib/chef-dk/policyfile/cookbook_locks.rb +1 -1
- data/lib/chef-dk/policyfile/git_lock_fetcher.rb +7 -7
- data/lib/chef-dk/policyfile/policyfile_location_specification.rb +1 -1
- data/lib/chef-dk/policyfile/uploader.rb +4 -4
- data/lib/chef-dk/policyfile_compiler.rb +1 -1
- data/lib/chef-dk/policyfile_services/export_repo.rb +49 -49
- data/lib/chef-dk/policyfile_services/install.rb +3 -3
- data/lib/chef-dk/policyfile_services/push_archive.rb +5 -5
- data/lib/chef-dk/policyfile_services/rm_policy_group.rb +1 -1
- data/lib/chef-dk/policyfile_services/update_attributes.rb +2 -2
- data/lib/chef-dk/service_exception_inspectors/http.rb +9 -9
- data/lib/chef-dk/skeletons/code_generator/recipes/recipe.rb +6 -6
- data/lib/chef-dk/version.rb +1 -1
- data/lib/kitchen/provisioner/policyfile_zero.rb +9 -9
- data/omnibus_overrides.rb +1 -1
- data/spec/spec_helper.rb +3 -3
- data/spec/unit/cli_spec.rb +9 -9
- data/spec/unit/command/base_spec.rb +25 -25
- data/spec/unit/command/clean_policy_cookbooks_spec.rb +6 -6
- data/spec/unit/command/clean_policy_revisions_spec.rb +6 -6
- data/spec/unit/command/delete_policy_group_spec.rb +6 -6
- data/spec/unit/command/delete_policy_spec.rb +6 -6
- data/spec/unit/command/export_spec.rb +10 -10
- data/spec/unit/command/generate_spec.rb +5 -5
- data/spec/unit/command/generator_commands/build_cookbook_spec.rb +15 -15
- data/spec/unit/command/generator_commands/cookbook_spec.rb +174 -174
- data/spec/unit/command/generator_commands/generator_generator_spec.rb +5 -5
- data/spec/unit/command/generator_commands/policyfile_spec.rb +15 -15
- data/spec/unit/command/generator_commands/repo_spec.rb +16 -16
- data/spec/unit/command/install_spec.rb +15 -15
- data/spec/unit/command/provision_spec.rb +25 -25
- data/spec/unit/command/push_spec.rb +12 -12
- data/spec/unit/command/shell_init_spec.rb +59 -59
- data/spec/unit/command/show_policy_spec.rb +6 -6
- data/spec/unit/command/undelete_spec.rb +6 -6
- data/spec/unit/command/update_spec.rb +30 -30
- data/spec/unit/fixtures/command/cli_test_command.rb +1 -1
- data/spec/unit/policyfile/chef_server_lock_fetcher_spec.rb +41 -41
- data/spec/unit/policyfile/comparison_base_spec.rb +38 -38
- data/spec/unit/policyfile/cookbook_locks_spec.rb +3 -3
- data/spec/unit/policyfile/differ_spec.rb +361 -361
- data/spec/unit/policyfile/git_lock_fetcher_spec.rb +34 -34
- data/spec/unit/policyfile/included_policies_cookbook_source_spec.rb +6 -6
- data/spec/unit/policyfile/local_lock_fetcher_spec.rb +35 -35
- data/spec/unit/policyfile/lock_applier_spec.rb +6 -6
- data/spec/unit/policyfile/reports/upload_spec.rb +5 -5
- data/spec/unit/policyfile/uploader_spec.rb +27 -27
- data/spec/unit/policyfile_demands_spec.rb +84 -84
- data/spec/unit/policyfile_evaluation_spec.rb +14 -14
- data/spec/unit/policyfile_includes_spec.rb +1 -1
- data/spec/unit/policyfile_install_with_includes_spec.rb +3 -3
- data/spec/unit/policyfile_lock_build_spec.rb +58 -58
- data/spec/unit/policyfile_lock_validation_spec.rb +108 -108
- data/spec/unit/policyfile_services/clean_policies_spec.rb +12 -12
- data/spec/unit/policyfile_services/clean_policy_cookbooks_spec.rb +9 -9
- data/spec/unit/policyfile_services/export_repo_spec.rb +64 -64
- data/spec/unit/policyfile_services/install_spec.rb +4 -4
- data/spec/unit/policyfile_services/push_archive_spec.rb +41 -41
- data/spec/unit/policyfile_services/push_spec.rb +38 -38
- data/spec/unit/policyfile_services/rm_policy_group_spec.rb +12 -12
- data/spec/unit/policyfile_services/rm_policy_spec.rb +6 -6
- data/spec/unit/policyfile_services/show_policy_spec.rb +161 -161
- data/spec/unit/policyfile_services/undelete_spec.rb +13 -13
- data/spec/unit/policyfile_services/update_attributes_spec.rb +6 -6
- data/spec/unit/policyfile_services/update_spec.rb +7 -7
- data/spec/unit/service_exception_inspectors/http_spec.rb +12 -12
- metadata +2 -2
data/lib/chef-dk/cli.rb
CHANGED
|
@@ -31,24 +31,24 @@ module ChefDK
|
|
|
31
31
|
include ChefDK::Helpers
|
|
32
32
|
include Chef::Mixin::ShellOut
|
|
33
33
|
|
|
34
|
-
banner(
|
|
35
|
-
Usage:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
banner(<<~BANNER)
|
|
35
|
+
Usage:
|
|
36
|
+
chef -h/--help
|
|
37
|
+
chef -v/--version
|
|
38
|
+
chef command [arguments...] [options...]
|
|
39
39
|
BANNER
|
|
40
40
|
|
|
41
41
|
option :version,
|
|
42
|
-
:
|
|
43
|
-
:
|
|
44
|
-
:
|
|
45
|
-
:
|
|
42
|
+
short: "-v",
|
|
43
|
+
long: "--version",
|
|
44
|
+
description: "Show chef version",
|
|
45
|
+
boolean: true
|
|
46
46
|
|
|
47
47
|
option :help,
|
|
48
|
-
:
|
|
49
|
-
:
|
|
50
|
-
:
|
|
51
|
-
:
|
|
48
|
+
short: "-h",
|
|
49
|
+
long: "--help",
|
|
50
|
+
description: "Show this message",
|
|
51
|
+
boolean: true
|
|
52
52
|
|
|
53
53
|
attr_reader :argv
|
|
54
54
|
|
data/lib/chef-dk/command/base.rb
CHANGED
|
@@ -27,16 +27,16 @@ module ChefDK
|
|
|
27
27
|
include ChefDK::Helpers
|
|
28
28
|
|
|
29
29
|
option :help,
|
|
30
|
-
:
|
|
31
|
-
:
|
|
32
|
-
:
|
|
33
|
-
:
|
|
30
|
+
short: "-h",
|
|
31
|
+
long: "--help",
|
|
32
|
+
description: "Show this message",
|
|
33
|
+
boolean: true
|
|
34
34
|
|
|
35
35
|
option :version,
|
|
36
|
-
:
|
|
37
|
-
:
|
|
38
|
-
:
|
|
39
|
-
:
|
|
36
|
+
short: "-v",
|
|
37
|
+
long: "--version",
|
|
38
|
+
description: "Show chef version",
|
|
39
|
+
boolean: true
|
|
40
40
|
|
|
41
41
|
def initialize
|
|
42
42
|
super
|
|
@@ -25,20 +25,20 @@ module ChefDK
|
|
|
25
25
|
|
|
26
26
|
class CleanPolicyCookbooks < Base
|
|
27
27
|
|
|
28
|
-
banner(
|
|
29
|
-
Usage: chef clean-policy-cookbooks [options]
|
|
28
|
+
banner(<<~BANNER)
|
|
29
|
+
Usage: chef clean-policy-cookbooks [options]
|
|
30
30
|
|
|
31
|
-
`chef clean-policy-cookbooks` deletes unused policyfile cookbooks. Cookbooks
|
|
32
|
-
are considered unused when they are not referenced by any policyfile revision
|
|
33
|
-
on the server. Note that cookbooks which are referenced by "orphaned" policy
|
|
34
|
-
revisions are not removed, so you may wish to run `chef clean-policy-revisions`
|
|
35
|
-
to remove orphaned policies before running this command.
|
|
31
|
+
`chef clean-policy-cookbooks` deletes unused policyfile cookbooks. Cookbooks
|
|
32
|
+
are considered unused when they are not referenced by any policyfile revision
|
|
33
|
+
on the server. Note that cookbooks which are referenced by "orphaned" policy
|
|
34
|
+
revisions are not removed, so you may wish to run `chef clean-policy-revisions`
|
|
35
|
+
to remove orphaned policies before running this command.
|
|
36
36
|
|
|
37
|
-
See our detailed README for more information:
|
|
37
|
+
See our detailed README for more information:
|
|
38
38
|
|
|
39
|
-
https://docs.chef.io/policyfile.html
|
|
39
|
+
https://docs.chef.io/policyfile.html
|
|
40
40
|
|
|
41
|
-
Options:
|
|
41
|
+
Options:
|
|
42
42
|
|
|
43
43
|
BANNER
|
|
44
44
|
|
|
@@ -25,19 +25,19 @@ module ChefDK
|
|
|
25
25
|
|
|
26
26
|
class CleanPolicyRevisions < Base
|
|
27
27
|
|
|
28
|
-
banner(
|
|
29
|
-
Usage: chef clean-policy-revisions [options]
|
|
28
|
+
banner(<<~BANNER)
|
|
29
|
+
Usage: chef clean-policy-revisions [options]
|
|
30
30
|
|
|
31
|
-
`chef clean-policy-revisions` deletes orphaned policyfile revisions from the Chef
|
|
32
|
-
Server. Orphaned policyfile revisions are not associated to any group, and
|
|
33
|
-
therefore not in active use by any nodes. To list orphaned policyfile revisions
|
|
34
|
-
before deleting them, use `chef show-policy --orphans`.
|
|
31
|
+
`chef clean-policy-revisions` deletes orphaned policyfile revisions from the Chef
|
|
32
|
+
Server. Orphaned policyfile revisions are not associated to any group, and
|
|
33
|
+
therefore not in active use by any nodes. To list orphaned policyfile revisions
|
|
34
|
+
before deleting them, use `chef show-policy --orphans`.
|
|
35
35
|
|
|
36
|
-
See our detailed README for more information:
|
|
36
|
+
See our detailed README for more information:
|
|
37
37
|
|
|
38
|
-
https://docs.chef.io/policyfile.html
|
|
38
|
+
https://docs.chef.io/policyfile.html
|
|
39
39
|
|
|
40
|
-
Options:
|
|
40
|
+
Options:
|
|
41
41
|
|
|
42
42
|
BANNER
|
|
43
43
|
|
|
@@ -25,19 +25,19 @@ module ChefDK
|
|
|
25
25
|
|
|
26
26
|
class DeletePolicy < Base
|
|
27
27
|
|
|
28
|
-
banner(
|
|
29
|
-
Usage: chef delete-policy POLICY_NAME [options]
|
|
28
|
+
banner(<<~BANNER)
|
|
29
|
+
Usage: chef delete-policy POLICY_NAME [options]
|
|
30
30
|
|
|
31
|
-
`chef delete-policy POLICY_NAME` deletes all revisions of the policy
|
|
32
|
-
`POLICY_NAME` on the configured Chef Server. All policy revisions will be
|
|
33
|
-
backed up locally, allowing you to undo this operation via the `chef undelete`
|
|
34
|
-
command.
|
|
31
|
+
`chef delete-policy POLICY_NAME` deletes all revisions of the policy
|
|
32
|
+
`POLICY_NAME` on the configured Chef Server. All policy revisions will be
|
|
33
|
+
backed up locally, allowing you to undo this operation via the `chef undelete`
|
|
34
|
+
command.
|
|
35
35
|
|
|
36
|
-
See our detailed README for more information:
|
|
36
|
+
See our detailed README for more information:
|
|
37
37
|
|
|
38
|
-
https://docs.chef.io/policyfile.html
|
|
38
|
+
https://docs.chef.io/policyfile.html
|
|
39
39
|
|
|
40
|
-
Options:
|
|
40
|
+
Options:
|
|
41
41
|
|
|
42
42
|
BANNER
|
|
43
43
|
|
|
@@ -25,19 +25,19 @@ module ChefDK
|
|
|
25
25
|
|
|
26
26
|
class DeletePolicyGroup < Base
|
|
27
27
|
|
|
28
|
-
banner(
|
|
29
|
-
Usage: chef delete-policy-group POLICY_GROUP [options]
|
|
28
|
+
banner(<<~BANNER)
|
|
29
|
+
Usage: chef delete-policy-group POLICY_GROUP [options]
|
|
30
30
|
|
|
31
|
-
`chef delete-policy-group POLICY_GROUP` deletes the policy group POLICY_GROUP on
|
|
32
|
-
the configured Chef Server. Policy Revisions associated to the policy group are
|
|
33
|
-
not deleted. The state of the policy group will be backed up locally, allowing
|
|
34
|
-
you to undo this operation via the `chef undelete` command.
|
|
31
|
+
`chef delete-policy-group POLICY_GROUP` deletes the policy group POLICY_GROUP on
|
|
32
|
+
the configured Chef Server. Policy Revisions associated to the policy group are
|
|
33
|
+
not deleted. The state of the policy group will be backed up locally, allowing
|
|
34
|
+
you to undo this operation via the `chef undelete` command.
|
|
35
35
|
|
|
36
|
-
See our detailed README for more information:
|
|
36
|
+
See our detailed README for more information:
|
|
37
37
|
|
|
38
|
-
https://docs.chef.io/policyfile.html
|
|
38
|
+
https://docs.chef.io/policyfile.html
|
|
39
39
|
|
|
40
|
-
Options:
|
|
40
|
+
Options:
|
|
41
41
|
|
|
42
42
|
BANNER
|
|
43
43
|
|
data/lib/chef-dk/command/diff.rb
CHANGED
|
@@ -32,41 +32,41 @@ module ChefDK
|
|
|
32
32
|
include Configurable
|
|
33
33
|
include Policyfile::StorageConfigDelegation
|
|
34
34
|
|
|
35
|
-
banner(
|
|
36
|
-
Usage: chef diff [POLICYFILE] [--head | --git GIT_REF | POLICY_GROUP | POLICY_GROUP...POLICY_GROUP ]
|
|
37
|
-
|
|
38
|
-
`chef diff` displays an itemized diff comparing two revisions of a
|
|
39
|
-
Policyfile lock.
|
|
40
|
-
|
|
41
|
-
When the `--git` option is given, `chef diff` either compares a given
|
|
42
|
-
git reference against the current lockfile revision on disk or compares
|
|
43
|
-
between two git references. Examples:
|
|
44
|
-
|
|
45
|
-
* `chef diff --git HEAD`: compares the current lock with the latest
|
|
46
|
-
|
|
47
|
-
* `chef diff --git master` compares the current lock with the latest
|
|
48
|
-
|
|
49
|
-
* `chef diff --git v1.0.0`: compares the current lock with the revision
|
|
50
|
-
|
|
51
|
-
* `chef diff --git master...dev-branch` compares the Policyfile lock on
|
|
52
|
-
|
|
53
|
-
* `chef diff --git v1.0.0...master` compares the Policyfile lock at the
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
`chef diff --head` is a shortcut for `chef diff --git HEAD`.
|
|
57
|
-
|
|
58
|
-
When no git-specific flag is given, `chef diff` either compares the
|
|
59
|
-
current lockfile revision on disk to one on the server or compares two
|
|
60
|
-
lockfiles on the server. Lockfiles on the Chef Server are specified by
|
|
61
|
-
Policy Group. Examples:
|
|
62
|
-
|
|
63
|
-
* `chef diff staging`: compares the current lock with the one currently
|
|
64
|
-
|
|
65
|
-
* `chef diff production...staging` compares the lock currently assigned
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
Options:
|
|
35
|
+
banner(<<~BANNER)
|
|
36
|
+
Usage: chef diff [POLICYFILE] [--head | --git GIT_REF | POLICY_GROUP | POLICY_GROUP...POLICY_GROUP ]
|
|
37
|
+
|
|
38
|
+
`chef diff` displays an itemized diff comparing two revisions of a
|
|
39
|
+
Policyfile lock.
|
|
40
|
+
|
|
41
|
+
When the `--git` option is given, `chef diff` either compares a given
|
|
42
|
+
git reference against the current lockfile revision on disk or compares
|
|
43
|
+
between two git references. Examples:
|
|
44
|
+
|
|
45
|
+
* `chef diff --git HEAD`: compares the current lock with the latest
|
|
46
|
+
commit on the current branch.
|
|
47
|
+
* `chef diff --git master` compares the current lock with the latest
|
|
48
|
+
commit to master.
|
|
49
|
+
* `chef diff --git v1.0.0`: compares the current lock with the revision
|
|
50
|
+
as of the `v1.0.0` tag.
|
|
51
|
+
* `chef diff --git master...dev-branch` compares the Policyfile lock on
|
|
52
|
+
master with the revision on the `dev-branch` branch.
|
|
53
|
+
* `chef diff --git v1.0.0...master` compares the Policyfile lock at the
|
|
54
|
+
`v1.0.0` tag with the lastest revision on the master branch.
|
|
55
|
+
|
|
56
|
+
`chef diff --head` is a shortcut for `chef diff --git HEAD`.
|
|
57
|
+
|
|
58
|
+
When no git-specific flag is given, `chef diff` either compares the
|
|
59
|
+
current lockfile revision on disk to one on the server or compares two
|
|
60
|
+
lockfiles on the server. Lockfiles on the Chef Server are specified by
|
|
61
|
+
Policy Group. Examples:
|
|
62
|
+
|
|
63
|
+
* `chef diff staging`: compares the current lock with the one currently
|
|
64
|
+
assigned to the `staging` Policy Group.
|
|
65
|
+
* `chef diff production...staging` compares the lock currently assigned
|
|
66
|
+
to the `production` Policy Group to the lock currently assigned to the
|
|
67
|
+
`staging` Policy Group.
|
|
68
|
+
|
|
69
|
+
Options:
|
|
70
70
|
BANNER
|
|
71
71
|
|
|
72
72
|
option :git,
|
|
@@ -27,22 +27,22 @@ module ChefDK
|
|
|
27
27
|
|
|
28
28
|
include Configurable
|
|
29
29
|
|
|
30
|
-
banner(
|
|
31
|
-
Usage: chef export [ POLICY_FILE ] DESTINATION_DIRECTORY [options]
|
|
30
|
+
banner(<<~E)
|
|
31
|
+
Usage: chef export [ POLICY_FILE ] DESTINATION_DIRECTORY [options]
|
|
32
32
|
|
|
33
|
-
`chef export` creates a Chef Zero compatible Chef repository containing the
|
|
34
|
-
cookbooks described in a Policyfile.lock.json. The exported repository also
|
|
35
|
-
contains a .chef/config.rb which configures chef to apply your policy. Once the
|
|
36
|
-
exported repo is copied to the target machine, you can apply the policy to the
|
|
37
|
-
machine with:
|
|
33
|
+
`chef export` creates a Chef Zero compatible Chef repository containing the
|
|
34
|
+
cookbooks described in a Policyfile.lock.json. The exported repository also
|
|
35
|
+
contains a .chef/config.rb which configures chef to apply your policy. Once the
|
|
36
|
+
exported repo is copied to the target machine, you can apply the policy to the
|
|
37
|
+
machine with:
|
|
38
38
|
|
|
39
|
-
`chef-client -z`.
|
|
39
|
+
`chef-client -z`.
|
|
40
40
|
|
|
41
|
-
See our detailed README for more information:
|
|
41
|
+
See our detailed README for more information:
|
|
42
42
|
|
|
43
|
-
https://docs.chef.io/policyfile.html
|
|
43
|
+
https://docs.chef.io/policyfile.html
|
|
44
44
|
|
|
45
|
-
Options:
|
|
45
|
+
Options:
|
|
46
46
|
|
|
47
47
|
E
|
|
48
48
|
|
|
@@ -61,10 +61,10 @@ module ChefDK
|
|
|
61
61
|
generator(:'build-cookbook', :BuildCookbook, "Generate a build cookbook for use with Delivery")
|
|
62
62
|
|
|
63
63
|
def self.banner_headline
|
|
64
|
-
|
|
65
|
-
Usage: chef generate GENERATOR [options]
|
|
64
|
+
<<~E
|
|
65
|
+
Usage: chef generate GENERATOR [options]
|
|
66
66
|
|
|
67
|
-
Available generators:
|
|
67
|
+
Available generators:
|
|
68
68
|
E
|
|
69
69
|
end
|
|
70
70
|
|
|
@@ -34,41 +34,41 @@ module ChefDK
|
|
|
34
34
|
# You really want these to have default values, as
|
|
35
35
|
# they will likely be used all over the place.
|
|
36
36
|
option :license,
|
|
37
|
-
:
|
|
38
|
-
:
|
|
39
|
-
:
|
|
40
|
-
:
|
|
37
|
+
short: "-I LICENSE",
|
|
38
|
+
long: "--license LICENSE",
|
|
39
|
+
description: "all_rights, apachev2, mit, gplv2, gplv3 - defaults to all_rights",
|
|
40
|
+
proc: Proc.new { |l|
|
|
41
41
|
l =~ /apache2/ ? "apachev2" : l
|
|
42
42
|
},
|
|
43
|
-
:
|
|
43
|
+
default: nil
|
|
44
44
|
|
|
45
45
|
option :copyright_holder,
|
|
46
|
-
:
|
|
47
|
-
:
|
|
48
|
-
:
|
|
49
|
-
:
|
|
46
|
+
short: "-C COPYRIGHT",
|
|
47
|
+
long: "--copyright COPYRIGHT",
|
|
48
|
+
description: "Name of the copyright holder - defaults to 'The Authors'",
|
|
49
|
+
default: nil
|
|
50
50
|
|
|
51
51
|
option :email,
|
|
52
|
-
:
|
|
53
|
-
:
|
|
54
|
-
:
|
|
55
|
-
:
|
|
52
|
+
short: "-m EMAIL",
|
|
53
|
+
long: "--email EMAIL",
|
|
54
|
+
description: "Email address of the author - defaults to 'you@example.com'",
|
|
55
|
+
default: nil
|
|
56
56
|
|
|
57
57
|
option :generator_cookbook,
|
|
58
|
-
:
|
|
59
|
-
:
|
|
60
|
-
:
|
|
61
|
-
:
|
|
62
|
-
:
|
|
63
|
-
:
|
|
58
|
+
short: "-g GENERATOR_COOKBOOK_PATH",
|
|
59
|
+
long: "--generator-cookbook GENERATOR_COOKBOOK_PATH",
|
|
60
|
+
description: "Use GENERATOR_COOKBOOK_PATH for the code_generator cookbook",
|
|
61
|
+
default: nil,
|
|
62
|
+
proc: Proc.new { |s| File.expand_path(s) },
|
|
63
|
+
on: :tail
|
|
64
64
|
|
|
65
65
|
generator_args = [] # accumulator variable
|
|
66
66
|
option :generator_arg,
|
|
67
|
-
:
|
|
68
|
-
:
|
|
69
|
-
:
|
|
70
|
-
:
|
|
71
|
-
:
|
|
67
|
+
short: "-a KEY=VALUE",
|
|
68
|
+
long: "--generator-arg KEY=VALUE",
|
|
69
|
+
description: "Use to set arbitrary attribute KEY to VALUE in the code_generator cookbook",
|
|
70
|
+
default: [],
|
|
71
|
+
proc: Proc.new { |s| generator_args << s.split("=").map(&:strip) }
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
# ## GeneratorCommands
|
|
@@ -30,9 +30,9 @@ module ChefDK
|
|
|
30
30
|
attr_reader :cookbook_name_or_path
|
|
31
31
|
|
|
32
32
|
option :pipeline,
|
|
33
|
-
:
|
|
34
|
-
:
|
|
35
|
-
:
|
|
33
|
+
long: "--pipeline PIPELINE",
|
|
34
|
+
description: "Use PIPELINE to set target branch to something other than master for the build_cookbook",
|
|
35
|
+
default: "master"
|
|
36
36
|
|
|
37
37
|
options.merge!(SharedGeneratorOptions.options)
|
|
38
38
|
|
|
@@ -64,9 +64,9 @@ module ChefDK
|
|
|
64
64
|
default: false
|
|
65
65
|
|
|
66
66
|
option :pipeline,
|
|
67
|
-
:
|
|
68
|
-
:
|
|
69
|
-
:
|
|
67
|
+
long: "--pipeline PIPELINE",
|
|
68
|
+
description: "Use PIPELINE to set target branch to something other than master for the build_cookbook",
|
|
69
|
+
default: "master"
|
|
70
70
|
|
|
71
71
|
options.merge!(SharedGeneratorOptions.options)
|
|
72
72
|
|
|
@@ -23,9 +23,9 @@ module ChefDK
|
|
|
23
23
|
# chef generate file [path/to/cookbook_root] name --source=source_file
|
|
24
24
|
class CookbookFile < CookbookCodeFile
|
|
25
25
|
option :source,
|
|
26
|
-
:
|
|
27
|
-
:
|
|
28
|
-
:
|
|
26
|
+
short: "-s SOURCE_FILE",
|
|
27
|
+
long: "--source SOURCE_FILE",
|
|
28
|
+
description: "Copy content from SOURCE_FILE"
|
|
29
29
|
|
|
30
30
|
banner "Usage: chef generate file [path/to/cookbook] NAME [options]"
|
|
31
31
|
|
|
@@ -106,11 +106,11 @@ module ChefDK
|
|
|
106
106
|
|
|
107
107
|
# @api private
|
|
108
108
|
def metadata_rb
|
|
109
|
-
|
|
110
|
-
name '#{cookbook_name}'
|
|
111
|
-
description 'Custom code generator cookbook for use with ChefDK'
|
|
112
|
-
long_description 'Custom code generator cookbook for use with ChefDK'
|
|
113
|
-
version '0.1.0'
|
|
109
|
+
<<~METADATA
|
|
110
|
+
name '#{cookbook_name}'
|
|
111
|
+
description 'Custom code generator cookbook for use with ChefDK'
|
|
112
|
+
long_description 'Custom code generator cookbook for use with ChefDK'
|
|
113
|
+
version '0.1.0'
|
|
114
114
|
|
|
115
115
|
METADATA
|
|
116
116
|
end
|
|
@@ -24,9 +24,9 @@ module ChefDK
|
|
|
24
24
|
class Template < CookbookCodeFile
|
|
25
25
|
|
|
26
26
|
option :source,
|
|
27
|
-
:
|
|
28
|
-
:
|
|
29
|
-
:
|
|
27
|
+
short: "-s SOURCE_FILE",
|
|
28
|
+
long: "--source SOURCE_FILE",
|
|
29
|
+
description: "Copy content from SOURCE_FILE"
|
|
30
30
|
|
|
31
31
|
banner "Usage: chef generate template [path/to/cookbook] NAME [options]"
|
|
32
32
|
|