2012-03-16 12:58:39 +00:00
|
|
|
require 'cmd/tap' # for tap_args
|
2012-03-02 20:28:54 +00:00
|
|
|
|
2014-06-18 22:41:47 -05:00
|
|
|
module Homebrew
|
2012-03-02 20:28:54 +00:00
|
|
|
def untap
|
2013-03-02 06:52:55 -05:00
|
|
|
raise "Usage is `brew untap <tap-name>`" if ARGV.empty?
|
|
|
|
|
2015-02-01 12:11:54 -05:00
|
|
|
ARGV.each do |tapname|
|
|
|
|
user, repo = tap_args(tapname)
|
|
|
|
|
2015-06-02 17:27:05 -04:00
|
|
|
# We consistently downcase in tap to ensure we are not bitten by
|
|
|
|
# case-insensitive filesystem issues, which is the default on mac. The
|
|
|
|
# problem being the filesystem cares, but our regexps don't. So unless we
|
|
|
|
# resolve *every* path we will get bitten.
|
2015-02-01 12:11:54 -05:00
|
|
|
user.downcase!
|
|
|
|
repo.downcase!
|
|
|
|
|
|
|
|
tapd = HOMEBREW_LIBRARY/"Taps/#{user}/homebrew-#{repo}"
|
|
|
|
|
|
|
|
raise "No such tap!" unless tapd.directory?
|
2015-04-09 09:00:08 +01:00
|
|
|
puts "Untapping #{tapname}... (#{tapd.abv})"
|
2015-02-01 12:11:54 -05:00
|
|
|
|
|
|
|
files = []
|
|
|
|
tapd.find_formula { |file| files << file }
|
|
|
|
tapd.rmtree
|
|
|
|
tapd.dirname.rmdir_if_possible
|
|
|
|
puts "Untapped #{files.length} formula#{plural(files.length, 'e')}"
|
|
|
|
end
|
2012-03-18 00:40:41 +00:00
|
|
|
end
|
2012-03-02 20:28:54 +00:00
|
|
|
end
|