Yield absolute paths from find_formula

This commit is contained in:
Jack Nagel 2014-04-25 18:58:16 -05:00
parent b40a3413e3
commit bdee729a41
5 changed files with 10 additions and 10 deletions

View File

@ -32,8 +32,8 @@ module Homebrew extend self
if tap_dir.directory? if tap_dir.directory?
result = "" result = ""
if query if query
tap_dir.find_formula do |child| tap_dir.find_formula do |file|
basename = child.basename(".rb").to_s basename = file.basename(".rb").to_s
result = basename if basename == query result = basename if basename == query
end end
end end

View File

@ -25,7 +25,7 @@ module Homebrew extend self
abort unless system "git clone https://github.com/#{repouser}/homebrew-#{repo} #{tapd}" abort unless system "git clone https://github.com/#{repouser}/homebrew-#{repo} #{tapd}"
files = [] files = []
tapd.find_formula { |file| files << tapd.join(file) } tapd.find_formula { |file| files << file }
link_tap_formula(files) link_tap_formula(files)
puts "Tapped #{files.length} formula" puts "Tapped #{files.length} formula"
@ -85,7 +85,7 @@ module Homebrew extend self
# check symlinks are all set in each tap # check symlinks are all set in each tap
each_tap do |user, repo| each_tap do |user, repo|
files = [] files = []
repo.find_formula { |file| files << repo.join(file) } repo.find_formula { |file| files << file }
count += link_tap_formula(files) count += link_tap_formula(files)
end end

View File

@ -18,7 +18,7 @@ module Homebrew extend self
raise "No such tap!" unless tapd.directory? raise "No such tap!" unless tapd.directory?
files = [] files = []
tapd.find_formula { |file| files << tapd.join(file) } tapd.find_formula { |file| files << file }
unlink_tap_formula(files) unlink_tap_formula(files)
tapd.rmtree tapd.rmtree
tapd.dirname.rmdir_if_possible tapd.dirname.rmdir_if_possible

View File

@ -321,8 +321,8 @@ class Pathname
def find_formula def find_formula
[self/:Formula, self/:HomebrewFormula, self].each do |d| [self/:Formula, self/:HomebrewFormula, self].each do |d|
if d.exist? if d.exist?
d.children.map{ |child| child.relative_path_from(self) }.each do |pn| d.children.each do |pn|
yield pn if pn.to_s =~ /.rb$/ yield pn if pn.extname == ".rb"
end end
break break
end end

View File

@ -163,9 +163,9 @@ class Formulary
path = tap.join("#{name}.rb") path = tap.join("#{name}.rb")
if tap.directory? if tap.directory?
tap.find_formula do |child| tap.find_formula do |file|
if child.basename(".rb").to_s == name if file.basename(".rb").to_s == name
path = tap.join(child) path = file
end end
end end
end end