16336 Commits

Author SHA1 Message Date
Mike McQuaid
17667c03d0 Add deps target to tests Rakefile for needed gems. 2013-04-26 22:32:26 +01:00
Misty De Meo
f4cf04b95e doctor: don't shell out in coreutils check 2013-04-25 18:23:43 -05:00
Misty De Meo
814b969963 doctor: add default-names findutils check
Fixes Homebrew/homebrew#19265.
2013-04-25 18:23:43 -05:00
Jack Nagel
b7066b6e74 Add a couple more version tests 2013-04-24 15:02:05 -05:00
Jack Nagel
be32a3ee88 Split up big version detection test 2013-04-24 15:01:54 -05:00
Jack Nagel
8a74e648e7 audit: warn about top-level methods 2013-04-22 15:19:03 -05:00
Simon Sigurdhsson
4f45077fde Remove global methods from formulae
Removes any global methods from formulae, and moves #kext_prefix (which
seems to be at least somewhat abstractable) into the Formula class. The
only formula with global methods is now aspell; it (and its generating
script in contrib) has been changed to prefix that method with
`aspell_`, to minimize the risk of name collisions.

Closes Homebrew/homebrew#19331.
Closes Homebrew/homebrew#19343.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-04-21 23:48:50 -05:00
Jack Nagel
51bfd4fc1e Avoid calling to_s on the same Pathname multiple times 2013-04-20 13:50:42 -05:00
Jack Nagel
368ba306d7 Don't accept Formula objects as dep specs
It was pointed out that this isn't used at all.
2013-04-18 01:17:15 -05:00
Jack Nagel
7ea15918bb Reorder dep spec types by frequency 2013-04-17 14:12:41 -05:00
Adam Vandenberg
a7714a804b Add :hg build requirement.
Closes Homebrew/homebrew#19074.
2013-04-17 10:01:38 -07:00
Xiyue Deng
869642e635 Fix download strategy for SVN HEAD
After converting to Pathname to create paths, using '+=' will result in
path concatenation by '/', which result in weird path like
'gcc--svn/-HEAD'. This patch should fix this.

Closes Homebrew/homebrew#19233.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-04-16 16:17:48 -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
1426b92a82 Only dup and shift when specs hash is populated 2013-04-16 14:18:23 -05:00
Jack Nagel
0fb4f9c426 Reduce repeated array inclusion check
Currently we check if "tag" is present in LANGUAGE_MODULES for every
String dep, even if tag is nil. Stop doing this, and make the
LANGUAGE_MODULES array into a Set instead to improve lookup performance.
2013-04-16 09:53:02 -05:00
Jack Nagel
3a0726406b Add tests for FormulaPin and simplify implementation 2013-04-16 01:58:11 -05:00
Ashley Towns
d600d6c0be Update for Xcode 4.6.2
Closes Homebrew/homebrew#19227.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-04-15 21:44:12 -05:00
Jack Nagel
d504d50dcb Don't create MacOS.version multiple times 2013-04-15 16:04:35 -05:00
Jack Nagel
466a32df02 Optimize Version#<=> 2013-04-15 15:00:57 -05:00
Jack Nagel
49682e854d Avoid expensive Pathname concatenation 2013-04-15 15:00:57 -05:00
Jack Nagel
841c8bedca Clean up remaining DownloadStrategy initializers 2013-04-15 15:00:57 -05:00
Jack Nagel
010a1461f7 Avoid repeated interpolation here too 2013-04-14 23:48:20 -05:00
Jack Nagel
33e00b7f7c Style nit 2013-04-14 23:29:15 -05:00
Jack Nagel
a78ae63153 Performance fix for Pathname#prepend_prefix
See 05a456c231dc6da7cb0f7c70cb21feaf9a0d803c; same story.
2013-04-14 22:38:18 -05:00
Jack Nagel
5e9cfec8b8 Performance fix for Pathname#chop_basename
This is an internal method, but is called a bunch of times in
performance-critical codepaths, and is ultra slow because the constant
is interpoplated into the Regexp each time the method is called.

