Class: AMQP::Utilities::ServerType

Inherits:
Object
  • Object
show all
Defined in:
lib/amqp/utilities/server_type.rb

Overview

A helper that detects Web server that may be running (if any). Partially derived from Qusion project by Daniel DeLeo.

Class Method Summary collapse

Class Method Details

.detectSymbol

Return a symbol representing Web server that is running (if any).

Possible values are:

  • :thin for Thin
  • :unicorn for Unicorn
  • :passenger for Passenger (Apache mod_rack)
  • :goliath for PostRank’s Goliath
  • :evented_mongrel for Swiftiply’s Evented Mongrel
  • :mongrel for Mongrel
  • :scgi for SCGI
  • :webrick for WEBrick
  • nil: none of the above (the case for non-Web application, for example)


47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/amqp/utilities/server_type.rb', line 47

def self.detect
  if defined?(::PhusionPassenger)
    :passenger
  elsif defined?(::Unicorn)
    :unicorn
  elsif defined?(::Thin)
    :thin
  elsif defined?(::Goliath)
    :goliath
  elsif defined?(::Mongrel) && defined?(::Mongrel::MongrelProtocol)
    :evented_mongrel
  elsif defined?(::Mongrel)
    :mongrel
  elsif defined?(::SCGI)
    :scgi
  elsif defined?(::WEBrick)
    :webrick
  else
    nil
  end # if
end