### Home Classes Methods

### In Files

- lib/phusion_passenger/standalone/runtime_locator.rb

### Parent

Object

### Methods

- ::looks_like_support_dir?
- ::new
- #everything_installed?
- #find_agents_dir
- #find_lib_dir
- #find_nginx_binary
- #find_support_dir
- #install_targets
- #nginx_binary_install_destination
- #reload
- #support_dir_install_destination

### Class/Module Index

Quicksearch

- PhusionPassenger
- PhusionPassenger::AbstractInstaller
- PhusionPassenger::AbstractInstaller::Abort
- PhusionPassenger::AbstractInstaller::CommandError
- PhusionPassenger::AdminTools
- PhusionPassenger::AdminTools::MemoryStats
- PhusionPassenger::AdminTools::MemoryStats::Process
- PhusionPassenger::AdminTools::ServerInstance
- PhusionPassenger::AdminTools::ServerInstance::CorruptedDirectoryError
- PhusionPassenger::AdminTools::ServerInstance::GenerationsAbsentError
- PhusionPassenger::AdminTools::ServerInstance::Group
- PhusionPassenger::AdminTools::ServerInstance::Process
- PhusionPassenger::AdminTools::ServerInstance::RoleDeniedError
- PhusionPassenger::AdminTools::ServerInstance::StaleDirectoryError
- PhusionPassenger::AdminTools::ServerInstance::Stats
- PhusionPassenger::AdminTools::ServerInstance::UnsupportedGenerationStructureVersionError
- PhusionPassenger::AnalyticsLogger
- PhusionPassenger::AnalyticsLogger::Connection
- PhusionPassenger::AnalyticsLogger::Lock
- PhusionPassenger::AnalyticsLogger::Log
- PhusionPassenger::ClassicRails
- PhusionPassenger::ClassicRails::CGIFixed
- PhusionPassenger::ClassicRails::ThreadHandlerExtension
- PhusionPassenger::ConsoleTextTemplate
- PhusionPassenger::DebugLogging
- PhusionPassenger::LoaderSharedHelpers
- PhusionPassenger::MessageChannel
- PhusionPassenger::MessageChannel::InvalidHashError
- PhusionPassenger::MessageClient
- PhusionPassenger::NativeSupportLoader
- PhusionPassenger::Packaging
- PhusionPassenger::PlatformInfo
- PhusionPassenger::PlatformInfo::ApacheDetector
- PhusionPassenger::PlatformInfo::ApacheDetector::Result
- PhusionPassenger::PlatformInfo::Depcheck
- PhusionPassenger::PlatformInfo::Depcheck::ConsoleRunner
- PhusionPassenger::PlatformInfo::Depcheck::Dependency
- PhusionPassenger::PlatformInfo::RuntimeError
- PhusionPassenger::Plugin
- PhusionPassenger::PreloaderSharedHelpers
- PhusionPassenger::Rack
- PhusionPassenger::Rack::OutOfBandGc
- PhusionPassenger::Rack::ThreadHandlerExtension
- PhusionPassenger::Rails3Extensions
- PhusionPassenger::Rails3Extensions::AnalyticsLogging
- PhusionPassenger::Rails3Extensions::AnalyticsLogging::ACExtension
- PhusionPassenger::Rails3Extensions::AnalyticsLogging::ASBenchmarkableExtension
- PhusionPassenger::Rails3Extensions::AnalyticsLogging::ExceptionLogger
- PhusionPassenger::RequestHandler
- PhusionPassenger::RequestHandler::ThreadHandler
- PhusionPassenger::RequestHandler::ThreadHandler::Interrupted
- PhusionPassenger::SharedConstants
- PhusionPassenger::Standalone
- PhusionPassenger::Standalone::AppFinder
- PhusionPassenger::Standalone::Command
- PhusionPassenger::Standalone::ConfigFile
- PhusionPassenger::Standalone::ConfigFile::DisallowedContextError
- PhusionPassenger::Standalone::HelpCommand
- PhusionPassenger::Standalone::Main
- PhusionPassenger::Standalone::PackageRuntimeCommand
- PhusionPassenger::Standalone::RuntimeInstaller
- PhusionPassenger::Standalone::RuntimeLocator
- PhusionPassenger::Standalone::StartCommand
- PhusionPassenger::Standalone::StatusCommand
- PhusionPassenger::Standalone::StopCommand
- PhusionPassenger::Standalone::Utils
- PhusionPassenger::Standalone::VersionCommand
- PhusionPassenger::Utils
- PhusionPassenger::Utils::AnsiColors
- PhusionPassenger::Utils::FileSystemWatcher
- PhusionPassenger::Utils::FileSystemWatcher::DirInfo
- PhusionPassenger::Utils::FileSystemWatcher::FileInfo
- PhusionPassenger::Utils::GeneratorTest
- PhusionPassenger::Utils::HostsFileParser
- PhusionPassenger::Utils::JSON
- PhusionPassenger::Utils::JSON::Generator
- PhusionPassenger::Utils::ParserTest
- PhusionPassenger::Utils::TeeInput
- PhusionPassenger::Utils::TmpIO
- PhusionPassenger::Utils::UnseekableSocket
- CommonLibraryBuilder
- Exception
- GC
- IO
- Object
- Signal

