Sha256: ed5a6b2d39d0a3e718129edfc3cd7148f48abc49ef1bf319499399dbb8458310

Contents?: true

Size: 547 Bytes

Versions: 17

Compression:

Stored size: 547 Bytes

Contents

module Houston

  def self.server?
    !!server
  end

  def self.server
    @server ||= discover_server
  end

private

  def self.discover_server
    if defined?(::PhusionPassenger)
      :passenger
    elsif defined?(::Unicorn) && defined?(::Unicorn::HttpServer) && in_object_space?(::Unicorn::HttpServer)
      :unicorn
    else
      $WEB_SERVER
    end
  end

  def self.in_object_space?(klass)
    ObjectSpace.each_object(klass).any?
  end

end

if Houston.server?
  puts "\e[94mRunning as a #{Houston.server.inspect} application\e[0m"
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
houston-core-0.8.0.pre lib/houston/boot/server.rb
houston-core-0.7.0 lib/houston/boot/server.rb
houston-core-0.7.0.beta4 lib/houston/boot/server.rb
houston-core-0.7.0.beta3 lib/houston/boot/server.rb
houston-core-0.7.0.beta2 lib/houston/boot/server.rb
houston-core-0.7.0.beta lib/houston_server.rb
houston-core-0.6.3 lib/houston_server.rb
houston-core-0.6.2 lib/houston_server.rb
houston-core-0.6.1 lib/houston_server.rb
houston-core-0.6.0 lib/houston_server.rb
houston-core-0.5.6 lib/houston_server.rb
houston-core-0.5.5 lib/houston_server.rb
houston-core-0.5.4 lib/houston_server.rb
houston-core-0.5.3 lib/houston_server.rb
houston-core-0.5.2 lib/houston_server.rb
houston-core-0.5.1 lib/houston_server.rb
houston-core-0.5.0 lib/houston_server.rb