diff options
Diffstat (limited to 'Library/Homebrew/cmd/tap.rb')
| -rw-r--r-- | Library/Homebrew/cmd/tap.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb index e1f53db8b..a311af7f0 100644 --- a/Library/Homebrew/cmd/tap.rb +++ b/Library/Homebrew/cmd/tap.rb @@ -1,3 +1,5 @@ +require 'tempfile' + HOMEBREW_LIBRARY = HOMEBREW_REPOSITORY/"Library" module Homebrew extend self @@ -19,12 +21,23 @@ module Homebrew extend self raise "Already tapped!" if tapd.directory? abort unless system "git clone https://github.com/#{user}/homebrew-#{repo} #{tapd}" + gitignores = (HOMEBREW_LIBRARY/"Formula/.gitignore").read.split rescue [] + cd HOMEBREW_LIBRARY/"Formula" tapd.find_formula do |relative_pathname| # using the system ln is the only way to get relative symlinks system "ln -s ../Taps/#{user}-#{repo}/#{relative_pathname} 2>/dev/null" - opoo "#{relative_pathname.basename(".rb")} conflicts" unless $?.success? + if $?.success? + gitignores << relative_pathname.basename.to_s + else + opoo "#{relative_pathname.basename, ".rb"} conflicts" + end end + + tf = Tempfile.new("brew-tap") + tf.write(gitignores.uniq.join("\n")) + tf.close + mv tf.path, "#{HOMEBREW_PREFIX}/Library/Formula/.gitignore" end private |
