Sha256: 4e336ad8f0246c9bdad85be35008982edc872d9a17ea5176a3c78a646a7f5d7d

Contents?: true

Size: 630 Bytes

Versions: 6

Compression:

Stored size: 630 Bytes

Contents

module Houston

  [:web_server, :script, :websocket_server].each do |process_type|
    module_eval <<-RUBY, __FILE__, __LINE__ + 1
    def self.running_as_#{process_type}?
      running_as == :#{process_type}
    end
    RUBY
  end

  def self.server?
    Houston.deprecation_notice "Houston.server? is deprecated; use Houston.running_as_web_server?"
    running_as_web_server?
  end

  def self.running_as
    @__process_type ||= discover_process_type
  end

private

  def self.discover_process_type
    return $HOUSTON_PROCESS_TYPE if $HOUSTON_PROCESS_TYPE
    return :web_server if $WEB_SERVER == :rack
    :script
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
houston-core-0.8.4 lib/houston/boot/running_as.rb
houston-core-0.8.3 lib/houston/boot/running_as.rb
houston-core-0.8.2 lib/houston/boot/running_as.rb
houston-core-0.8.1 lib/houston/boot/running_as.rb
houston-core-0.8.0 lib/houston/boot/running_as.rb
houston-core-0.8.0.pre2 lib/houston/boot/running_as.rb