Permalink
Browse files

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.
  • Loading branch information...
1 parent 087408b commit 41b0e8583d1bf74d944de3783fc34ac71a87ac85 @mxcl mxcl committed Mar 18, 2012
Showing with 16 additions and 3 deletions.
  1. +8 −3 Library/Homebrew/cmd/tap.rb
  2. +8 −0 Library/Homebrew/cmd/untap.rb
@@ -14,12 +14,17 @@ def tap
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 @@
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?

0 comments on commit 41b0e85

Please sign in to comment.