def self.locate_directories(install_spec = nil)
@install_spec = install_spec || infer_install_spec
if @install_spec && File.file?(@install_spec)
filename = @install_spec
options = parse_ini_file(filename)
@custom_packaged = true
@packaging_method = get_option(filename, options, 'packaging_method')
REQUIRED_LOCATIONS_INI_FIELDS.each do |field|
value = get_option(filename, options, field.to_s)
value.freeze unless value.nil?
instance_variable_set("@#{field}", value)
end
OPTIONAL_LOCATIONS_INI_FIELDS.each do |field|
value = get_option(filename, options, field.to_s, false)
value.freeze unless value.nil?
instance_variable_set("@#{field}", value)
end
else
require 'rbconfig'
shared_basedir = File.join(RbConfig::CONFIG['libdir'], 'passenger', VERSION_STRING)
source_root = File.dirname(File.dirname(File.dirname(FILE_LOCATION)))
@install_spec = source_root
@custom_packaged = false
@bin_dir = "#{shared_basedir}/bin".freeze
@support_binaries_dir = "#{shared_basedir}/support-binaries".freeze
@lib_dir = "#{shared_basedir}".freeze
@helper_scripts_dir = "#{shared_basedir}/helper-scripts".freeze
@resources_dir = "#{shared_basedir}/resources".freeze
@include_dir = "#{shared_basedir}".freeze
@doc_dir = "#{source_root}/doc".freeze
@ruby_libdir = File.dirname(FILE_LOCATION).freeze
@node_libdir = "#{shared_basedir}/nodejs_supportlib".freeze
@apache2_module_path = "#{source_root}/buildout/apache2/mod_passenger.so".freeze
@ruby_extension_source_dir = "#{source_root}/src/ruby_native_extension".freeze
@nginx_module_source_dir = "#{source_root}/src/nginx_module".freeze
@download_cache_dir = "#{source_root}/download_cache".freeze
@build_system_dir = source_root.dup.freeze
REQUIRED_LOCATIONS_INI_FIELDS.each do |field|
if instance_variable_get("@#{field}").nil?
raise "BUG: @#{field} not set"
end
end
end
end