Module | PhusionPassenger

In:

lib/phusion_passenger.rb
lib/phusion_passenger/abstract_installer.rb
lib/phusion_passenger/abstract_request_handler.rb
lib/phusion_passenger/abstract_server.rb
lib/phusion_passenger/abstract_server_collection.rb
lib/phusion_passenger/admin_tools/memory_stats.rb
lib/phusion_passenger/admin_tools/server_instance.rb
lib/phusion_passenger/admin_tools.rb
lib/phusion_passenger/analytics_logger.rb
lib/phusion_passenger/app_process.rb
lib/phusion_passenger/classic_rails/application_spawner.rb
lib/phusion_passenger/classic_rails/cgi_fixed.rb
lib/phusion_passenger/classic_rails/framework_spawner.rb
lib/phusion_passenger/classic_rails/request_handler.rb
lib/phusion_passenger/classic_rails_extensions/analytics_logging/ac_base_extension.rb
lib/phusion_passenger/classic_rails_extensions/analytics_logging/ac_benchmarking_extension.rb
lib/phusion_passenger/classic_rails_extensions/analytics_logging/ac_rescue_extension.rb
lib/phusion_passenger/classic_rails_extensions/analytics_logging/ar_abstract_adapter_extension.rb
lib/phusion_passenger/classic_rails_extensions/analytics_logging/as_cache_extension.rb
lib/phusion_passenger/classic_rails_extensions/analytics_logging/av_benchmark_helper_extension.rb
lib/phusion_passenger/classic_rails_extensions/init.rb
lib/phusion_passenger/console_text_template.rb
lib/phusion_passenger/constants.rb
lib/phusion_passenger/debug_logging.rb
lib/phusion_passenger/dependencies.rb
lib/phusion_passenger/exceptions.rb
lib/phusion_passenger/html_template.rb
lib/phusion_passenger/message_channel.rb
lib/phusion_passenger/message_client.rb
lib/phusion_passenger/native_support.rb
lib/phusion_passenger/packaging.rb
lib/phusion_passenger/platform_info/apache.rb
lib/phusion_passenger/platform_info/binary_compatibility.rb
lib/phusion_passenger/platform_info/compiler.rb
lib/phusion_passenger/platform_info/curl.rb
lib/phusion_passenger/platform_info/documentation_tools.rb
lib/phusion_passenger/platform_info/linux.rb
lib/phusion_passenger/platform_info/operating_system.rb
lib/phusion_passenger/platform_info/ruby.rb
lib/phusion_passenger/platform_info/zlib.rb
lib/phusion_passenger/platform_info.rb
lib/phusion_passenger/plugin.rb
lib/phusion_passenger/public_api.rb
lib/phusion_passenger/rack/application_spawner.rb
lib/phusion_passenger/rack/request_handler.rb
lib/phusion_passenger/rails3_extensions/init.rb
lib/phusion_passenger/spawn_manager.rb
lib/phusion_passenger/standalone/app_finder.rb
lib/phusion_passenger/standalone/command.rb
lib/phusion_passenger/standalone/config_file.rb
lib/phusion_passenger/standalone/help_command.rb
lib/phusion_passenger/standalone/main.rb
lib/phusion_passenger/standalone/package_runtime_command.rb
lib/phusion_passenger/standalone/runtime_installer.rb
lib/phusion_passenger/standalone/start_command.rb
lib/phusion_passenger/standalone/status_command.rb
lib/phusion_passenger/standalone/stop_command.rb
lib/phusion_passenger/standalone/utils.rb
lib/phusion_passenger/standalone/version_command.rb
lib/phusion_passenger/utils/file_system_watcher.rb
lib/phusion_passenger/utils/hosts_file_parser.rb
lib/phusion_passenger/utils/rewindable_input.rb
lib/phusion_passenger/utils/tmpdir.rb
lib/phusion_passenger/utils/unseekable_socket.rb
lib/phusion_passenger/utils.rb
lib/phusion_passenger/wsgi/application_spawner.rb

Phusion Passenger - www.modrails.com/ Copyright (c) 2010 Phusion

"Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

### Methods

benchmark call_event install_framework_extensions! log_cache_hit log_cache_miss natively_packaged? on_event

### Classes and Modules

