lib/big_brother/app.rb in big_brother-0.4.0 vs lib/big_brother/app.rb in big_brother-0.4.1

- old
+ new

@@ -3,14 +3,19 @@ register Sinatra::Synchrony set :raise_errors, false get "/" do - clusters = BigBrother.clusters.map do |name, cluster| - "#{cluster}: #{cluster.monitored? ? "running" : "not running"}" - end.join("\n") + running, stopped = BigBrother.clusters.values.partition(&:monitored?) - [200, "Big Brother: #{BigBrother::VERSION}\n\n#{clusters}\n"] + [200, <<-CONTENT] +Big Brother: #{BigBrother::VERSION} + +Running: +#{running.map { |cluster| "+ #{cluster}\n" }.join} +Stopped: +#{stopped.map { |cluster| "- #{cluster}\n" }.join} + CONTENT end before "/cluster/:name" do |name| @cluster = BigBrother.clusters[name] halt 404, "Cluster #{name} not found" if @cluster.nil?