Commit Graph
47 Commits
Author SHA1 Message Date
Jack Nagel fa582cb9ac Add failing test for a misdetected version 2013-06-10 14:55:23 -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
Jack Nagel b262a009ba Add failing test for patchlevel version comparisons 2013-06-05 10:06:37 -05:00
Jack Nagel 2cf21c31b6 Add a couple more version tests 2013-04-24 15:02:05 -05:00
Jack Nagel e279048d01 Split up big version detection test 2013-04-24 15:01:54 -05:00
Jack Nagel a99554879d Use assert_operator 2013-04-13 19:50:02 -05:00
Jack Nagel 563d8be6bd Improved formula attribute validation
The initializer for Formula does a number of validations, but it does
them in a weird order, and some attributes aren't validated under
certain circumstances. This became even more of a mess when most
software package attributes were moved into the SoftwareSpec class.

This commit removes the last vestiges of storing these attributes as
instance variables. In particular, it eliminates #set_instance_variable
and #validate_variable, replacing them with methods that operate on
SoftwareSpec instances, and generate more useful errors.

Doing these validations unconditionally in the initializer means we bail
out much earlier if the formula has invalid attributes or is not fully
specified, and no longer need to validate in #prefix.

Technically we don't need to validate in #brew either, but we continue
to do so anyway as a safety measure, and because we cannot enforce calls
to super in subclasses.
2013-04-13 17:40:12 -05:00
Jack Nagel 8510120f07 Fix specs in TestBall 2013-04-08 17:43:01 -05:00
Jack Nagel 1e9fb46212 Suppress ambiguous argument and grouped expression warnings 2013-03-28 17:37:29 -05:00
Jack Nagel 33393a2597 Remove unused variables 2013-02-18 12:13:35 -06:00
Jack Nagel 9cb6939cfd Flesh out MacOSVersion tests 2013-02-07 12:35:15 -06:00
Mike McQuaid 063d5e5b78 jpeg: support version format. 2013-01-30 21:29:19 -08:00
Mike McQuaid 3318b08a2e Don't use underscores in (new) bottle filenames.
Closes #14270
2013-01-29 17:14:09 -08:00
Mike McQuaid e9eac42daa Cleanup old bottle syntax. 2013-01-29 17:14:00 -08:00
Mike McQuaid ee17db950a Add Apache version style test. 2013-01-01 17:30:57 +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 ca24ee0ef2 Test version interrogation methods
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-18 16:07:14 -05:00
Jack Nagel 74c58497bd Simplify version comparison tests
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-18 16:03:43 -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 4affbabfb7 Replace version strings with Version objects 2012-08-18 11:12:08 -05:00
Jack Nagel 7cfc6beaef Further version test refactoring 2012-08-18 11:12:08 -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 0da83e6158 Preliminary version test refactoring 2012-08-18 11:12:07 -05:00
Jack Nagel e6b97bebd9 Deprecate ancient formula syntax
Closes #13444.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-09 23:56:54 -05:00
Jack Nagel 8ed666ae7d tests: clean up whitespace
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-07-04 22:47:34 -05:00
Jack Nagel f3dc89c1ed Prune some requires from test files
testing_env already requires utils; set up the ARGV and ENV extensions
there as well.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-07-04 22:47:34 -05:00
Mike McQuaid 45476c7cf1 Change versioned bottle syntax and fix issues.
Fixed #11562.
2012-04-24 18:53:45 +10:00
Mike McQuaid d60023c466 Revert "Change versioned bottle syntax and fix issues."
This reverts commit f80908bead.
2012-04-24 18:10:08 +10:00
Mike McQuaid f80908bead Change versioned bottle syntax and fix issues.
Fixed #11562.
2012-04-24 18:08:14 +10:00
Jack Nagel 28a2dfd8b6 Add test for ghc version style
the ghc formula had an explicit version because we had trouble parsing
the version from the 64-bit URL. It is working now, so add a test to
ensure it isn't broken in the future.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-04-06 00:08:23 -05:00
Jack Nagel 2e7cbfef33 Remove redundant versions and update version tests
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-03-11 15:18:56 -05:00
Mike McQuaid 24476086ae Support bottles for non-Lion OSX versions. 2012-03-10 18:09:35 +13:00
Max Howell 14d7d03425 Fix libinet version detection 2012-01-14 03:48:03 +00:00
Jack Nagel faada11b79 Correctly parse ImageMagick bottle version
Commit 2695821e98 ("Only use the bottle if its version is up-to-date")
essentially broke the ImageMagick bottle, because the version parsing
logic returns "1" as the bottle version.

Fixing this requires only a slight modification to the bottle URL regex;
includes a test.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2011-09-21 17:29:14 -05:00
Mike McQuaid 9c69c1bae3 Fix brew bottle versioning. 2011-06-21 19:04:17 +01:00
Austin Ziegler 304d9af671 Adding version detection to sf.net /download urls
SourceForge links can end with /download which appears to be part of
what is used to drive mirror selection. Modifying the version detection
extension of pathname.rb to detect this case for both sourceforge.net
and sf.net download selections.

This is sufficient for version detection but may not be sufficient for
other uses of /download links. I have not found any problems with links
that use /download, though.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2011-03-25 22:30:10 -07:00
lukas bdd131a6a5 Fixed recognition of versions like 'foobar-4.50-beta' in Pathname#version
Sphinx currently has a download name 'http://sphinxsearch.com/downloads/sphinx-1.10-beta.tar.gz', which homebrew currently can't correctly identify - with a small change to the regex for 'foobar-4.5.0-beta1' (make that trailing number optional) - it works like a charm.

Signed-off-by: David Höppner <0xffea@gmail.com>
2010-08-27 17:53:06 +02:00
Adam Vandenberg eab7053dda Add debian style names to version checker. 2010-07-06 13:17:50 -07:00
Adam Vandenberg fe2014feb7 Update version tests 2010-07-06 13:17:43 -07:00
Adam Vandenberg c550e83613 Move version tests to separate file. 2010-04-06 08:27:11 -07:00
Joshua Peek 74ec7a12fa fix github version parser with multidigit number
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2010-03-27 14:01:19 -07:00
Adam Vandenberg 8d02ae7431 Update test suite.
* Break single test case class into several test cases.
* Fix broken arch test.
* Make update tests optional (seem to only work for mxcl).
* Add more tests.
* Move fixtures to separate folder.
2010-02-02 09:08:10 -08:00