Sha256: e065bf71ea504b6712b8c5454f3908077d111b823553358a946d329630ed22ca

Contents?: true

Size: 543 Bytes

Versions: 3

Compression:

Stored size: 543 Bytes

Contents

require 'erb'
require 'array'
require 'ruby-debug'
require 'sinatra/base'

class MasterApp < Sinatra::Base
  def initialize(demo_server)
    @demo_server = demo_server
  end

  set :views, File.join(File.dirname(__FILE__), 'views')

  get '/disconnect' do
    @demo_server.disconnect_ip params[:ip], params[:port]
    redirect '/status'
  end

  get '/status' do
    erb :status
  end

  get '/debug' do
    debugger
  end

  get '/' do
    @roles = @demo_server.pick_servers

    halt(503) unless @roles['content']

    erb :master
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
distributed_demo-1.0.2 lib/master_app.rb
distributed_demo-1.0.1 lib/master_app.rb
distributed_demo-1.0 lib/master_app.rb