diff options
author | Xabier de Zuazo <xabier@onddo.com> | 2014-05-25 15:15:10 +0200 |
---|---|---|
committer | Xabier de Zuazo <xabier@onddo.com> | 2014-05-25 15:15:10 +0200 |
commit | 5b4498135d7b2a2256f3aeefb587c88b4abe45d3 (patch) | |
tree | 5e27e3ccb63f113da4d45e52e2a467f80c2f299d /lib/chef/version_constraint.rb | |
parent | 9ebdfdd6af9390c0d4a1c28f689eb213f61119d1 (diff) | |
download | chef-5b4498135d7b2a2256f3aeefb587c88b4abe45d3.tar.gz |
[CHEF-4298] Coookbook::Metadata: avoid converting 2 part versions to 3 part versions, added #normalize_version_constraint method
Diffstat (limited to 'lib/chef/version_constraint.rb')
-rw-r--r-- | lib/chef/version_constraint.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/chef/version_constraint.rb b/lib/chef/version_constraint.rb index 38686441a8..7bfde41e74 100644 --- a/lib/chef/version_constraint.rb +++ b/lib/chef/version_constraint.rb @@ -24,7 +24,7 @@ class Chef PATTERN = /^(#{OPS.join('|')}) *([0-9].*)$/ VERSION_CLASS = Chef::Version - attr_reader :op, :version + attr_reader :op, :version, :raw_version def initialize(constraint_spec=DEFAULT_CONSTRAINT) case constraint_spec @@ -99,12 +99,13 @@ class Chef @missing_patch_level = false if str.index(" ").nil? && str =~ /^[0-9]/ # try for lone version, implied '=' - @version = self.class::VERSION_CLASS.new(str) + @raw_version = str + @version = self.class::VERSION_CLASS.new(@raw_version) @op = "=" elsif PATTERN.match str @op = $1 - raw_version = $2 - @version = self.class::VERSION_CLASS.new(raw_version) + @raw_version = $2 + @version = self.class::VERSION_CLASS.new(@raw_version) if raw_version.split('.').size <= 2 @missing_patch_level = true end |