2016-04-08 16:28:43 +02:00
|
|
|
#: * `tap`:
|
|
|
|
#: List all installed taps.
|
|
|
|
#:
|
|
|
|
#: * `tap` [`--full`] <user>`/`<repo> [<URL>]:
|
|
|
|
#: Tap a formula repository.
|
|
|
|
#:
|
|
|
|
#: With <URL> unspecified, taps a formula repository from GitHub using HTTPS.
|
|
|
|
#: Since so many taps are hosted on GitHub, this command is a shortcut for
|
|
|
|
#: `tap <user>/<repo> https://github.com/<user>/homebrew-<repo>`.
|
|
|
|
#:
|
|
|
|
#: With <URL> specified, taps a formula repository from anywhere, using
|
|
|
|
#: any transport protocol that `git` handles. The one-argument form of `tap`
|
|
|
|
#: simplifies but also limits. This two-argument command makes no
|
|
|
|
#: assumptions, so taps can be cloned from places other than GitHub and
|
|
|
|
#: using protocols other than HTTPS, e.g., SSH, GIT, HTTP, FTP(S), RSYNC.
|
|
|
|
#:
|
|
|
|
#: By default, the repository is cloned as a shallow copy (`--depth=1`), but
|
|
|
|
#: if `--full` is passed, a full clone will be used. To convert a shallow copy
|
|
|
|
#: to a full copy, you can retap passing `--full` without first untapping.
|
|
|
|
#:
|
|
|
|
#: `tap` is re-runnable and exits successfully if there's nothing to do.
|
|
|
|
#: However, retapping with a different <URL> will cause an exception, so first
|
|
|
|
#: `untap` if you need to modify the <URL>.
|
|
|
|
#:
|
|
|
|
#: * `tap` `--repair`:
|
|
|
|
#: Migrate tapped formulae from symlink-based to directory-based structure.
|
|
|
|
#:
|
|
|
|
#: * `tap` `--list-official`:
|
|
|
|
#: List all official taps.
|
|
|
|
#:
|
|
|
|
#: * `tap` `--list-pinned`:
|
|
|
|
#: List all pinned taps.
|
|
|
|
|
2015-06-08 18:05:58 +08:00
|
|
|
require "tap"
|
|
|
|
|
2014-06-18 22:41:47 -05:00
|
|
|
module Homebrew
|
2016-09-26 01:44:51 +02:00
|
|
|
module_function
|
|
|
|
|
2012-03-02 20:28:54 +00:00
|
|
|
def tap
|
2015-12-26 13:01:52 +08:00
|
|
|
if ARGV.include? "--repair"
|
2015-12-08 17:26:53 +00:00
|
|
|
Tap.each(&:link_manpages)
|
2015-12-26 13:01:52 +08:00
|
|
|
elsif ARGV.include? "--list-official"
|
2015-08-03 20:39:00 +02:00
|
|
|
require "official_taps"
|
2015-08-21 12:33:33 +08:00
|
|
|
puts OFFICIAL_TAPS.map { |t| "homebrew/#{t}" }
|
2015-12-26 13:01:52 +08:00
|
|
|
elsif ARGV.include? "--list-pinned"
|
2015-08-21 12:33:33 +08:00
|
|
|
puts Tap.select(&:pinned?).map(&:name)
|
2015-12-26 13:01:52 +08:00
|
|
|
elsif ARGV.named.empty?
|
|
|
|
puts Tap.names
|
2012-03-02 20:28:54 +00:00
|
|
|
else
|
2015-12-26 13:01:52 +08:00
|
|
|
tap = Tap.fetch(ARGV.named[0])
|
2015-11-10 18:33:57 +08:00
|
|
|
begin
|
2016-09-17 15:32:44 +01:00
|
|
|
tap.install clone_target: ARGV.named[1],
|
|
|
|
full_clone: full_clone?,
|
|
|
|
quiet: ARGV.quieter?
|
2016-04-04 03:18:55 -07:00
|
|
|
rescue TapRemoteMismatchError => e
|
|
|
|
odie e
|
|
|
|
rescue TapAlreadyTappedError, TapAlreadyUnshallowError
|
|
|
|
# Do nothing.
|
2015-11-10 09:12:25 +00:00
|
|
|
end
|
2012-03-02 20:28:54 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-05-30 17:01:36 +01:00
|
|
|
def full_clone?
|
|
|
|
ARGV.include?("--full") || ARGV.homebrew_developer?
|
|
|
|
end
|
|
|
|
|
2015-11-07 16:25:34 +08:00
|
|
|
# @deprecated this method will be removed in the future, if no external commands use it.
|
2015-08-03 13:09:07 +01:00
|
|
|
def install_tap(user, repo, clone_target = nil)
|
2015-11-07 16:25:34 +08:00
|
|
|
opoo "Homebrew.install_tap is deprecated, use Tap#install."
|
|
|
|
tap = Tap.fetch(user, repo)
|
2015-08-28 14:33:00 +08:00
|
|
|
begin
|
2016-09-17 15:32:44 +01:00
|
|
|
tap.install(clone_target: clone_target, full_clone: full_clone?)
|
2015-11-07 16:25:34 +08:00
|
|
|
rescue TapAlreadyTappedError
|
|
|
|
false
|
|
|
|
else
|
|
|
|
true
|
2012-05-14 16:18:24 -06:00
|
|
|
end
|
2012-03-07 22:48:44 +00:00
|
|
|
end
|
2012-03-16 12:49:09 +00:00
|
|
|
end
|