diff options
| author | Max Howell | 2012-03-18 00:40:41 +0000 |
|---|---|---|
| committer | Max Howell | 2012-03-18 01:14:00 +0000 |
| commit | d388c4386335390d1c57dc1f9857bbf373781f18 (patch) | |
| tree | 6ceeba91a213bed82051211b1663e30dbb8d61e3 /Library | |
| parent | 21bddc7972c4c7936bc02ee45378600f180bdbaa (diff) | |
| download | brew-d388c4386335390d1c57dc1f9857bbf373781f18.tar.bz2 | |
Generalise the untap step so we can add to update
brew-update needs to be able to unsymlink removed stuff from taps too.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/untap.rb | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/Library/Homebrew/cmd/untap.rb b/Library/Homebrew/cmd/untap.rb index 892229df4..577a59a12 100644 --- a/Library/Homebrew/cmd/untap.rb +++ b/Library/Homebrew/cmd/untap.rb @@ -7,22 +7,31 @@ module Homebrew extend self raise "No such tap!" unless tapd.directory? - gitignores = (HOMEBREW_LIBRARY/"Formula/.gitignore").read.split rescue [] + files = [] + tapd.find_formula{ |file| files << Pathname.new("#{user}-#{repo}").join(file) } + untapped = unlink_tap_formula(files) + rm_rf tapd + puts "Untapped #{untapped} formula" + end + + def unlink_tap_formula formulae untapped = 0 + gitignores = (HOMEBREW_LIBRARY/"Formula/.gitignore").read.split rescue [] - tapd.find_formula do |pn| - bn = pn.basename.to_s + formulae.each do |formula| + tapd = (HOMEBREW_LIBRARY/"Taps/#{formula}").dirname + bn = formula.basename.to_s pn = HOMEBREW_LIBRARY/"Formula/#{bn}" - if pn.symlink? and pn.realpath.to_s =~ %r[^#{tapd.realpath}] + + if pn.symlink? and pn.realpath.to_s =~ %r[^#{tapd}] pn.delete gitignores.delete(bn) untapped += 1 end end - rm_rf tapd HOMEBREW_REPOSITORY.join("Library/Formula/.gitignore").atomic_write(gitignores * "\n") - puts "Untapped #{untapped} formula" + untapped end end |
