Commit Graph
31 Commits
Author SHA1 Message Date
Jack Nagel c947c674ab Remove Version#to_a alias
Exposing this as "to_a" was a mistake, versions are not arrays and it
causes incorrect behavior when splatted or using Kernel#Array(). Use the
more correct name "tokens" instead.
2013-06-14 18:37:27 -05:00
Jack Nagel d5fc6f1459 Fix version misdetection from fa582cb9ac 2013-06-11 17:34:21 -05:00
Jack Nagel 17b9c31a86 Define to_s for Version::Token 2013-06-05 23:31:47 -05:00
Jack Nagel 3f3c5ae976 Improve tokenization of version strings
Tokens like "b4", "beta1", "p195", &c. are now treated as atoms rather
than being broken down even further. Additionally, we enable support for
padding in the middle of versions strings, so we can successfully
compare something like "2.1-p195" with "2.1.0-p194" by inferring that
"2.1" is really "2.1.0".

This fixes the comparison "9.9.3-P1" > "9.9.3" which previously has not
been handled correctly.
2013-06-05 22:03:58 -05:00
Mike McQuaid 2abe3d7fcf make erlang versions case-insensitive for bottles. 2013-06-03 20:53:00 +01:00
Jack Nagel 34f6f509e7 Version: dup @version in #to_s 2013-05-19 20:51:25 -05:00
Jack Nagel 8c8837ede5 Avoid extra array allocations 2013-05-06 16:52:26 -05:00
Jack Nagel 839a821118 Avoid capturing groups when unnused 2013-04-27 15:21:06 -05:00
Jack Nagel c7ba2b73e5 Combine GitHub version regexes 2013-04-27 15:21:05 -05:00
Jack Nagel 4f117962eb VersionElement: attempt most likely match first 2013-04-16 14:56:22 -05:00
Jack Nagel 86354174a7 Only call Pathname#to_s once per Version object 2013-04-16 14:32:32 -05:00
Jack Nagel 496220991e Optimize Version#<=> 2013-04-15 15:00:57 -05:00
Jack Nagel b34f7727bd MacOSVersion -> MacOS::Version 2013-02-07 12:39:54 -06:00
Jack Nagel e97adfd1ad Version: remove pointless private call 2013-02-06 22:25:02 -06:00
Jack Nagel 3bd28261d3 Version: kill silly class method
Overriding <=> directly is much simpler.
2013-02-06 22:25:02 -06:00
Mike McQuaid 063d5e5b78 jpeg: support version format. 2013-01-30 21:29:19 -08:00
Jack Nagel 3c598a1992 version: mark some methods as protected 2013-01-15 18:20:56 -06:00
Jack Nagel 7e9e8b9662 version: mark some implementation details as protected 2013-01-07 11:59:33 -06:00
Cyril Scetbon 3c333f480a Add Apache version style.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-01-01 17:30:52 +00:00
Mike McQuaid e4b5b88bd9 Add another Erlang version format. 2012-12-16 14:35:41 +00:00
Mike McQuaid 20851b9c01 Add Jenkins version matching (and test). 2012-10-16 10:31:35 +01:00
Mike McQuaid 580180bffe erlang: fix version detection and bottles. 2012-08-25 10:21:48 -07:00
Jack Nagel 672696b086 Version: make MacOSVersion comparison more robust
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-23 18:16:08 -05:00
Jack Nagel 6ccf2aa253 Version: build-in devel version comparisons
The heuristic used by the default version comparison is simple. A
version string is scanned for strings of digits, split into an array of
these strings, and then an element-wise comparison is done.

This fails when presented with something like

  Version.new("1.0.0beta7") <=> Version.new("1.0.0")

because the first three digits match, and the fourth digit of the
receiver (7) is greater than the assumed fourth digit of the parameter
(0).

Fix this by defining an element-wise comparator on a new VersionElement
class. This allows us to correctly compare "alpha", "beta", and "rc"
style version strings, and keeps the logic out of the main version
comparison.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-18 15:53:04 -05:00
Jack Nagel 822aeac407 Add custom comparator for MacOS.version
This will allow us to do comparisons like

  if MacOS.version >= :lion

and hopefully deprecate the MacOS.<name>? family of methods, which are
counterinitutive.
2012-08-18 11:13:54 -05:00
Jack Nagel 610c65c908 Add small DSL for defining comparators 2012-08-18 11:12:10 -05:00
Jack Nagel db7a800130 Add support for custom version schemes
A version scheme is a class that inherits from Version and reimplements
Version#<=>. This will allow formulae to specify a custom comparison
method that will be used instead of the default, for cases where the
default is insufficient.
2012-08-18 11:12:09 -05:00
Jack Nagel 9e80ec2c11 Add Version#detected_from_url? 2012-08-18 11:12:09 -05:00
Jack Nagel acd2866bbc Move version detection to Version class
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-18 11:12:07 -05:00
Jack Nagel 966f555e65 Initial version comparison implementation
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-18 11:12:07 -05:00
Jack Nagel 35b0647697 Add Version class 2012-08-18 11:12:07 -05:00