261 Commits

Author SHA1 Message Date
Mike McQuaid
3982950e61 rubocop --auto-correct all hash-rocket usage. 2016-09-17 16:14:13 +01:00
Mike McQuaid
6693915399 rubocop --auto-correct all remaining files.
But remove some manual `.freeze`s on constants that shouldn't be
constants.
2016-09-17 16:14:13 +01:00
Markus Reiter
89a63fb177 Add cask_files method to Tap class. 2016-09-05 21:43:03 +02:00
Mike McQuaid
03352805c6 tap: use utils link_path_manpages. 2016-08-24 11:06:58 +01:00
Markus Reiter
0dd3203187 Install Cask’s default tap if untapped. 2016-08-20 07:02:23 +02:00
Mike McQuaid
9d8c4e6279 tap: allow Homebrew developers to tap broken taps. 2016-08-08 10:55:02 +01:00
Anastasia Sulyagina
4338f35b84 tap: add cask methods. 2016-08-04 11:37:37 +01:00
Mike McQuaid
a6033529cf Revert "tap: add cask methods."
This reverts commit 05daa0574732a7884bd158b2c3e14bd0709367da.
2016-08-02 14:11:40 +01:00
AnastasiaSulyagina
05daa05747 tap: add cask methods.
Closes #562.
2016-08-02 13:44:19 +01:00
Martin Afanasjew
d4b5b2080d tap: more thoroughly validate tap names
`Tap.fetch` and commands building on top of it accepted tap names like
`homebrew/homebrew/bogus` causing some misbehavior. Ensure neither
`user` nor `repo` include slashes and print a more helpful error message
that additionally includes the problematic tap name.

Closes #585.

