Class: Merb::Rack::Thin

Inherits:
AbstractAdapter show all
Defined in:
lib/merb-core/rack/adapter/thin.rb

Direct Known Subclasses

ThinTurbo

Class Method Summary collapse

Methods inherited from AbstractAdapter

exit_process, process_title, spawn_worker, start, start_at_port

Class Method Details

.new_server(port) ⇒ Object

:api: plugin



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/merb-core/rack/adapter/thin.rb', line 11

def self.new_server(port)
  Merb::Dispatcher.use_mutex = false
  
  if (@opts[:socket] || @opts[:socket_file])
    socket = port.to_s
    socket_file = @opts[:socket_file] || "#{Merb.log_path}/#{Merb::Config[:name]}.%s.sock"
    socket_file = socket_file % port
    Merb.logger.warn!("Using Thin adapter with socket file #{socket_file}.")
    @server = ::Thin::Server.new(socket_file, @opts[:app], @opts)
  else
    Merb.logger.warn!("Using Thin adapter on host #{@opts[:host]} and port #{port}.")
    @opts[:host] = "#{@opts[:host]}-#{port}" if @opts[:host].include?('/')
    @server = ::Thin::Server.new(@opts[:host], port, @opts[:app], @opts)
  end
end

.start_serverObject

:api: plugin



28
29
30
31
# File 'lib/merb-core/rack/adapter/thin.rb', line 28

def self.start_server
  ::Thin::Logging.silent = true
  @server.start
end

.stop(status = 0) ⇒ Object

:api: plugin



34
35
36
37
38
39
# File 'lib/merb-core/rack/adapter/thin.rb', line 34

def self.stop(status = 0)
  if @server
    @server.stop
    true
  end
end