diff options
author | danielsdeleo <dan@getchef.com> | 2014-08-07 12:55:47 -0700 |
---|---|---|
committer | danielsdeleo <dan@getchef.com> | 2014-08-12 11:03:09 -0700 |
commit | 13c67e0dfbde2d366f0000ef036a68f374e4cef9 (patch) | |
tree | f98e1edb8a5ff13e6243d8298442ee06b925c6c1 /lib/chef/cookbook/metadata.rb | |
parent | eb171987a659906cca781b7f15e68f30498e54de (diff) | |
download | chef-13c67e0dfbde2d366f0000ef036a68f374e4cef9.tar.gz |
Remove cookbook as argument to Metadata's constructor
Now that a cookbook's name must be specified in the metadata, metadata
is always created before the cookbook version object, so it should not
accept a CookbookVersion in the constructor.
The remaining arguments to the constructor are also removed. A survey of
this codebase and a search of GitHub shows that these arguments were
never used anywhere, and they were quite odd.
Additionally, the default license field is set to "all rights reserved",
which is a safe value. The filler values of maintainer and
maintainer_email have been removed, and now default to nil. This will
make it easier to validate that the user has set these values.
Diffstat (limited to 'lib/chef/cookbook/metadata.rb')
-rw-r--r-- | lib/chef/cookbook/metadata.rb | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/lib/chef/cookbook/metadata.rb b/lib/chef/cookbook/metadata.rb index b3142f36b1..bd3a400e10 100644 --- a/lib/chef/cookbook/metadata.rb +++ b/lib/chef/cookbook/metadata.rb @@ -67,18 +67,17 @@ class Chef include Chef::Mixin::ParamsValidate include Chef::Mixin::FromFile - attr_reader :cookbook, - :platforms, - :dependencies, - :recommendations, - :suggestions, - :conflicting, - :providing, - :replacing, - :attributes, - :groupings, - :recipes, - :version + attr_reader :platforms + attr_reader :dependencies + attr_reader :recommendations + attr_reader :suggestions + attr_reader :conflicting + attr_reader :providing + attr_reader :replacing + attr_reader :attributes + attr_reader :groupings + attr_reader :recipes + attr_reader :version # Builds a new Chef::Cookbook::Metadata object. # @@ -90,14 +89,16 @@ class Chef # # === Returns # metadata<Chef::Cookbook::Metadata> - def initialize(cookbook=nil, maintainer='YOUR_COMPANY_NAME', maintainer_email='YOUR_EMAIL', license='none') - @cookbook = cookbook - @name = cookbook ? cookbook.name : nil - @long_description = "" - self.maintainer(maintainer) - self.maintainer_email(maintainer_email) - self.license(license) - self.description('A fabulous new cookbook') + def initialize + @name = nil + + @description = '' + @long_description = '' + @license = 'All rights reserved' + + @maintainer = nil + @maintainer_email = nil + @platforms = Mash.new @dependencies = Mash.new @recommendations = Mash.new @@ -108,10 +109,7 @@ class Chef @attributes = Mash.new @groupings = Mash.new @recipes = Mash.new - @version = Version.new "0.0.0" - if cookbook - recipes_from_cookbook_version(cookbook) - end + @version = Version.new("0.0.0") end def ==(other) |