158 Commits

Author SHA1 Message Date
Xu Cheng
c021f37525
add Formulary#from_keg 2016-07-15 19:57:23 +08:00
Xu Cheng
7452dcf508
ARGV#resolved_formulae: also load build options 2016-07-15 19:57:23 +08:00
Martin Afanasjew
8486f6e04d Prefer $stderr over STDERR for consistency (#304)
Prior to this change there were only 3 instances of `STD(IN|OUT|ERR)`
versus 74 instances of `$std(in|out|err)` in the Homebrew code base. The
latter variant is also strongly suggested by bbatsov's Ruby Style Guide.
2016-06-01 09:45:49 +02:00
Mike McQuaid
6ba466f5d8 Use JSON files for bottle upload data. (#166)
This means that we do not need to read formulae or evaluate Ruby at
upload time.
2016-05-28 15:54:05 +01:00
Mike McQuaid
d345483de1 formulary: fix comment typo. 2016-05-22 21:29:39 +01:00
Mike McQuaid
931e292bf1 Make bottle code cross-platform. 2016-05-08 16:51:22 +01:00
Martin Afanasjew
c3076f0b69 formulary: use FormulaClassUnavailableError
Present a more helpful error message if a formula file was loaded, but
the class(es) therein didn't match the expected formula class name.
2016-04-17 21:16:01 +02:00
Xu Cheng
a5cfc011e0 various: Homebrew/core is the core tap
Also make `Homebrew/homebrew` as an alias of this tap to keep
backward compatibility.
2016-04-02 21:51:36 +08:00
Xu Cheng
28f3dae8cd rename CoreFormulaRepository to CoreTap
Core tap will be separated from core code in the near future.
It makes sense to rename it to CoreTap.
2016-03-07 19:43:46 +08:00
Xu Cheng
b52af53e71 various: use Tap abstraction
formula_rename and tap_migrations are now handled inside Tap.

Closes Homebrew/homebrew#49549.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-02-26 17:00:17 +08:00
Xu Cheng
6ac6cb4fcd TapLoader: improve load logic
* Use `Tap#formula_dir` instead of `Tap#formula_files` to find formula
  file to have better performance and avoid caching issue.
* Change the loader logic to search name -> search alias -> search old name.
  This is more consistence with what we do when loading core formula
  file.

Closes Homebrew/homebrew#49484.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-02-24 20:51:35 +08:00
Xu Cheng
0f84b976ba move CoreFormulaRepository into separate file
For users whose local brew is at around 2015-06-11 to 2015-08-06,
running `brew update` will emit following error:

  Error: uninitialized constant Formulary::CoreFormulaRepository

This is caused by the same bug described in Homebrew/homebrew#42553.

This commit workarounds this issue and restores `brew update` compatibility
for users mentioned above.

Also cleanup legacy `require "cmd/tap"`.
2015-12-19 22:05:30 +08:00
Xu Cheng
82eb1a4c42 formulary: use CoreFormulaRepository
Let's hide implementation detail on where to find core formulae alias
directory. This will benefit future core code and formulae separation.
2015-12-19 22:05:30 +08:00
Alex Dunn
af77e8b380 Formulary: explicitly require tap
Fixes Homebrew/homebrew#46984.
2015-12-13 20:19:53 -08:00
Xu Cheng
fe032e3e96 avoid using FORMULA_RENAMES directly 2015-12-09 16:56:59 +08:00
Xu Cheng
6e92609cf4 Formulary: use same logic to handle core fully-qualified name 2015-12-09 16:56:59 +08:00
Xu Cheng
061a34b138 Formulary.core_path: use CoreFormulaRepository#formula_dir 2015-12-09 16:56:59 +08:00
Xu Cheng
b810c034b7 Formulary: use Tap#alias_dir 2015-12-09 16:56:59 +08:00
Xu Cheng
48950f2cc0 centralize the logic of handling homebrew- in Tap.fetch
Closes Homebrew/homebrew#46537.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-12-03 13:46:59 +08:00
Xu Cheng
60ba8beefa Formulary.from_rack: better formula resolution strategy
The flow is as follow:
* If tap is nil(DIY install), search using name.
* If tap is found, search using full name.
* If tap is found and full name searching failed, search using name.
  This usually means the formula may be migrated to different tap.

Closes Homebrew/homebrew#44771.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-10-10 01:34:36 +08:00
Xu Cheng
3b520cf195 cache taps
There are plenty of IO operations inside Tap object, and it will be more
when implementing formula alias reverse look up(e.g. list all of alias
names for a formula). So let's cache them.

Some benchmark:

$ time brew info $(brew ruby -e 'puts Formula.tap_names') > /dev/null
Before: 6.40s user 2.42s system 96% cpu 9.134 total
After: 4.75s user 0.77s system 97% cpu 5.637 total

Closes Homebrew/homebrew#44377.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-09-30 16:25:30 +08:00
Xu Cheng
5f68fff92b support alias for tap 2015-09-13 12:57:59 +08:00
Xu Cheng
ee1dd24b19 FromUrlLoader: allow file:// scheme 2015-09-06 20:47:04 +08:00
Xu Cheng
61c8f69c25 add Formulary.from_contents 2015-09-06 20:47:04 +08:00
Xu Cheng
ff0f6598ce Formulary: allow loading formula from contents 2015-09-06 20:47:03 +08:00
Xu Cheng
a88c40b8c8 core file style update 2015-08-22 13:15:33 +08:00
Xu Cheng
8a766c4768 Formulary.to_rack: follow the symlink 2015-08-15 16:12:42 +08:00
Xu Cheng
fac17e8459 to_rack: simplify the logic
Closes Homebrew/homebrew#42743.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-08-10 21:59:51 +08:00
Vlad Shablinsky
6a0dcc8324 don't use new name rack if old name rack is a dir
Everything that used HOMEBREW_CELLAR/canonical_name
could point to something that doesn't exist because
loader_for tries to load new name formula if no old
name found. However there can be software installed
from path with the same name that renamed formulae
had and we still need to link/unlink/uninstall etc
that software. The solution is Formulary#to_rack
method that returns rack for given name.
- Add Formulary#to_rack
- Update ARGV.kegs
- Update cmd/switch
2015-08-10 13:57:59 +01:00
Vlad Shablinsky
2cc6b90329 formulary: change logic for renamed formulae 2015-08-10 13:57:59 +01:00
CNA-Bld
194618beb8 implement formulary#find_with_priority 2015-08-10 12:17:26 +01:00
CNA-Bld
68a5b1fe46 add fully qualified name for core formulae 2015-08-06 22:28:44 +08:00
Xu Cheng
b121e5fd7b more core file style updated by rubocop 2015-08-06 17:23:56 +08:00
BrewTestBot
13d544e11e Core files style updates.
Closes Homebrew/homebrew#42354.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-03 13:22:35 +01:00
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