Class: Nitro::Mongrel

Inherits:
Object
  • Object
show all
Defined in:
lib/nitro/adapter/mongrel.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.mongrelObject

Returns the value of attribute mongrel.



45
46
47
# File 'lib/nitro/adapter/mongrel.rb', line 45

def mongrel
  @mongrel
end

.mongrel_configObject

Returns the value of attribute mongrel_config.



46
47
48
# File 'lib/nitro/adapter/mongrel.rb', line 46

def mongrel_config
  @mongrel_config
end

Class Method Details

.initialize_mongrel(server) ⇒ Object

Override this method to perform customized mongrel initialization.



75
76
# File 'lib/nitro/adapter/mongrel.rb', line 75

def initialize_mongrel(server)
end

.start(server) ⇒ Object

Start the Mongrel adapter.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/nitro/adapter/mongrel.rb', line 50

def start(server)
  # TODO add logging.
  
  @mongrel_config = ::Mongrel::Configurator.new :host => server.address do
      listener :port => server.port do
        uri "/", :handler => MongrelAdapter.new(server)
        trap('INT') { Nitro::Mongrel.stop(server) }
        run
      end
  end
  
  @mongrel_config.log("Started Mongrel on " + server.address + ":" + server.port.to_s)
  @mongrel_config.join
end

.stop(server = nil) ⇒ Object

Stop the Mongrel adapter.



67
68
69
70
# File 'lib/nitro/adapter/mongrel.rb', line 67

def stop(server = nil)
  @mongrel_config.log("Stopped Mongrel on " + server.address + ":" + server.port.to_s)
  @mongrel_config.stop
end