41 lines
1.1 KiB
Ruby
Raw Normal View History

2015-06-08 18:05:58 +08:00
require "tap"
module Homebrew
2012-03-02 20:28:54 +00:00
def tap
if ARGV.include? "--repair"
Tap.each(&:link_manpages)
elsif ARGV.include? "--list-official"
require "official_taps"
2015-08-21 12:33:33 +08:00
puts OFFICIAL_TAPS.map { |t| "homebrew/#{t}" }
elsif ARGV.include? "--list-pinned"
2015-08-21 12:33:33 +08:00
puts Tap.select(&:pinned?).map(&:name)
elsif ARGV.named.empty?
puts Tap.names
2012-03-02 20:28:54 +00:00
else
tap = Tap.fetch(ARGV.named[0])
2015-11-10 18:33:57 +08:00
begin
tap.install :clone_target => ARGV.named[1],
:full_clone => ARGV.include?("--full"),
:quiet => ARGV.quieter?
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
2015-11-07 16:25:34 +08:00
# @deprecated this method will be removed in the future, if no external commands use it.
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)
begin
2015-11-07 16:25:34 +08:00
tap.install(:clone_target => clone_target, :full_clone => ARGV.include?("--full"))
rescue TapAlreadyTappedError
false
else
true
end
end
2012-03-16 12:49:09 +00:00
end