summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstatik <elliot@elliotmurphy.com>2010-12-23 14:42:17 -0700
committerBryan McLellan <btm@opscode.com>2011-05-20 11:56:19 -0700
commit04dca9147214ffb2882183f8af6e1b371cb31895 (patch)
treeae9ef3f6f5b4b50be8f4b526986ca3f649321c54
parent72277f901979a57d9a78090450a68d0a71e9e7c0 (diff)
downloadchef-04dca9147214ffb2882183f8af6e1b371cb31895.tar.gz
CHEF-1588: Add a -d option to include dependencies when uploading.
No tests!
-rw-r--r--chef/lib/chef/knife/cookbook_upload.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/chef/lib/chef/knife/cookbook_upload.rb b/chef/lib/chef/knife/cookbook_upload.rb
index 011fc3e6c6..6bc229a675 100644
--- a/chef/lib/chef/knife/cookbook_upload.rb
+++ b/chef/lib/chef/knife/cookbook_upload.rb
@@ -60,6 +60,11 @@ class Chef
:long => '--environment ENVIRONMENT',
:description => "Set ENVIRONMENT's version dependency match the version you're uploading.",
:default => nil
+
+ option :depends,
+ :short => "-d",
+ :long => "--include-dependencies",
+ :description => "Upload dependencies also"
def run
config[:cookbook_path] ||= Chef::Config[:cookbook_path]
@@ -85,6 +90,11 @@ class Chef
@name_args.each do |cookbook_name|
begin
cookbook = cookbook_repo[cookbook_name]
+ if config[:depends]
+ cookbook.metadata.dependencies.each do |dep, versions|
+ @name_args.push dep
+ end
+ end
cookbook.freeze_version if config[:freeze]
upload(cookbook, justify_width)
version_constraints_to_update[cookbook_name] = cookbook.version