Sha256: a1475887c34fe6a8511ec0657cb2c4dec869a28beee0e51c1d7cba6118fecaf7
Contents?: true
Size: 739 Bytes
Versions: 4
Compression:
Stored size: 739 Bytes
Contents
module BigBrother class App < Sinatra::Base register Sinatra::Synchrony get "/" do BigBrother.clusters.map do |name, cluster| "#{cluster}: #{cluster.monitored? ? "running" : "not running"}" end.join("\n") + "\n" end before "/cluster/:name" do |name| @cluster = BigBrother.clusters[name] halt 404, "Cluster #{name} not found" if @cluster.nil? end get "/cluster/:name" do |name| [200, "Running: #{@cluster.monitored?}"] end put "/cluster/:name" do |name| halt 304 if @cluster.monitored? @cluster.start_monitoring! end delete "/cluster/:name" do |name| halt 304 unless @cluster.monitored? @cluster.stop_monitoring! end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
big_brother-0.3.0 | lib/big_brother/app.rb |
big_brother-0.2.1 | lib/big_brother/app.rb |
big_brother-0.2.0 | lib/big_brother/app.rb |
big_brother-0.1.0 | lib/big_brother/app.rb |