diff options
| author | Adam Vandenberg | 2010-06-17 10:51:45 -0700 |
|---|---|---|
| committer | Adam Vandenberg | 2010-06-17 11:42:24 -0700 |
| commit | db9b20216b2efb9c5a0a5b221d759e56a3a4148d (patch) | |
| tree | 10995207e9bd05c5f8ea858319f9d4536c534821 /Library | |
| parent | 410f63331048bb739ebffa714755f842057562bc (diff) | |
| download | brew-db9b20216b2efb9c5a0a5b221d759e56a3a4148d.tar.bz2 | |
brew server - use search method
Diffstat (limited to 'Library')
| -rwxr-xr-x | Library/Contributions/examples/brew-server | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/Library/Contributions/examples/brew-server b/Library/Contributions/examples/brew-server index 1d461db61..c0d2910b1 100755 --- a/Library/Contributions/examples/brew-server +++ b/Library/Contributions/examples/brew-server @@ -75,16 +75,10 @@ get '/' do end get '/search' do + require 'brew.h' q = params['q'] + results = search_brews(q) - formulae = Formulary.names with_aliases=true - - if q =~ /^\/(.*)\/$/ - results = formulae.grep(Regexp.new($1)) - else - search_term = Regexp.escape(q || "") - results = formulae.grep(/.*#{search_term}.*/) - end s = <<-HTML <html> <head> |
