diff options
author | Xabier de Zuazo <xabier@onddo.com> | 2013-03-04 15:05:54 +0100 |
---|---|---|
committer | Bryan McLellan <btm@opscode.com> | 2013-04-11 13:04:33 -0700 |
commit | 38becdf97cdbd060027776a551aad333fbddcd5a (patch) | |
tree | 1e193e818ca257424f1ab849e3862662bb6fc27a /lib/chef/version_constraint.rb | |
parent | 8c1e41b93b119855e2e723cf35f9ca72d06a76f4 (diff) | |
download | chef-38becdf97cdbd060027776a551aad333fbddcd5a.tar.gz |
[CHEF-3919] cookbook version specific code factored out from Chef::Version, new classes created: Chef::Version::Cookbook and Chef::VersionConstraint::Cookbook
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 b6f1f08757..15ae993b67 100644 --- a/lib/chef/version_constraint.rb +++ b/lib/chef/version_constraint.rb @@ -22,6 +22,7 @@ class Chef STANDARD_OPS = %w(< > <= >=) OPS = %w(< > = <= >= ~>) PATTERN = /^(#{OPS.join('|')}) (.+)$/ + VERSION_CLASS = Chef::Version attr_reader :op, :version @@ -41,9 +42,9 @@ class Chef def include?(v) version = if v.respond_to? :version # a CookbookVersion-like object - Chef::Version.new(v.version.to_s) + self.class::VERSION_CLASS.new(v.version.to_s) else - Chef::Version.new(v.to_s) + self.class::VERSION_CLASS.new(v.to_s) end do_op(version) end @@ -98,12 +99,12 @@ class Chef @missing_patch_level = false if str.index(" ").nil? && str =~ /^[0-9]/ # try for lone version, implied '=' - @version = Chef::Version.new(str) + @version = self.class::VERSION_CLASS.new(str) @op = "=" elsif PATTERN.match str @op = $1 raw_version = $2 - @version = Chef::Version.new(raw_version) + @version = self.class::VERSION_CLASS.new(raw_version) if raw_version.split('.').size == 2 @missing_patch_level = true end |