Module PhusionPassenger::AdminTools
Module PhusionPassenger::ClassicRails
Module PhusionPassenger::ClassicRailsExtensions
Module PhusionPassenger::DebugLogging
Module PhusionPassenger::Packaging
Module PhusionPassenger::PlatformInfo
Module PhusionPassenger::Rack
Module PhusionPassenger::Rails3Extensions
Module PhusionPassenger::Standalone
Module PhusionPassenger::Utils
Module PhusionPassenger::WSGI
Class PhusionPassenger::AbstractInstaller
Class PhusionPassenger::AbstractRequestHandler
Class PhusionPassenger::AbstractServer
Class PhusionPassenger::AbstractServerCollection
Class PhusionPassenger::AnalyticsLogger
Class PhusionPassenger::AppInitError
Class PhusionPassenger::AppProcess
Class PhusionPassenger::ConsoleTextTemplate
Class PhusionPassenger::FrameworkInitError
Class PhusionPassenger::HTMLTemplate
Class PhusionPassenger::InitializationError
Class PhusionPassenger::InvalidPath
Class PhusionPassenger::MessageChannel
Class PhusionPassenger::MessageClient
Class PhusionPassenger::NativeSupportLoader
Class PhusionPassenger::Plugin
Class PhusionPassenger::SpawnManager
Class PhusionPassenger::UnknownError
Class PhusionPassenger::VersionNotFound

### Constants

VERSION_STRING | = | '3.0.2' |  | Phusion Passenger version number. Don‘t forget to edit ext/common/Constants.h too.
PREFERRED_NGINX_VERSION | = | '0.8.53'
PREFERRED_PCRE_VERSION | = | '8.10'
STANDALONE_INTERFACE_VERSION | = | 1
NATIVELY_PACKAGED_SOURCE_ROOT | = | "/usr/share/phusion-passenger/source"
NATIVELY_PACKAGED_DOCDIR | = | "/usr/share/doc/phusion-passenger"
NATIVELY_PACKAGED_RESOURCES_DIR | = | "/usr/share/phusion-passenger"
NATIVELY_PACKAGED_AGENTS_DIR | = | "/usr/lib/phusion-passenger/agents"
NATIVELY_PACKAGED_HELPER_SCRIPTS_DIR | = | "/usr/share/phusion-passenger/helper-scripts"
NATIVELY_PACKAGED_APACHE2_MODULE | = | "/usr/lib/apache2/modules/mod_passenger.so"
LIBDIR | = | File.expand_path(File.dirname(__FILE__)) |  | Directory containing the Phusion Passenger Ruby libraries.
TEMPLATES_DIR | = | File.join(LIBDIR, "phusion_passenger", "templates") |  | Directory containing templates.
LOCAL_DIR | = | ".passenger" |  | Subdirectory under $HOME to use for storing resource files.
PLUGIN_DIRS | = | ["/usr/share/phusion-passenger/plugins", "/usr/local/share/phusion-passenger/plugins", "~/#{LOCAL_DIR}/plugins"] |  | Directories in which to look for plugins.
LOCAL_STANDALONE_RESOURCE_DIR | = | File.join(LOCAL_DIR, "standalone") |  | Directory under $HOME for storing Phusion Passenger Standalone resource files.
GLOBAL_STANDALONE_RESOURCE_DIR | = | "/var/lib/passenger-standalone" |  | System-wide directory for storing Phusion Passenger Standalone resource files.
SOURCE_ROOT | = | File.expand_path(File.join(LIBDIR, "..")) |  | Top directory of the Phusion Passenger source code.
DOCDIR | = | File.join(SOURCE_ROOT, "doc") |  | Documentation directory.
RESOURCES_DIR | = | File.join(SOURCE_ROOT, "resources") |  | Directory containing Phusion Passenger resource files.
AGENTS_DIR | = | File.join(SOURCE_ROOT, "agents")
HELPER_SCRIPTS_DIR | = | File.join(SOURCE_ROOT, "helper-scripts")
APACHE2_MODULE | = | File.join(SOURCE_ROOT, "ext", "apache2", "mod_passenger.so") |  | Location of the Apache 2 module.
NATIVE_SUPPORT_DIR | = | File.join(SOURCE_ROOT, "ext", "ruby") |  | Directory possibly containing #{archdir}/passenger_native_support.so. Not available when natively packaged.
SOURCE_ROOT | = | NATIVELY_PACKAGED_SOURCE_ROOT
DOCDIR | = | NATIVELY_PACKAGED_DOCDIR
RESOURCES_DIR | = | NATIVELY_PACKAGED_RESOURCES_DIR
AGENTS_DIR | = | NATIVELY_PACKAGED_AGENTS_DIR
HELPER_SCRIPTS_DIR | = | NATIVELY_PACKAGED_HELPER_SCRIPTS_DIR
APACHE2_MODULE | = | NATIVELY_PACKAGED_APACHE2_MODULE
STANDALONE_BINARIES_URL_ROOT | = | "http://standalone-binaries.modrails.com" |  | Other resource locations ######
DEFAULT_FRAMEWORK_SPAWNER_MAX_IDLE_TIME | = | 30 * 60
DEFAULT_APP_SPAWNER_MAX_IDLE_TIME | = | 10 * 60
ROOT_UID | = | 0
ROOT_GID | = | 0
PASSENGER_ANALYTICS_WEB_LOG | = | "PASSENGER_ANALYTICS_WEB_LOG"
PASSENGER_TXN_ID | = | "PASSENGER_TXN_ID"
PASSENGER_GROUP_NAME | = | "PASSENGER_GROUP_NAME"
PASSENGER_UNION_STATION_KEY | = | "PASSENGER_UNION_STATION_KEY"

