Generalise the untap step so we can add to update
brew-update needs to be able to unsymlink removed stuff from taps too.
This commit is contained in:
parent
21bddc7972
commit
d388c43863
@ -7,22 +7,31 @@ module Homebrew extend self
|
|||||||
|
|
||||||
raise "No such tap!" unless tapd.directory?
|
raise "No such tap!" unless tapd.directory?
|
||||||
|
|
||||||
gitignores = (HOMEBREW_LIBRARY/"Formula/.gitignore").read.split rescue []
|
files = []
|
||||||
untapped = 0
|
tapd.find_formula{ |file| files << Pathname.new("#{user}-#{repo}").join(file) }
|
||||||
|
untapped = unlink_tap_formula(files)
|
||||||
|
rm_rf tapd
|
||||||
|
puts "Untapped #{untapped} formula"
|
||||||
|
end
|
||||||
|
|
||||||
tapd.find_formula do |pn|
|
def unlink_tap_formula formulae
|
||||||
bn = pn.basename.to_s
|
untapped = 0
|
||||||
|
gitignores = (HOMEBREW_LIBRARY/"Formula/.gitignore").read.split rescue []
|
||||||
|
|
||||||
|
formulae.each do |formula|
|
||||||
|
tapd = (HOMEBREW_LIBRARY/"Taps/#{formula}").dirname
|
||||||
|
bn = formula.basename.to_s
|
||||||
pn = HOMEBREW_LIBRARY/"Formula/#{bn}"
|
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
|
pn.delete
|
||||||
gitignores.delete(bn)
|
gitignores.delete(bn)
|
||||||
untapped += 1
|
untapped += 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rm_rf tapd
|
|
||||||
|
|
||||||
HOMEBREW_REPOSITORY.join("Library/Formula/.gitignore").atomic_write(gitignores * "\n")
|
HOMEBREW_REPOSITORY.join("Library/Formula/.gitignore").atomic_write(gitignores * "\n")
|
||||||
|
|
||||||
puts "Untapped #{untapped} formula"
|
untapped
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user