From 4cf74bc9723216b1847936dc72f99d4fe5926ad9 Mon Sep 17 00:00:00 2001 From: "at@an-ti.eu" Date: Fri, 30 Sep 2011 16:28:18 +0200 Subject: [PATCH] List all local installed packages in brew server Signed-off-by: Adam Vandenberg --- Library/Contributions/examples/brew-server | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/Library/Contributions/examples/brew-server b/Library/Contributions/examples/brew-server index 5e7f80b58d..58537d447c 100755 --- a/Library/Contributions/examples/brew-server +++ b/Library/Contributions/examples/brew-server @@ -50,6 +50,7 @@ def html_page
@@ -171,4 +172,37 @@ get '/formula/:name' do return s end + +def installed_formulas + Formula.all.select{|formula| formula.installed?} +end + +get '/installed' do + + s = <<-HTML + + + Installed Formulas + #{css_style} + + +

Installed Fomulas

+
    + HTML + + installed_formulas.each do |formula| + s << "
  • #{link_to_formula(formula.name)}
  • " + end + + s += <<-HTML +
+
Back to menu
+ + + HTML + + return s +end + + puts "View our tasting menu at http://localhost:4567/\nUse \"Control-C\" to exit.\n\n"