43 Commits

Author SHA1 Message Date
Adam Vandenberg
37760ce3f8 add comment 2014-05-02 07:39:23 -07:00
Jack Nagel
bdee729a41 Yield absolute paths from find_formula 2014-04-25 18:58:16 -05:00
Tsukasa OMOTO
54004a4759 Make the on-disk representation of taps unambiguous
This commit supports "-" and "_" in names of user and repository.

Closes Homebrew/homebrew#28203.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2014-04-24 17:10:41 -05:00
David Turner
629b244cf8 Handle formula URLs with query parameters. This is useful for fetching formulas from cgit repositories, which uses ?h= to choose branches.
Closes Homebrew/homebrew#28314.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2014-04-18 08:40:39 -07:00
Jack Nagel
af272e04c7 Restore recursive tap search
Fixes Homebrew/homebrew#28234.
2014-04-07 18:44:29 -05:00
Jack Nagel
d0831c4ef7 Always resolve one symlink when loading formula files
This means that tapped formula will always have the correct path, and we
can stop calling realpath everywhere.
2014-04-06 00:31:07 -05:00
Jack Nagel
20f4b31763 Implement canonical_name in Formulary 2014-04-05 22:03:49 -05:00
Jack Nagel
e891bb4272 Drop support for passing incomplete paths
`brew install ./foo` treats `./foo` like `./foo.rb`. This requires
a confusing special case in the name resolution logic and doesn't make
a whole lot of sense from a UX perspective.

Drop support for this. The argument should be an absolute path,
a relative path, or a formula name, rather than a hybrid.

cf. https://github.com/Homebrew/homebrew/issues/23430#issuecomment-26776962
2014-04-05 22:03:40 -05:00
Jack Nagel
0d90deac27 Extract alias resolution to a separate loader class 2014-04-05 22:03:40 -05:00
Jack Nagel
caaa32325c Use StandardLoader when we know the path already 2014-04-05 22:03:40 -05:00
Jack Nagel
686ab7ad7f Drop readable? check since we don't do that for any other case 2014-04-05 22:03:40 -05:00
Jack Nagel
757c8ade0b Simplify tap formula loading 2014-04-05 22:03:40 -05:00
Jack Nagel
e008ceb332 Pass path directly to StandardLoader when possible
Now we can avoid computing the path twice in the common case.
2014-04-05 22:03:39 -05:00
Jack Nagel
ca3688e33e Eliminate repeated work in Formulary.factory
Much of the name resolution done in Formula.canonical_name is repeated
Formulary.factory. Here we eliminate the repeated work by duplicating
the code from canonical_name. Later we will refactor it so that both
methods can share the bulk of the logic.
2014-04-05 22:03:39 -05:00
Jack Nagel
aa556177f7 Combine conditional branches that do the same thing 2014-04-05 17:41:37 -05:00
Jack Nagel
2b8f1ca94b FromPathLoader already calls expand_path 2014-04-05 17:41:36 -05:00
Jack Nagel
ce367e711b Prefer File.extname to regexp 2014-04-05 17:41:36 -05:00
Jack Nagel
3bad664c39 Remove need for class name cache by only computing it once per formula 2014-04-03 22:40:40 -05:00
Jack Nagel
568c878b0a Print loader class name in debug mode 2014-03-07 17:33:02 -06:00
Jack Nagel
d476a84f4f FormulaLoader: pull shared behavior into superclass 2014-03-07 17:30:39 -06:00
Jack Nagel
bb95660a4d Use File.expand_path 2014-02-28 16:27:25 -06:00
Jack Nagel
3872f78d66 Add custom exception for untapped formulae 2014-02-28 15:58:20 -06:00
Jack Nagel
751d997202 Use constant 2014-02-28 15:58:20 -06:00
Jack Nagel
d31bee2e5b Avoid ancestors.include?, klass1 < klass2 is faster 2014-02-21 00:46:03 -05:00
Jack Nagel
da87bdc2e5 Cache generated class names 2014-02-21 00:46:03 -05:00
Jack Nagel
41a9ba8259 Move Formula.class_s to Formulary 2014-02-21 00:46:03 -05:00
Jack Nagel
3aa06a701d Consistently pass path into Formula constructor 2014-02-20 13:31:37 -05:00
Jack Nagel
abbed076f0 Pass path into the Formula constructor
When the path argument to the Formula constructor is omitted, the
instance's path attribute is created using the Formula.path class
method. However, we have already done this work, so we can just pass it
into the constructor.

This translates to one less call to Pathname#to_s per formula, or about
2600 calls when running `brew readall`.
2014-02-19 16:53:18 -05:00
Jack Nagel
1f39d6c2d1 Eliminate some Pathname -> String -> Pathname conversions 2014-02-19 16:53:18 -05:00
Jack Nagel
7591b79d7d Push expand_path call down into FromPathLoader 2014-02-19 16:53:18 -05:00
Jack Nagel
a933b58507 versions: restore original constant
Before:

  f1 = Formula.factory('tree')
  f1.versions
  f2 = Formula.factory('tree')
  f1.class == f2.class # => false

After:

  f1 = Formula.factory('tree')
  f1.versions
  f2 = Formula.factory('tree')
  f1.class == f2.class # => true
2013-12-09 21:13:45 -06:00
Jack Nagel
1fb9f85c5f Simplify setup for local bottle installation
Closes Homebrew/homebrew#22833.
2013-09-26 10:04:45 -05:00
Camillo Lugaresi
6a8387ad4a better debugging of failed formula loading
Closes Homebrew/homebrew#21680.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2013-08-05 14:03:20 -07:00
Mike McQuaid
5104fd21a5 bottles: update version regex messaging. 2013-08-04 08:25:51 -07:00
Mike McQuaid
4f2725cde3 Move getting formula names from bottles to method. 2013-07-18 09:56:55 -07:00
Mike McQuaid
9d12b917ec Formulary: fix incorrect bottle variable usage. 2013-07-04 11:20:59 +01:00
Adam Vandenberg
5db5740cc2 allow installation of formulae from the current folder
Closes Homebrew/homebrew#19177.
2013-07-02 09:23:48 -07:00
Adam Vandenberg
1c1b7ed683 Fix appending .rb to local formulae names
Closes Homebrew/homebrew#20926.
2013-06-30 14:36:12 -07:00
Adam Vandenberg
b40615d66a Catch another name error
Closes Homebrew/homebrew#20920.
2013-06-30 10:26:12 -07:00
Adam Vandenberg
8e944d5728 Add 'unload' 2013-06-29 16:44:45 -07:00
Adam Vandenberg
5c27f0ccb9 Formulary.factory always expects a string 2013-06-29 16:44:45 -07:00
Adam Vandenberg
c2a5e3608c Use Formula Loaders 2013-06-29 16:44:45 -07:00
Adam Vandenberg
099a62c95b Move Formula.factory into new Formulary module 2013-06-29 16:44:44 -07:00