diff options
author | Brian Cobb <bcobb@uwalumni.com> | 2014-07-14 10:52:39 -0500 |
---|---|---|
committer | Brian Cobb <bcobb@uwalumni.com> | 2014-07-14 10:52:39 -0500 |
commit | dd18f500bc6b92f6a11b18b819693f43714e5aeb (patch) | |
tree | 39ba4fc611791b5fa1f21a48d1e01c4c1826bcb1 /lib/chef/cookbook | |
parent | ff3ff93a1cf762024169016f78dd4c45c9dd5a76 (diff) | |
download | chef-dd18f500bc6b92f6a11b18b819693f43714e5aeb.tar.gz |
Use Chef::VersionConstraint#to_s in the metadata DSL
Diffstat (limited to 'lib/chef/cookbook')
-rw-r--r-- | lib/chef/cookbook/metadata.rb | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/lib/chef/cookbook/metadata.rb b/lib/chef/cookbook/metadata.rb index 7da1ae70de..32574c75e2 100644 --- a/lib/chef/cookbook/metadata.rb +++ b/lib/chef/cookbook/metadata.rb @@ -242,8 +242,8 @@ class Chef # versions<Array>:: Returns the list of versions for the platform def supports(platform, *version_args) version = new_args_format(:supports, platform, version_args) - normalized_version = normalize_version_constraint(:supports, platform, version) - @platforms[platform] = normalized_version + constraint = validate_version_constraint(:supports, platform, version) + @platforms[platform] = constraint.to_s @platforms[platform] end @@ -259,8 +259,8 @@ class Chef # versions<Array>:: Returns the list of versions for the platform def depends(cookbook, *version_args) version = new_args_format(:depends, cookbook, version_args) - normalized_version = normalize_version_constraint(:depends, cookbook, version) - @dependencies[cookbook] = normalized_version + constraint = validate_version_constraint(:depends, cookbook, version) + @dependencies[cookbook] = constraint.to_s @dependencies[cookbook] end @@ -276,8 +276,8 @@ class Chef # versions<Array>:: Returns the list of versions for the platform def recommends(cookbook, *version_args) version = new_args_format(:recommends, cookbook, version_args) - normalized_version = normalize_version_constraint(:recommends, cookbook, version) - @recommendations[cookbook] = normalized_version + constraint = validate_version_constraint(:recommends, cookbook, version) + @recommendations[cookbook] = constraint.to_s @recommendations[cookbook] end @@ -293,8 +293,8 @@ class Chef # versions<Array>:: Returns the list of versions for the platform def suggests(cookbook, *version_args) version = new_args_format(:suggests, cookbook, version_args) - normalized_version = normalize_version_constraint(:suggests, cookbook, version) - @suggestions[cookbook] = normalized_version + constraint = validate_version_constraint(:suggests, cookbook, version) + @suggestions[cookbook] = constraint.to_s @suggestions[cookbook] end @@ -310,8 +310,8 @@ class Chef # versions<Array>:: Returns the list of versions for the platform def conflicts(cookbook, *version_args) version = new_args_format(:conflicts, cookbook, version_args) - normalized_version = normalize_version_constraint(:conflicts, cookbook, version) - @conflicting[cookbook] = normalized_version + constraint = validate_version_constraint(:conflicts, cookbook, version) + @conflicting[cookbook] = constraint.to_s @conflicting[cookbook] end @@ -331,8 +331,8 @@ class Chef # versions<Array>:: Returns the list of versions for the platform def provides(cookbook, *version_args) version = new_args_format(:provides, cookbook, version_args) - normalized_version = normalize_version_constraint(:provides, cookbook, version) - @providing[cookbook] = normalized_version + constraint = validate_version_constraint(:provides, cookbook, version) + @providing[cookbook] = constraint.to_s @providing[cookbook] end @@ -347,8 +347,8 @@ class Chef # versions<Array>:: Returns the list of versions for the platform def replaces(cookbook, *version_args) version = new_args_format(:replaces, cookbook, version_args) - normalized_version = normalize_version_constraint(:replaces, cookbook, version) - @replacing[cookbook] = normalized_version + constraint = validate_version_constraint(:replaces, cookbook, version) + @replacing[cookbook] = constraint.to_s @replacing[cookbook] end @@ -533,11 +533,6 @@ INVALID raise Exceptions::InvalidVersionConstraint, msg end - def normalize_version_constraint(caller_name, dep_name, constraint_str) - version_constraint = validate_version_constraint(caller_name, dep_name, constraint_str) - "#{version_constraint.op} #{version_constraint.raw_version}" - end - # Verify that the given array is an array of strings # # Raise an exception if the members of the array are not Strings |