aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorat@an-ti.eu2011-09-30 16:28:18 +0200
committerAdam Vandenberg2011-09-30 08:02:33 -0700
commit7e30def5242457ea6fc0cd6ad94bb23518d9e5da (patch)
treec00bf10b29edae01b72ddb96296193a3041f6e96
parentfde9d23324a821039d44cc937407b779b79a358f (diff)
downloadhomebrew-7e30def5242457ea6fc0cd6ad94bb23518d9e5da.tar.bz2
List all local installed packages in brew server
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
-rwxr-xr-xLibrary/Contributions/examples/brew-server34
1 files changed, 34 insertions, 0 deletions
diff --git a/Library/Contributions/examples/brew-server b/Library/Contributions/examples/brew-server
index 5e7f80b58..58537d447 100755
--- a/Library/Contributions/examples/brew-server
+++ b/Library/Contributions/examples/brew-server
@@ -50,6 +50,7 @@ def html_page
<div id="header">
<h1><a href="./">Homebrew</a></h1>
<p id="subtitle"><strong>The missing package manager for OS X</strong></p>
+ <p id="installed"><a href="/installed">Show installed packages</a></p>
</div>
<div id="informations">
@@ -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
+ <html>
+ <head>
+ <title>Installed Formulas</title>
+ #{css_style}
+ </head>
+ <body>
+ <h1>Installed Fomulas</h1>
+ <ul>
+ HTML
+
+ installed_formulas.each do |formula|
+ s << "<li>#{link_to_formula(formula.name)}</li>"
+ end
+
+ s += <<-HTML
+ </ul>
+ <div>&larr; <a href="/">Back to menu</a></div>
+ </body>
+ </html>
+ HTML
+
+ return s
+end
+
+
puts "View our tasting menu at http://localhost:4567/\nUse \"Control-C\" to exit.\n\n"