Closes #591.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-07-27 21:25:13 +02:00
Martin Afanasjew
2c97ae1277 tap-info: expose whether a tap is private
Or how many taps are private when summarizing all installed taps.
2016-07-10 23:20:56 +02:00
Mike McQuaid
4da990587f tap: run readall when tapping. (#396)
* readall: move readall logic to new class.

* tap: run readall when tapping.

This will prevent tapping an tap with syntax errors from causing issues
for users.

Fixes #58.
2016-07-09 13:51:19 +01:00
Martin Afanasjew
68bbe6ee5f Use GitRepositoryExtension for 'path' in Tap
Closes #464.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-07-07 01:46:58 +02:00
Mike McQuaid
b05a596d57 tap: --config unsupported on old Gits. 2016-06-20 13:03:27 +01:00
Xu Cheng
9a6d5a4fee add Tap#default_remote
* without `default_remote`, `CoreTap#install` won't be able to tell
  whether user has passed to custom remote to it.
* simplify some part of logics
2016-04-19 16:29:29 +08:00
Xu Cheng
71b6e0aa18 Tap#install: better TapRemoteMismatchError check
* remote check requires `git` installed.
* Do not perform check if user does not passing remote explicitly.

Fixes #108
2016-04-19 16:29:29 +08:00
Xu Cheng
548be81b34 tap: various improvements (#77)
* make `read_or_set_private_config` private
* add doc
* add test
2016-04-12 18:51:43 +08:00
Mike McQuaid
1d5458843e Cache Tap#private? checks.
Use both an in-class and a `.git/config` cache for this so we can ensure
that the `Tap#private?` check is fast. Also, make sure this cache value
is set both when initially installing and updating a tap.

Thanks to @xu-cheng for most of the implementation here.
2016-04-12 11:00:23 +01:00
ilovezfs
fad235d8e8 tap: support --full even if installed
Makes `tap` re-runnable and unshallows when requested with `--full`.
Tapping with a different URL raises an exception.

The homebrew/core tap cannot be untapped with `untap` so running
`brew tap --full homebrew/core` is now a built-in way to get a full
clone of this tap without resorting to workarounds.

Closes #17.

Signed-off-by: ilovezfs <ilovezfs@icloud.com>
2016-04-05 07:25:27 -07:00
Xu Cheng
1b7e13df4f CoreTap#install: fix clone target setting
When invoking `brew tap homebrew/core`, the input options will be like
`{ :clone_target => nil }`. This renders `Hash#merge` a dead operation.

It doesn't impact Homebrew itself, but could cause problem for
downstream projects Linxubrew/Tigerbrew when they adopt core/formula
separation.
2016-04-05 19:34:47 +08: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
c5132daf63 introduce Homebrew/core tap as new default core tap.
It will be auto installed whenever necessary.
2016-04-02 21:51:36 +08:00
Xu Cheng
63c0a9fa92 Tap#install: set autocrlf to false
Ensure we don't munge line endings on checkout regardless with user's
global git config.

Closes Homebrew/homebrew#50514.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-03-31 14:49:01 +08:00
Xu Cheng
6e27e2db74 tap: cache dir path to avoid duplicated Pathname operations
As discovered in Homebrew/homebrew#50256, this becomes a performance bottleneck as we are
repeating construct same Pathname object.

At the same, this commit makes the behaviors between Tap and CoreTap more
consistence.
2016-03-23 15:01:28 +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
9f96e41b40 tap: add methods to get git related information
These methods will be used in `brew --version`, `brew config`
and `brew doctor` after core/formula separation.

Closes Homebrew/homebrew#49796.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-03-06 13:51:06 +08:00
Xu Cheng
43c6061bc9 Tap#install: support quiet option 2016-02-26 18:42:36 +08:00
Xu Cheng
87ecd621eb add Tap#tap_migrations
This enables tap migration feature in per tap case, which will
ultimately help core/formula separation.
2016-02-25 17:22:28 +08:00
Xu Cheng
4e51c0b8ea add Tap#formula_file?
Return true if given path would present a Formula file in this Tap.
Accepts both absolute path and relative path (relative to this Tap's path)

It offer an abstraction such that caller would not need to worry about
low level file system in the tap.

It will be used in `brew pull` and `brew update`.

Closes Homebrew/homebrew#49191.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-02-16 14:23:39 +08:00
Xu Cheng
2e892bcf63 Tap: clear_cache for Tap#(un)install
If a tap is installed during the installation, the original cache need
to be purged. Otherwise, it will return wrong information afterwards.

Closes Homebrew/homebrew#48887.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-02-07 15:03:17 +08:00
Xu Cheng
09a79106d7 Tap: allow invoking formula_file_to_name by Homebrew internally 2016-01-17 14:52:09 +08:00
Misty De Meo
d99cfd1394 tap: require string extensions
Fixes Homebrew/homebrew#47684.
2016-01-04 16:22:26 -04:00
Baptiste Fontaine
c15c9dbaf3 Tap#issues_url added
Closes Homebrew/homebrew#47454.

Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2015-12-30 00:44:46 +01:00
Xu Cheng
ef7a5cfa3a Tap#unlink_manpages: fix symlink path 2015-12-19 22:05:30 +08:00
Xu Cheng
7efae4635b Tap#unpin: remove PinnedTaps directory if it's empty 2015-12-19 22:05:30 +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
Mike McQuaid
d36d88edf2 Allow taps to link manpages.
A blocker for https://github.com/caskroom/homebrew-cask/pull/15381
being merged.

Closes Homebrew/homebrew#46795.
2015-12-09 09:09:26 +00:00
Xu Cheng
b100ad223d Tap#==: allow compare with string 2015-12-09 16:56:59 +08:00
Xu Cheng
5b435db3bf add Tap#core_formula_repository? 2015-12-09 16:56:59 +08:00
Xu Cheng
9f7a383017 add CoreFormulaRepository singleton class 2015-12-09 16:56:59 +08:00
Xu Cheng
c2a5a8388f Tap: add formula_file_to_name and alias_file_to_name 2015-12-09 16:56:59 +08:00
Xu Cheng
ea81963b8a add Tap#alias_dir 2015-12-09 16:56:59 +08:00
Xu Cheng
327286cdfb add Tap#formula_dir 2015-12-09 16:56:59 +08:00
Xu Cheng
89bd945bb7 Tap: use method instead of variable 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
e97610b916 add Tap#install and Tap#uninstall 2015-11-09 15:34:20 +08:00
Xu Cheng
4e196a2348 tap: add more document 2015-11-09 15:34:20 +08:00
Xu Cheng
98633e03c6 add alias_table and alias_reverse_table for core and tap 2015-10-14 17:26:41 +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
f001cdf777 Tap#aliases: output fully-qualified name 2015-09-13 17:19:06 +08:00