Alas, this has been fixed in Ruby 1.9+.
2013-04-14 21:56:04 -05:00
Jack Nagel
1bad199776 Avoid slow operations in FormulaPin#initialize
A FormulaPin object is created every time Formula is instantiated, so
don't do filesystem operations or Pathname concatenation eagerly.
2013-04-14 21:41:30 -05:00
Jack Nagel
b258bee44e Don't use Pathname#/ in performance-critical code
This method (well, really, #join) is *twice* as slow as simple
concatenation, and shouldn't really be used at all in non-Formula code.
2013-04-14 20:09:20 -05:00
Jack Nagel
3c73cc28e0 Optimization: avoid repeated interpolation in regexp
Benchmark.bm do |b|
  b.report("before") do
    100_000.times { /(\.#{MacOS.cat}\.bottle\.(\d+\.)?tar\.gz)$/ }
  end
  b.report("after ") do
    100_000.times { /(\.#{MacOS.cat}\.bottle\.(\d+\.)?tar\.gz)$/o }
  end
end
            user     system      total        real
before 35.400000   0.140000  35.540000 ( 35.619674)
after   0.020000   0.000000   0.020000 (  0.016662)
2013-04-14 18:32:48 -05:00
Jack Nagel
2e58fbf260 Keg requires OpenStruct 2013-04-14 15:38:14 -05:00
Adam Vandenberg
4daf0de435 Only prune taps if taps exist.
Closes Homebrew/homebrew#19192.
2013-04-14 09:35:16 -07:00
Jaime Marquínez Ferrándiz
adbd8cee6d New visualization for brew deps --tree
Closes Homebrew/homebrew#18835.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-04-13 20:32:45 -05:00
Jack Nagel
c8f2d41fe4 Remove extra require 2013-04-13 20:07:14 -05:00
Jack Nagel
5fc772b8e9 Use assert_operator 2013-04-13 19:50:02 -05:00
Jack Nagel
e5eaa6696c Remove obsolete tests
This behavior is now tested at more appropriate levels in
test_software_spec, test_formula_spec_selection, and
test_formula_validation.
2013-04-13 18:23:06 -05:00
Jack Nagel
00bcc5e8ad Make a specific assertion in this test 2013-04-13 17:40:14 -05:00
Jack Nagel
a05bb48807 Raise a useful exception for incomplete formulae 2013-04-13 17:40:14 -05:00
Jack Nagel
25c0ecfd63 Add tests for formula spec selection
These tests document the relative precedence of the stable, bottle,
devel, and head specifications, and the conditions that can influence
which is selected (e.g. command-line flags).
2013-04-13 17:40:13 -05:00
Jack Nagel
4bd34c9624 Allow "devel-only" formulae
It seems only natural that this should be possible, or at the very
least, it should not result in calling methods on nil.
2013-04-13 17:40:13 -05:00
Jack Nagel
2e26afe556 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
291977d823 Run tap --repair as part of prune
And by extension, `cleanup`.

Fixes Homebrew/homebrew#18658.
2013-04-13 17:23:14 -05:00
Jack Nagel
eb16d746d7 Clean up checksum verification tests 2013-04-13 16:36:30 -05:00
Jack Nagel
7f9bd7a067 doctor: 'raring' => 'ready'
It was pointed out that 'raring' is a rare word can be confusing to
non-native speakers.

Closes Homebrew/homebrew#18659, see that for details.
2013-04-12 19:32:23 -05:00
Jack Nagel
d25767b354 doctor: consolidate directory access checks
Also include a writability check for lib.

Closes Homebrew/homebrew#18571.
2013-04-12 19:32:02 -05:00
Jiang Xin
f30200890e versions: work for tapped formulae
brew versions is hardcoded to cd to HOMEBREW_REPOSITORY before running
git, and as such fails to report previous versions for any formulae
from a tapped repository.

Add two new private methods repository and entry_name to replace the
hardcoded HOMEBREW_REPOSITORY and formula path, and brew versions
work for both builtin and tapped formulae.

Closes Homebrew/homebrew#12356.
Closes Homebrew/homebrew#19069.

Reported-by: Misty De Meo <mistydemeo@gmail.com>
Suggested-by: Jack Nagel <jacknagel@gmail.com>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-04-11 23:45:15 -05:00
Geoff Petrie
79c745cc76 doctor: suggest brew update in outdated warning
Closes Homebrew/homebrew#19106.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-04-11 02:12:59 -05:00
Jack Nagel
909ac74644 Eliminate test_bucket
Most of the behavior tested here is now tested elsewhere. Move the
remaining useful tests to better places.
2013-04-10 22:27:56 -05:00
Jack Nagel
d526d2b257 More comprehensive tests for Pathname extension 2013-04-10 20:05:43 -05:00
Jack Nagel
951b09b1c5 link: eliminate naked rescue 2013-04-10 12:02:35 -05:00
Jack Nagel
47282db255 Make test formulae initializers more flexible 2013-04-10 12:02:35 -05:00