### Attributes

_spawn_options | [RW] | Set during spawning, and set back to nil when spawning is done.

### Public Class methods

benchmark(env = nil, title = "Benchmarking") {|| ...}

[Source]

        # File lib/phusion_passenger/public_api.rb, line 52
    52:         def benchmark(env = nil, title = "Benchmarking")
    53:                 log = lookup_analytics_log(env)
    54:                 if log
    55:                         log.measure("BENCHMARK: #{title}") do
    56:                                 yield
    57:                         end
    58:                 else
    59:                         yield
    60:                 end
    61:         end

call_event(name, *args)

[Source]

        # File lib/phusion_passenger/public_api.rb, line 38
    38:         def call_event(name, *args)
    39:                 callback_list_for_event(name).each do |callback|
    40:                         callback.call(*args)
    41:                 end
    42:         end

install_framework_extensions!(*args)

[Source]

        # File lib/phusion_passenger/public_api.rb, line 44
    44:         def install_framework_extensions!(*args)
    45:                 require 'rails/version' if defined?(::Rails) && !defined?(::Rails::VERSION)
    46:                 if defined?(::Rails) && ::Rails::VERSION::MAJOR == 3
    47:                         require 'phusion_passenger/rails3_extensions/init'
    48:                         Rails3Extensions.init!(_spawn_options, *args)
    49:                 end
    50:         end

log_cache_hit(env, name)

[Source]

        # File lib/phusion_passenger/public_api.rb, line 63
    63:         def log_cache_hit(env, name)
    64:                 log = lookup_analytics_log(env)
    65:                 if log
    66:                         log.message("Cache hit: #{name}")
    67:                         return true
    68:                 else
    69:                         return false
    70:                 end
    71:         end

log_cache_miss(env, name, generation_time = nil)

[Source]

        # File lib/phusion_passenger/public_api.rb, line 73
    73:         def log_cache_miss(env, name, generation_time = nil)
    74:                 log = lookup_analytics_log(env)
    75:                 if log
    76:                         if generation_time
    77:                                 log.message("Cache miss (#{generation_time.to_i}): #{name}")
    78:                         else
    79:                                 log.message("Cache miss: #{name}")
    80:                         end
    81:                         return true
    82:                 else
    83:                         return false
    84:                 end
    85:         end

natively_packaged?()

Returns whether this Phusion Passenger installation is packaged using the OS‘s native package management system, i.e. as opposed to being installed from source or with RubyGems.

[Source]

        # File lib/phusion_passenger.rb, line 41
    41:         def self.natively_packaged?
    42:                 if !defined?(@natively_packaged)
    43:                         @natively_packaged = !File.exist?("#{LIBDIR}/../Rakefile") ||
    44:                                              !File.exist?("#{LIBDIR}/../DEVELOPERS.TXT")
    45:                 end
    46:                 return @natively_packaged
    47:         end

on_event(name, &block)

[Source]

        # File lib/phusion_passenger/public_api.rb, line 34
    34:         def on_event(name, &block)
    35:                 callback_list_for_event(name) << block
    36:         end

[Validate]