Jack Nagel
a2a24b3a0d
Load formulae into private namespace
2015-01-03 22:39:07 -05:00
Jack Nagel
26a2e4c4d3
Avoid formula lookup when we know it will fail
...
Formulary.loader_for cannot raise exceptions, as canonical_name must
work for nonexistent formulae. However, we can skip the constant lookup
and a redundant file existence check by returning a loader that raises
immediately in #get_formula.
2015-01-01 13:21:29 -05:00
Jack Nagel
34fc227f92
Get rid of StandardLoader class
2015-01-01 13:21:29 -05:00
Jack Nagel
648c47e85d
Re-raise NameError when it doesn't match our constant
2014-12-31 17:28:21 -05:00
Jack Nagel
5bf92cd7ca
Check file existence instead of rescuing LoadError
2014-12-31 17:28:21 -05:00
Jack Nagel
2cb160dc46
Stop rescuing NameError
...
This clause originated in 4a36c56ac7b36904712aa472b9bd50ef1b0c80d3,
attempting to catch NameErrors raised by const_defined? calls earlier in
the method body. Those const_defined? calls have since been moved out of
the body of the begin block.
Stop rescuing NameError here, which will make true programming errors in
formulae easier to debug.
2014-12-31 17:28:21 -05:00
Jack Nagel
a955665102
Preserve backtrace from original exception
2014-12-29 15:23:01 -05:00
Jack Nagel
633f29af5d
Remove duplicated logic from FromUrlLoader
2014-12-29 14:59:18 -05:00
Jack Nagel
2bf1f93721
Extract method
2014-12-29 14:59:18 -05:00
Jack Nagel
5beaa512e6
Pass the requested spec into the formula instance
2014-06-20 21:32:36 -05:00
Jack Nagel
6e1450e974
Handle illegal constant names when fetching remote formulae
2014-06-15 20:23:20 -05:00
Jack Nagel
c8fd1214bd
Revert "Only do formula class sanity checks once"
...
This reverts commit ace78b1f3a59a893c7068e485555acf792470080.
Fixes Homebrew/homebrew#30154 .
2014-06-14 16:04:38 -05:00
Jack Nagel
fdcbc5e4db
Only do formula class sanity checks once
2014-06-09 19:55:31 -05:00
Geoff Nixon
3cd5f17426
Print debug messages to stderr
...
Closes Homebrew/homebrew#29294 .
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2014-05-16 00:00:41 -05:00
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