diff options
author | Josh Black <raskchanky@gmail.com> | 2014-11-19 15:25:31 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-08-18 12:05:30 -0700 |
commit | 4c542d34326d7530daeae27fdc0b19f96671291c (patch) | |
tree | 67c9403cbb0f27dbe9a8c50031fe6841cc1c7297 /lib/chef | |
parent | e4586087b54bcd8944436957248cb9fba3757214 (diff) | |
download | chef-4c542d34326d7530daeae27fdc0b19f96671291c.tar.gz |
add privacy flag
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/cookbook/metadata.rb | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/lib/chef/cookbook/metadata.rb b/lib/chef/cookbook/metadata.rb index 01a98fda39..9822920a7d 100644 --- a/lib/chef/cookbook/metadata.rb +++ b/lib/chef/cookbook/metadata.rb @@ -54,12 +54,13 @@ class Chef VERSION = 'version'.freeze SOURCE_URL = 'source_url'.freeze ISSUES_URL = 'issues_url'.freeze + PRIVACY = 'privacy'.freeze COMPARISON_FIELDS = [ :name, :description, :long_description, :maintainer, :maintainer_email, :license, :platforms, :dependencies, :recommendations, :suggestions, :conflicting, :providing, :replacing, :attributes, :groupings, :recipes, :version, - :source_url, :issues_url ] + :source_url, :issues_url, :privacy ] VERSION_CONSTRAINTS = {:depends => DEPENDENCIES, :recommends => RECOMMENDATIONS, @@ -116,6 +117,7 @@ class Chef @version = Version.new("0.0.0") @source_url = '' @issues_url = '' + @privacy = false @errors = [] end @@ -454,7 +456,8 @@ class Chef :recipes => { :kind_of => [ Array ], :default => [] }, :default => { :kind_of => [ String, Array, Hash, Symbol, Numeric, TrueClass, FalseClass ] }, :source_url => { :kind_of => String }, - :issues_url => { :kind_of => String } + :issues_url => { :kind_of => String }, + :privacy => { :kind_of => [ TrueClass, FalseClass ] } } ) options[:required] = remap_required_attribute(options[:required]) unless options[:required].nil? @@ -498,7 +501,8 @@ class Chef RECIPES => self.recipes, VERSION => self.version, SOURCE_URL => self.source_url, - ISSUES_URL => self.issues_url + ISSUES_URL => self.issues_url, + PRIVACY => self.privacy } end @@ -532,6 +536,7 @@ class Chef @version = o[VERSION] if o.has_key?(VERSION) @source_url = o[SOURCE_URL] if o.has_key?(SOURCE_URL) @issues_url = o[ISSUES_URL] if o.has_key?(ISSUES_URL) + @privacy = o[PRIVACY] if o.has_key?(PRIVACY) self end @@ -590,6 +595,23 @@ class Chef ) end + # + # Sets the cookbook's privacy flag, or returns it. + # + # === Parameters + # privacy<TrueClass,FalseClass>:: Whether this cookbook is private or not + # + # === Returns + # privacy<TrueClass,FalseClass>:: Whether this cookbook is private or not + # + def privacy(arg=nil) + set_or_return( + :privacy, + arg, + :kind_of => [ TrueClass, FalseClass ] + ) + end + private def run_validation |