lib/phusion_passenger.rb in passenger-4.0.33 vs lib/phusion_passenger.rb in passenger-4.0.34

- old
+ new

@@ -1,8 +1,8 @@ # encoding: utf-8 # Phusion Passenger - https://www.phusionpassenger.com/ -# Copyright (c) 2010-2013 Phusion +# Copyright (c) 2010-2014 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 @@ -28,11 +28,11 @@ ###### Names and version numbers ###### PACKAGE_NAME = 'passenger' # Run 'rake ext/common/Constants.h' after changing this number. - VERSION_STRING = '4.0.33' + VERSION_STRING = '4.0.34' PREFERRED_NGINX_VERSION = '1.4.4' NGINX_SHA256_CHECKSUM = '7c989a58e5408c9593da0bebcd0e4ffc3d892d1316ba5042ddb0be5b0b4102b9' PREFERRED_PCRE_VERSION = '8.32' @@ -44,10 +44,12 @@ ###### Directories ###### GLOBAL_NAMESPACE_DIRNAME = "passenger" # Subdirectory under $HOME to use for storing stuff. USER_NAMESPACE_DIRNAME = ".passenger" + # The name for the /etc/apache2/mods-available/*.{load,conf} file. + APACHE2_MODULE_CONF_NAME = "passenger" # Directories in which to look for plugins. PLUGIN_DIRS = [ "/usr/share/#{GLOBAL_NAMESPACE_DIRNAME}/plugins", "/usr/local/share/#{GLOBAL_NAMESPACE_DIRNAME}/plugins", @@ -70,12 +72,27 @@ ].freeze OPTIONAL_LOCATIONS_INI_FIELDS = [ # Directory in which downloaded Phusion Passenger binaries are stored. # Only available when originally packaged. :download_cache_dir, + # Directory which contains the main Phusion Passenger Rakefile. Only + # available when originally packaged, + :build_system_dir, # Directory in which the build system's output is stored, e.g. - # the compiled agent executables. Only available when originally packaged. + # the compiled agent executables. Only available when originally + # packaged. + :buildout_dir, + # Directory in which we can run 'rake apache2'. Used by + # passenger-install-apache2-module. Rake will save the Apache module + # to `apache2_module_path`. + :apache2_module_source_dir + ].freeze + # The subset of the optional fields which are only available when + # originally packaged. + ORIGINALLY_PACKAGED_LOCATIONS_INI_FIELDS = [ + :download_cache_dir, + :build_system_dir, :buildout_dir ].freeze # Follows the logic of ext/common/ResourceLocator.h, so don't forget to modify that too. def self.locate_directories(source_root_or_location_configuration_file = nil) @@ -84,25 +101,22 @@ if root_or_file && File.file?(root_or_file) filename = root_or_file options = parse_ini_file(filename) - @natively_packaged = get_bool_option(filename, options, 'natively_packaged') - if natively_packaged? - @native_packaging_method = get_option(filename, options, 'native_packaging_method') - end + @natively_packaged = get_bool_option(filename, options, 'natively_packaged') REQUIRED_LOCATIONS_INI_FIELDS.each do |field| instance_variable_set("@#{field}", get_option(filename, options, field.to_s).freeze) end OPTIONAL_LOCATIONS_INI_FIELDS.each do |field| instance_variable_set("@#{field}", get_option(filename, options, field.to_s, false).freeze) end - if !originally_packaged? - # Since these options are only supposed to be available when - # originally packaged, force them to be nil when natively packaged. - @download_cache_dir = nil - @buildout_dir = nil + if natively_packaged? + @native_packaging_method = get_option(filename, options, 'native_packaging_method') + ORIGINALLY_PACKAGED_LOCATIONS_INI_FIELDS.each do |field| + instance_variable_set("@#{field}", nil) + end end else @source_root = File.dirname(File.dirname(FILE_LOCATION)) @natively_packaged = false @bin_dir = "#{@source_root}/bin".freeze @@ -110,17 +124,19 @@ @lib_dir = "#{@source_root}/buildout".freeze @helper_scripts_dir = "#{@source_root}/helper-scripts".freeze @resources_dir = "#{@source_root}/resources".freeze @include_dir = "#{@source_root}/ext".freeze @doc_dir = "#{@source_root}/doc".freeze - @ruby_libdir = File.dirname(FILE_LOCATION) + @ruby_libdir = File.dirname(FILE_LOCATION).freeze @node_libdir = "#{@source_root}/node_lib".freeze @apache2_module_path = "#{@source_root}/buildout/apache2/mod_passenger.so".freeze - @ruby_extension_source_dir = "#{@source_root}/ext/ruby" - @nginx_module_source_dir = "#{@source_root}/ext/nginx" - @download_cache_dir = "#{@source_root}/download_cache" - @buildout_dir = "#{@source_root}/buildout" + @ruby_extension_source_dir = "#{@source_root}/ext/ruby".freeze + @nginx_module_source_dir = "#{@source_root}/ext/nginx".freeze + @download_cache_dir = "#{@source_root}/download_cache".freeze + @build_system_dir = @source_root.dup.freeze + @buildout_dir = "#{@source_root}/buildout".freeze + @apache2_module_source_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 @@ -136,11 +152,11 @@ def self.natively_packaged? return @natively_packaged end # If Phusion Passenger is natively packaged, returns which packaging - # method was used. Can be 'deb' or 'rpm'. + # method was used. Can be 'deb', 'rpm' or 'homebrew'. def self.native_packaging_method return @native_packaging_method end # Whether the current Phusion Passenger installation is installed @@ -185,17 +201,20 @@ end ###### Other resource locations ###### - BINARIES_URL_ROOT = "https://oss-binaries.phusionpassenger.com/binaries/passenger/by_release" INDEX_DOC_NAME = "Users guide.html" APACHE2_DOC_NAME = "Users guide Apache.html" NGINX_DOC_NAME = "Users guide Nginx.html" STANDALONE_DOC_NAME = "Users guide Standalone.html" - def self.binaries_ca_cert_path - return "#{resources_dir}/oss-binaries.phusionpassenger.com.crt" + def self.binaries_sites + return [ + { :url => "https://oss-binaries.phusionpassenger.com/binaries/passenger/by_release", + :cacert => "#{resources_dir}/oss-binaries.phusionpassenger.com.crt" }, + { :url => "https://s3.amazonaws.com/phusion-passenger/binaries/passenger/by_release" } + ] end # Instead of calling `require 'phusion_passenger/foo'`, you should call # `PhusionPassenger.require_passenger_lib 'foo'`. This is because when Phusion