Parent

Class/Module Index [+]

Quicksearch

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.