class Souffle::Server

The souffle server and management daemon.

Public Class Methods

new() click to toggle source

Creates a new souffle server.

# File lib/souffle/server.rb, line 10
def initialize
end

Public Instance Methods

rack_options() click to toggle source

Gets the rack options from the configuration.

@return [ Hash ] The rack options from Souffle::Config.

# File lib/souffle/server.rb, line 25
def rack_options
  opts = Hash.new
  Souffle::Config.configuration.each do |k,v|
    if /^rack/ =~ k.to_s
      param = k.to_s.gsub('rack_', '')

      case param
      when "environment"
        opts[param.to_sym] = v
      else
        opts[param.capitalize.to_sym] = v
      end
    end
  end
  opts
end
run() click to toggle source

Runs the server.

# File lib/souffle/server.rb, line 14
def run
  if Souffle::Config[:server]
    run_server
  else
    run_instance
  end
end
run_instance() click to toggle source

Starts a single instance of the provisioner.

# File lib/souffle/server.rb, line 56
def run_instance
  Souffle::Log.info "Single instance runs are not currently implemented..."
  # system = Souffle::System.from_hash(data)
  # provider = Souffle::Provider.plugin(system.try_opt(:provider)).new
  # system_tag = provider.create_system(system)
end
run_server() click to toggle source

Starts a long-running webserver that continuously handles requests.

# File lib/souffle/server.rb, line 43
def run_server
  EM.synchrony do
    @app = Rack::Builder.new do
      use Rack::Lint
      use Rack::ShowExceptions
      run Rack::Cascade.new([Souffle::Http])
    end.to_app

    Rack::Handler.get(:thin).run(@app, rack_options)
  end
end