130 Commits

Author SHA1 Message Date
Jack Nagel
5369199df3 Fix version misdetection from fa582cb9ac65 2013-06-11 17:34:21 -05:00
Jack Nagel
2fcc9bad42 Define to_s for Version::Token 2013-06-05 23:31:47 -05:00
Jack Nagel
28acfbba51 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
eb7efb8dd5 make erlang versions case-insensitive for bottles. 2013-06-03 20:53:00 +01:00
Jack Nagel
bf935a1fa5 Version: dup @version in #to_s 2013-05-19 20:51:25 -05:00
Jack Nagel
5bf652ecdd Avoid extra array allocations 2013-05-06 16:52:26 -05:00
Jack Nagel
c2889de323 Avoid capturing groups when unnused 2013-04-27 15:21:06 -05:00
Jack Nagel
364c5c3473 Combine GitHub version regexes 2013-04-27 15:21:05 -05:00
Jack Nagel
b7c0c53ffc VersionElement: attempt most likely match first 2013-04-16 14:56:22 -05:00
Jack Nagel
42da1295ce Only call Pathname#to_s once per Version object 2013-04-16 14:32:32 -05:00
Jack Nagel
466a32df02 Optimize Version#<=> 2013-04-15 15:00:57 -05:00
Jack Nagel
7fbeb0df3d MacOSVersion -> MacOS::Version 2013-02-07 12:39:54 -06:00
Jack Nagel
ba2717fb19 Version: remove pointless private call 2013-02-06 22:25:02 -06:00
Jack Nagel
15562c8876 Version: kill silly class method
Overriding <=> directly is much simpler.
2013-02-06 22:25:02 -06:00
Mike McQuaid
eec8cc6a12 jpeg: support version format. 2013-01-30 21:29:19 -08:00
Jack Nagel
bdece49b05 version: mark some methods as protected 2013-01-15 18:20:56 -06:00
Jack Nagel
6641fc4017 version: mark some implementation details as protected 2013-01-07 11:59:33 -06:00
Cyril Scetbon
4fc76a67d4 Add Apache version style.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-01-01 17:30:52 +00:00
Mike McQuaid
7d61bfe88f Add another Erlang version format. 2012-12-16 14:35:41 +00:00
Mike McQuaid
425440de3b Add Jenkins version matching (and test). 2012-10-16 10:31:35 +01:00
Mike McQuaid
d9a18d4c1e erlang: fix version detection and bottles. 2012-08-25 10:21:48 -07:00
Jack Nagel
f069ebd0df Version: make MacOSVersion comparison more robust
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-23 18:16:08 -05:00
Jack Nagel
c924de7086 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
b8231fc5f3 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
158b7047e5 Add small DSL for defining comparators 2012-08-18 11:12:10 -05:00
Jack Nagel
2ff6c40735 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
e57122780e Add Version#detected_from_url? 2012-08-18 11:12:09 -05:00
Jack Nagel
5fe7fdf153 Move version detection to Version class
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-18 11:12:07 -05:00
Jack Nagel
956c1d653a Initial version comparison implementation
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-18 11:12:07 -05:00
Jack Nagel
104fc0e09b Add Version class 2012-08-18 11:12:07 -05:00