74 Commits

Author SHA1 Message Date
Xu Cheng
8f0249e9a1 handle mxcl/master synonym inside Tab#from_file_content 2015-08-02 16:12:14 +08:00
Xu Cheng
be9fde6266 Formulary#from_rack: auto resolve spec 2015-07-31 19:44:02 +08:00
Xu Cheng
b1fff32055 BottleLoader: check version mismatch
Closes Homebrew/homebrew#42049.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-07-24 15:59:28 +08:00
Xu Cheng
140f8e3df7 improve TapLoader and TapFormulaUnavailableError
* Restore the ability to load formula by `user/homebrew-repo/foo`.
* Only suggest to install tap when tap isn't installed.

Closes Homebrew/homebrew#41705.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-07-19 12:10:33 +08:00
Xu Cheng
c1fb7a8e4a tap_paths: prevent conflicted formulae happen in the same tap
Closes Homebrew/homebrew#40606.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-06-12 16:20:44 +08:00
Xu Cheng
f2d0a88292 remove Pathname#find_formula
Closes Homebrew/homebrew#40486.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-06-11 15:28:30 +08:00
Jack Nagel
7d8bec3f20 Always treat formula files as UTF-8 2015-06-08 22:27:27 -04:00
Jack Nagel
9516444dfd Give namespace modules a name so formula objects can be marshaled
Fixes Homebrew/homebrew#40311.
2015-06-02 20:51:16 -04:00
Xu Cheng
99ba9faf09 BottleLoader: use bottle_resolve_formula_names 2015-06-02 16:45:43 +08:00
Jack Nagel
45a71898e8 Isolate formula class namespaces
Closes Homebrew/homebrew#40151.
Closes Homebrew/homebrew#40203.
2015-06-01 19:24:47 -04:00
Misty De Meo
102170b957 Formulary: accept mxcl/master as synonym for Homebrew/homebrew
Fixes Homebrew/homebrew#40171.
2015-05-28 16:24:46 -07:00
Xu Cheng
647c7626f0 Formulary: add from_rack 2015-05-27 13:53:40 +08:00
Xu Cheng
e91d152af8 Formulary#canonical_name: handle TapFormulaAmbiguityError
If there are multiple tap formulae with the name of ref,
then ref is the canonical name
2015-05-27 13:53:40 +08:00
Xu Cheng
811c4c5add load tap formula through direct search 2015-05-27 13:53:40 +08:00
Xu Cheng
3a3a49bd93 add Formulary.core_path method, deprecate Formula.path 2015-05-27 13:53:40 +08:00
Xu Cheng
3108fb5d22 BottleLoader: using Formulary.path to search formula file 2015-05-27 13:53:40 +08:00
Xu Cheng
8297810e3c add Formulary::path method
This is a little code refactoring splited from Homebrew/homebrew#36753

The idea is to eliminate `Formula#path` outside of `formulary.rb`.
And I indent to deprecate `Formula#path` method when I reimplement
symlink free tap function.

Closes Homebrew/homebrew#39313.
2015-05-08 13:51:26 +08:00
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