diff options
| author | Adam Vandenberg | 2010-08-17 08:28:16 -0700 |
|---|---|---|
| committer | Adam Vandenberg | 2010-08-17 08:28:16 -0700 |
| commit | 3697022faffee6f9bdcc84c5831d64bd4e46e399 (patch) | |
| tree | 7f62e9706a22ef9d87862cd762d65711309d36da /Library | |
| parent | e495d6ab34eefbcfaf5014638a25398c71dc213c (diff) | |
| download | homebrew-3697022faffee6f9bdcc84c5831d64bd4e46e399.tar.bz2 | |
Tweak brew server - fixes #2191
Diffstat (limited to 'Library')
| -rwxr-xr-x | Library/Contributions/examples/brew-server | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/Library/Contributions/examples/brew-server b/Library/Contributions/examples/brew-server index 856baf241..b9919cf7a 100755 --- a/Library/Contributions/examples/brew-server +++ b/Library/Contributions/examples/brew-server @@ -4,16 +4,23 @@ # Note: this external command is ruby, but set up as a shell script, so that it gets exec'd. # This is required for sinatra's run-loop to take over. -puts "View our tasting menu at http://localhost:4567/\nUse \"Control-C\" to exit.\n\n" $:.unshift(ENV['HOMEBREW_LIBRARY_PATH']) +require 'global' +require 'formula' + require 'rubygems' -require 'sinatra' + +begin + require 'sinatra' +rescue LoadError + onoe 'Sinatra required but not found' + puts 'To install: gem install sinatra' + exit 1 +end require 'cgi' -require 'global' -require 'formula' def link_to_formula name "<a href=\"/formula/#{CGI.escape(name)}\">#{name}</a>" @@ -145,7 +152,7 @@ get '/formula/:name' do end used_by = Formula.all.select{|ff| ff.deps.include?(klass.name)}.map{|f| f.name}.flatten.uniq.sort - unless used_by == nil + unless used_by.empty? s << <<-HTML <dt>Used by</td> HTML @@ -164,3 +171,5 @@ get '/formula/:name' do return s end + +puts "View our tasting menu at http://localhost:4567/\nUse \"Control-C\" to exit.\n\n" |
