aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/search.rb27
1 files changed, 26 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb
index 50ed36b3d..4b8226410 100644
--- a/Library/Homebrew/cmd/search.rb
+++ b/Library/Homebrew/cmd/search.rb
@@ -28,13 +28,38 @@ module Homebrew extend self
puts msg
end
- if search_results.empty? and not blacklisted? query
+ $found = search_results.length
+ puts_columns search_tap "adamv", "alt", rx
+ puts_columns search_tap "josegonzalez", "php", rx
+
+ if $found == 0 and not blacklisted? query
puts "No formula found for \"#{query}\". Searching open pull requests..."
GitHub.find_pull_requests(rx) { |pull| puts pull }
end
end
end
+ def search_tap user, repo, rx
+ return [] if (HOMEBREW_LIBRARY/"Taps/#{user}-#{repo}").directory?
+
+ require 'open-uri'
+ require 'yaml'
+
+ results = []
+ open "http://github.com/api/v2/yaml/blob/all/#{user}/homebrew-#{repo}/master" do |f|
+ YAML::load(f.read)["blobs"].each do |file, _|
+ name = File.basename(file, '.rb')
+ if file =~ /\.rb$/ and name =~ rx
+ results << "#{user}/#{repo}/#{name}"
+ $found += 1
+ end
+ end
+ end
+ results
+ rescue
+ []
+ end
+
def search_brews rx
if rx.to_s.empty?
Formula.names