Special case Homebrew organization taps
We allow homebrew/dupes for instance, rather than Homebrew/dupes. Because nobody likes shifting in the terminal. In the process of doing this I discovered some case-insensitive filesystem bugs we have avoided before because I had the foresight to mandate lowercase in formula names. GitHub considers Homebrew and homebrew to be different (even though you can't create both). So we had to allow case insensitivity in tap input. I have made it now so the resulting directory however is lowercased, neatly avoiding the issue. And so we also downcase tap arguments when applying them to tap directories or formula.
This commit is contained in:
parent
c346ebd948
commit
ceeb768c84
@ -14,12 +14,17 @@ module Homebrew extend self
|
||||
def install_tap user, repo
|
||||
raise "brew install git" unless system "/usr/bin/which -s git"
|
||||
|
||||
tapd = HOMEBREW_LIBRARY/"Taps/#{user}-#{repo}"
|
||||
# we special case homebrew so users don't have to shift in a terminal
|
||||
repouser = if user == "homebrew" then "Homebrew" else user end
|
||||
user = "homebrew" if user == "Homebrew"
|
||||
|
||||
# we downcase to avoid case-insensitive filesystem issues
|
||||
tapd = HOMEBREW_LIBRARY/"Taps/#{user.downcase}-#{repo.downcase}"
|
||||
raise "Already tapped!" if tapd.directory?
|
||||
abort unless system "git clone https://github.com/#{user}/homebrew-#{repo} #{tapd}"
|
||||
abort unless system "git clone https://github.com/#{repouser}/homebrew-#{repo} #{tapd}"
|
||||
|
||||
files = []
|
||||
tapd.find_formula{ |file| files << Pathname.new("#{user}-#{repo}").join(file) }
|
||||
tapd.find_formula{ |file| files << tapd.basename.join(file) }
|
||||
tapped = link_tap_formula(files)
|
||||
puts "Tapped #{tapped} formula"
|
||||
end
|
||||
|
@ -3,6 +3,14 @@ require 'cmd/tap' # for tap_args
|
||||
module Homebrew extend self
|
||||
def untap
|
||||
user, repo = tap_args
|
||||
|
||||
# we consistently downcase in tap to ensure we are not bitten by case-insensive
|
||||
# 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.
|
||||
user.downcase!
|
||||
repo.downcase!
|
||||
|
||||
tapd = HOMEBREW_LIBRARY/"Taps/#{user}-#{repo}"
|
||||
|
||||
raise "No such tap!" unless tapd.directory?
|
||||
|
Loading…
x
Reference in New Issue
Block a user