lib/origen/version_string.rb in origen-0.33.2 vs lib/origen/version_string.rb in origen-0.33.3
- old
+ new
@@ -27,29 +27,41 @@
# Returns true if the version is a development tag
def development?
!production?
end
+ alias_method :orig_equal?, :==
+
+ def equal?(version)
+ condition_met?("== #{version}")
+ end
+ alias_method :eq?, :equal?
+ alias_method :==, :equal?
+
def less_than?(version)
condition_met?("< #{version}")
end
alias_method :lt?, :less_than?
+ alias_method :<, :less_than?
def less_than_or_equal_to?(version)
condition_met?("<= #{version}")
end
alias_method :lte?, :less_than_or_equal_to?
+ alias_method :<=, :less_than_or_equal_to?
def greater_than?(version)
condition_met?("> #{version}")
end
alias_method :gt?, :greater_than?
+ alias_method :>, :greater_than?
def greater_than_or_equal_to?(version)
condition_met?(">= #{version}")
end
alias_method :gte?, :greater_than_or_equal_to?
+ alias_method :>=, :greater_than_or_equal_to?
# Returns true if the version is a correctly formatted semantic
# or timestamp version number
def valid?(_options = {})
latest? || semantic? || timestamp?
@@ -167,11 +179,11 @@
end
end
alias_method :dev, :pre
def latest?
- downcase == 'trunk' || downcase == 'latest'
+ downcase.orig_equal?('trunk') || downcase.orig_equal?('latest')
end
# Returns true if the version is a timestamp format version number
def timestamp?
!!(self =~ /^Rel\d\d\d\d\d\d\d\d$/ ||
@@ -223,14 +235,14 @@
tag = validate_condition!(condition, Regexp.last_match[1])
numeric < tag.numeric && ((self.latest? || tag.latest?) || self.timestamp? == tag.timestamp?)
elsif condition =~ /^==?\s*(.*)/
tag = validate_condition!(condition, Regexp.last_match[1])
- self == tag
+ self.orig_equal?(tag)
else
tag = validate_condition!(condition, condition)
- self == tag
+ self.orig_equal?(tag)
end
end
# Returns a numeric representation of the version, this can be used
# for chronological comparison with other versions