lib/ridley/chef/cookbook/metadata.rb in ridley-2.1.0 vs lib/ridley/chef/cookbook/metadata.rb in ridley-2.2.0
- old
+ new
@@ -28,28 +28,31 @@
def from_json(json)
new.from_json(json)
end
end
- NAME = 'name'.freeze
- DESCRIPTION = 'description'.freeze
- LONG_DESCRIPTION = 'long_description'.freeze
- MAINTAINER = 'maintainer'.freeze
- MAINTAINER_EMAIL = 'maintainer_email'.freeze
- LICENSE = 'license'.freeze
- PLATFORMS = 'platforms'.freeze
- DEPENDENCIES = 'dependencies'.freeze
- RECOMMENDATIONS = 'recommendations'.freeze
- SUGGESTIONS = 'suggestions'.freeze
- CONFLICTING = 'conflicting'.freeze
- PROVIDING = 'providing'.freeze
- REPLACING = 'replacing'.freeze
- ATTRIBUTES = 'attributes'.freeze
- GROUPINGS = 'groupings'.freeze
- RECIPES = 'recipes'.freeze
- VERSION = 'version'.freeze
+ NAME = 'name'.freeze
+ DESCRIPTION = 'description'.freeze
+ LONG_DESCRIPTION = 'long_description'.freeze
+ MAINTAINER = 'maintainer'.freeze
+ MAINTAINER_EMAIL = 'maintainer_email'.freeze
+ LICENSE = 'license'.freeze
+ PLATFORMS = 'platforms'.freeze
+ DEPENDENCIES = 'dependencies'.freeze
+ RECOMMENDATIONS = 'recommendations'.freeze
+ SUGGESTIONS = 'suggestions'.freeze
+ CONFLICTING = 'conflicting'.freeze
+ PROVIDING = 'providing'.freeze
+ REPLACING = 'replacing'.freeze
+ ATTRIBUTES = 'attributes'.freeze
+ GROUPINGS = 'groupings'.freeze
+ RECIPES = 'recipes'.freeze
+ VERSION = 'version'.freeze
+ COMPILED_FILE_NAME = "metadata.json".freeze
+ RAW_FILE_NAME = "metadata.rb".freeze
+
COMPARISON_FIELDS = [
:name, :description, :long_description, :maintainer,
:maintainer_email, :license, :platforms, :dependencies,
:recommendations, :suggestions, :conflicting, :providing,
:replacing, :attributes, :groupings, :recipes, :version
@@ -435,9 +438,14 @@
ATTRIBUTES => self.attributes,
GROUPINGS => self.groupings,
RECIPES => self.recipes,
VERSION => self.version
}
+ end
+
+ # @return [String]
+ def to_json
+ JSON.fast_generate(to_hash)
end
def from_hash(o)
@name = o[NAME] if o.has_key?(NAME)
@description = o[DESCRIPTION] if o.has_key?(DESCRIPTION)