class Prospector::Background::EnvironmentDetector

Constants

RAILS_SERVERS

Public Instance Methods

rails_server?() click to toggle source
# File lib/prospector/background/environment_detector.rb, line 5
def rails_server?
  RAILS_SERVERS.each do |server_name|
    return true if send("running_#{ server_name }?")
  end

  false
end

Private Instance Methods

running_instance_of?(klass) click to toggle source
# File lib/prospector/background/environment_detector.rb, line 45
def running_instance_of?(klass)
  ObjectSpace.each_object(klass).any?
end
running_passenger?() click to toggle source
# File lib/prospector/background/environment_detector.rb, line 15
def running_passenger?
  defined?(::PhusionPassenger)
end
running_puma?() click to toggle source
# File lib/prospector/background/environment_detector.rb, line 25
def running_puma?
  defined?(::Puma) && File.basename($0) == 'puma'
end
running_rainbows?() click to toggle source
# File lib/prospector/background/environment_detector.rb, line 35
def running_rainbows?
  return false unless defined?(::Rainbows) && defined?(::Rainbows::HttpServer)

  running_instance_of?(::Rainbows::HttpServer)
end
running_thin?() click to toggle source
# File lib/prospector/background/environment_detector.rb, line 29
def running_thin?
  return false unless defined?(::Thin) && defined?(::Thin::Server)

  running_instance_of?(::Thin::HttpServer)
end
running_unicorn?() click to toggle source
# File lib/prospector/background/environment_detector.rb, line 19
def running_unicorn?
  return false unless defined?(::Unicorn) && defined?(::Unicorn::HttpServer)

  running_instance_of?(::Unicorn::HttpServer)
end
running_webrick?() click to toggle source
# File lib/prospector/background/environment_detector.rb, line 41
def running_webrick?
  defined?(::WEBrick) && defined?(::WEBrick::VERSION)
end