No matching classes.

# PhusionPassenger::Standalone::RuntimeLocator

Helper class for locating runtime files used by Passenger Standalone.

### Attributes

runtime_dir[R]

### Public Class Methods

looks_like_support_dir?(dir) click to toggle source

    # File lib/phusion_passenger/standalone/runtime_locator.rb, line 40
    def self.looks_like_support_dir?(dir)
            File.exist?("#{dir}/agents/PassengerWatchdog") &&
                    File.exist?("#{dir}/common/libboost_oxt.a") &&
                    File.exist?("#{dir}/common/libpassenger_common/ApplicationPool2/Implementation.o")
    end

new(runtime_dir, nginx_version = PhusionPassenger::PREFERRED_NGINX_VERSION) click to toggle source

    # File lib/phusion_passenger/standalone/runtime_locator.rb, line 35
    def initialize(runtime_dir, nginx_version = PhusionPassenger::PREFERRED_NGINX_VERSION)
            @runtime_dir = runtime_dir || default_runtime_dir
            @nginx_version = nginx_version
    end

### Public Instance Methods

everything_installed?() click to toggle source

    # File lib/phusion_passenger/standalone/runtime_locator.rb, line 107
    def everything_installed?
            return find_support_dir && find_nginx_binary
    end

find_agents_dir() click to toggle source

    # File lib/phusion_passenger/standalone/runtime_locator.rb, line 99
    def find_agents_dir
            return "#{find_support_dir}/agents"
    end

find_lib_dir() click to toggle source

    # File lib/phusion_passenger/standalone/runtime_locator.rb, line 103
    def find_lib_dir
            return find_support_dir
    end

find_nginx_binary() click to toggle source

Returns the path to the Nginx binary that Passenger Standalone may use, or nil if not installed.

    # File lib/phusion_passenger/standalone/runtime_locator.rb, line 75
    def find_nginx_binary
            return @nginx_binary if @has_nginx_binary

            if File.exist?(config_filename)
                    config = PhusionPassenger::Utils::JSON.parse(File.read(config_filename))
            else
                    config = {}
            end
            if result = config["nginx_binary"]
                    @nginx_binary = result
            elsif PhusionPassenger.natively_packaged? && @nginx_version == PhusionPassenger::PREFERRED_NGINX_VERSION
                    @nginx_binary = "#{PhusionPassenger.lib_dir}/nginx"
            else
                    filename = "#{@runtime_dir}/#{version}/nginx-#{@nginx_version}-#{cxx_compat_id}/nginx"
                    if File.exist?(filename)
                            @nginx_binary = filename
                    else
                            @nginx_binary = nil
                    end
            end
            @has_nginx_binary = true
            return @nginx_binary
    end

find_support_dir() click to toggle source

Returns the directory in which Passenger Standalone support binaries are stored, or nil if not installed.

    # File lib/phusion_passenger/standalone/runtime_locator.rb, line 52
    def find_support_dir
            return @support_dir if @has_support_dir

            if PhusionPassenger.originally_packaged?
                    if debugging?
                            @support_dir = "#{PhusionPassenger.source_root}/buildout"
                    else
                            dir = "#{@runtime_dir}/#{version}/support-#{cxx_compat_id}"
                            if self.class.looks_like_support_dir?(dir)
                                    @support_dir = dir
                            else
                                    @support_dir = nil
                            end
                    end
            else
                    @support_dir = PhusionPassenger.lib_dir
            end
            @has_support_dir = true
            return @support_dir
    end

install_targets() click to toggle source

    # File lib/phusion_passenger/standalone/runtime_locator.rb, line 111
    def install_targets
            result = []
            result << :nginx if find_nginx_binary.nil?
            result << :support_binaries if find_support_dir.nil?
            return result
    end

nginx_binary_install_destination() click to toggle source

Returns the directory to which the Nginx binary may be installed, in case the RuntimeInstaller is to be invoked.

    # File lib/phusion_passenger/standalone/runtime_locator.rb, line 134
    def nginx_binary_install_destination
            return "#{@runtime_dir}/#{version}/nginx-#{@nginx_version}-#{cxx_compat_id}"
    end

reload() click to toggle source

    # File lib/phusion_passenger/standalone/runtime_locator.rb, line 46
    def reload
            @has_support_dir = @has_nginx_binary = false
    end

support_dir_install_destination() click to toggle source

Returns the directory to which support binaries may be installed, in case the RuntimeInstaller is to be invoked.

    # File lib/phusion_passenger/standalone/runtime_locator.rb, line 120
    def support_dir_install_destination
            if PhusionPassenger.originally_packaged?
                    if debugging?
                            return "#{PhusionPassenger.lib_dir}/common/libpassenger_common"
                    else
                            return "#{@runtime_dir}/#{version}/support-#{cxx_compat_id}"
                    end
            else
                    return nil
            end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.