-diff -ur apache-mod_rails-2.2.15-o/Rakefile apache-mod_rails-2.2.15/Rakefile
---- apache-mod_rails-2.2.15-o/Rakefile 2010-08-28 23:04:20.000000000 -0600
-+++ apache-mod_rails-2.2.15/Rakefile 2010-08-30 12:29:27.000000000 -0600
-@@ -18,10 +18,8 @@
+diff -ur apache-mod_rails-3.0.0-o//Rakefile apache-mod_rails-3.0.0/Rakefile
+--- apache-mod_rails-3.0.0-o//Rakefile 2010-10-18 14:08:19.000000000 +0200
++++ apache-mod_rails-3.0.0/Rakefile 2010-11-25 01:20:28.000000000 +0100
+@@ -29,7 +29,6 @@
+ require 'build/apache2'
+ require 'build/nginx'
+ require 'build/documentation'
+-require 'build/packaging'
+ require 'build/test_basics'
+ require 'build/oxt_tests'
+ require 'build/cxx_tests'
+diff -ur apache-mod_rails-3.0.0-o//build/basics.rb apache-mod_rails-3.0.0/build/basics.rb
+--- apache-mod_rails-3.0.0-o//build/basics.rb 2010-10-18 14:08:19.000000000 +0200
++++ apache-mod_rails-3.0.0/build/basics.rb 2010-11-25 01:20:28.000000000 +0100
+@@ -14,7 +14,6 @@
+ # with this program; if not, write to the Free Software Foundation, Inc.,
+ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- $LOAD_PATH.unshift("#{File.dirname(__FILE__)}/lib")
- $LOAD_PATH.unshift("#{File.dirname(__FILE__)}/misc")
-require 'rubygems'
require 'pathname'
- require 'rake/rdoctask'
--require 'rake/gempackagetask'
- require 'rake/extensions'
- require 'rake/cplusplus'
- require 'phusion_passenger/platform_info'
-@@ -640,101 +638,6 @@
- rd.options << "-S" << "-N" << "-p" << "-H"
- end
+ require 'phusion_passenger'
+ require 'phusion_passenger/packaging'
+@@ -32,8 +31,6 @@
+ include PhusionPassenger
+ include PhusionPassenger::PlatformInfo
--
--##### Packaging
--
--spec = Gem::Specification.new do |s|
-- s.platform = Gem::Platform::RUBY
-- s.homepage = "http://www.modrails.com/"
-- s.summary = "Apache module for Ruby on Rails support."
-- s.name = "passenger"
-- s.version = PACKAGE_VERSION
-- s.rubyforge_project = "passenger"
-- s.author = "Phusion - http://www.phusion.nl/"
-- s.email = "info@phusion.nl"
-- s.requirements << "fastthread" << "Apache 2 with development headers"
-- s.require_paths = ["lib", "ext"]
-- s.add_dependency 'rake', '>= 0.8.1'
-- s.add_dependency 'fastthread', '>= 1.0.1'
-- s.add_dependency 'rack'
-- s.extensions << 'ext/phusion_passenger/extconf.rb'
-- s.files = FileList[
-- 'Rakefile',
-- 'README',
-- 'DEVELOPERS.TXT',
-- 'LICENSE',
-- 'INSTALL',
-- 'NEWS',
-- 'lib/**/*.rb',
-- 'lib/**/*.py',
-- 'lib/phusion_passenger/templates/*',
-- 'lib/phusion_passenger/templates/apache2/*',
-- 'lib/phusion_passenger/templates/nginx/*',
-- 'bin/*',
-- 'doc/*',
--
-- # If you're running 'rake package' for the first time, then these
-- # files don't exist yet, and so won't be matched by the above glob.
-- # So we add these filenames manually.
-- 'doc/Users guide Apache.html',
-- 'doc/Users guide Nginx.html',
-- 'doc/Security of user switching support.html',
--
-- 'doc/*/*',
-- 'doc/*/*/*',
-- 'doc/*/*/*/*',
-- 'doc/*/*/*/*/*',
-- 'doc/*/*/*/*/*/*',
-- 'man/*',
-- 'debian/*',
-- 'ext/common/*.{cpp,c,h,hpp}',
-- 'ext/apache2/*.{cpp,h,c,TXT}',
-- 'ext/nginx/*.{c,cpp,h}',
-- 'ext/nginx/config',
-- 'ext/boost/*.{hpp,TXT}',
-- 'ext/boost/**/*.{hpp,cpp,pl,inl,ipp}',
-- 'ext/oxt/*.hpp',
-- 'ext/oxt/*.cpp',
-- 'ext/oxt/detail/*.hpp',
-- 'ext/phusion_passenger/*.{c,rb}',
-- 'benchmark/*.{cpp,rb}',
-- 'misc/*',
-- 'misc/*/*',
-- 'test/*.{rb,cpp,example}',
-- 'test/support/*.{cpp,h,rb}',
-- 'test/oxt/*.cpp',
-- 'test/ruby/**/*',
-- 'test/integration_tests/**/*',
-- 'test/stub/**/*'
-- ]
-- s.executables = [
-- 'passenger-spawn-server',
-- 'passenger-install-apache2-module',
-- 'passenger-install-nginx-module',
-- 'passenger-config',
-- 'passenger-memory-stats',
-- 'passenger-make-enterprisey',
-- 'passenger-status',
-- 'passenger-stress-test'
-- ]
-- s.has_rdoc = true
-- s.extra_rdoc_files = ['README']
-- s.rdoc_options <<
-- "-S" << "-N" << "-p" << "-H" <<
-- '--main' << 'README' <<
-- '--title' << 'Passenger Ruby API'
-- s.description = "Passenger is an Apache module for Ruby on Rails support."
--end
--
--Rake::GemPackageTask.new(spec) do |pkg|
-- pkg.need_tar_gz = true
--end
--
--Rake::Task['package'].prerequisites.unshift(:doc)
--Rake::Task['package:gem'].prerequisites.unshift(:doc)
--Rake::Task['package:force'].prerequisites.unshift(:doc)
--task :clobber => :'package:clean'
--
- desc "Create a fakeroot, useful for building native packages"
- task :fakeroot => [:apache2, :native_support, :doc] do
- require 'rbconfig'
-@@ -772,34 +675,6 @@
- sh "rm", "-rf", *Dir["#{docdir}/{definitions.h,Doxyfile,template}"]
- end
+-require 'build/packagetask'
+-require 'build/gempackagetask'
+ require 'build/rake_extensions'
+ require 'build/cplusplus_support'
--desc "Create a Debian package"
--task 'package:debian' => :fakeroot do
-- if Process.euid != 0
-- STDERR.puts
-- STDERR.puts "*** ERROR: the 'package:debian' task must be run as root."
-- STDERR.puts
-- exit 1
-- end
--
-- fakeroot = "pkg/fakeroot"
-- raw_arch = `uname -m`.strip
-- arch = case raw_arch
-- when /^i.86$/
-- "i386"
-- when /^x86_64/
-- "amd64"
-- else
-- raw_arch
-- end
--
-- sh "sed -i 's/Version: .*/Version: #{PACKAGE_VERSION}/' debian/control"
-- sh "cp -R debian #{fakeroot}/DEBIAN"
-- sh "sed -i 's/: any/: #{arch}/' #{fakeroot}/DEBIAN/control"
-- sh "chown -R root:root #{fakeroot}"
-- sh "dpkg -b #{fakeroot} pkg/passenger_#{PACKAGE_VERSION}-#{arch}.deb"
--end
--
--
- ##### Misc
-
- desc "Run 'sloccount' to see how much code Passenger has"
-diff -ur apache-mod_rails-2.2.15-o/lib/phusion_passenger/application.rb apache-mod_rails-2.2.15/lib/phusion_passenger/application.rb
---- apache-mod_rails-2.2.15-o/lib/phusion_passenger/application.rb 2010-06-24 06:23:06.000000000 -0600
-+++ apache-mod_rails-2.2.15/lib/phusion_passenger/application.rb 2010-08-30 12:29:27.000000000 -0600
+diff -ur apache-mod_rails-3.0.0-o//helper-scripts/passenger-spawn-server apache-mod_rails-3.0.0/helper-scripts/passenger-spawn-server
+--- apache-mod_rails-3.0.0-o//helper-scripts/passenger-spawn-server 2010-10-18 14:08:19.000000000 +0200
++++ apache-mod_rails-3.0.0/helper-scripts/passenger-spawn-server 2010-11-25 01:22:03.000000000 +0100
+@@ -72,7 +72,10 @@
+
+ source_root = File.expand_path(File.dirname(__FILE__) + "/..")
+ $LOAD_PATH.unshift("#{source_root}/lib")
+- require 'rubygems' rescue nil
++ begin
++ require 'rubygems'
++ rescue LoadError
++ end
+ require 'phusion_passenger'
+ require 'phusion_passenger/debug_logging'
+ require 'phusion_passenger/utils/tmpdir'
+Only in apache-mod_rails-3.0.0/helper-scripts: passenger-spawn-server~
+diff -ur apache-mod_rails-3.0.0-o//lib/phusion_passenger/abstract_server.rb apache-mod_rails-3.0.0/lib/phusion_passenger/abstract_server.rb
+--- apache-mod_rails-3.0.0-o//lib/phusion_passenger/abstract_server.rb 2010-10-18 14:08:19.000000000 +0200
++++ apache-mod_rails-3.0.0/lib/phusion_passenger/abstract_server.rb 2010-11-25 01:22:28.000000000 +0100
+@@ -172,7 +172,7 @@
+ # the associated file descriptors have just been closed. This can
+ # result in mysterious 'EBADFD' errors. So we force RubyGems to
+ # clear all open file handles.
+- Gem.clear_paths
++ Gem.clear_paths if defined? Gem
+
+ # Reseed pseudo-random number generator for security reasons.
+ srand
+Only in apache-mod_rails-3.0.0/lib/phusion_passenger: abstract_server.rb~
+diff -ur apache-mod_rails-3.0.0-o//lib/phusion_passenger/app_process.rb apache-mod_rails-3.0.0/lib/phusion_passenger/app_process.rb
+--- apache-mod_rails-3.0.0-o//lib/phusion_passenger/app_process.rb 2010-10-18 14:08:19.000000000 +0200
++++ apache-mod_rails-3.0.0/lib/phusion_passenger/app_process.rb 2010-11-25 01:20:28.000000000 +0100
@@ -21,7 +21,10 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-require 'rubygems'
+begin
-+ require 'rubygems'
++ require 'rubygems'
+rescue LoadError
+end
require 'phusion_passenger/exceptions'
module PhusionPassenger
-Only in apache-mod_rails-2.2.15/lib/phusion_passenger: platform_info.rb~
-diff -ur apache-mod_rails-2.2.15-o/lib/phusion_passenger/rack/application_spawner.rb apache-mod_rails-2.2.15/lib/phusion_passenger/rack/application_spawner.rb
---- apache-mod_rails-2.2.15-o/lib/phusion_passenger/rack/application_spawner.rb 2010-06-24 06:23:06.000000000 -0600
-+++ apache-mod_rails-2.2.15/lib/phusion_passenger/rack/application_spawner.rb 2010-08-30 12:29:51.000000000 -0600
-@@ -101,7 +101,7 @@
- # Make sure RubyGems uses any new environment variable values
- # that have been set now (e.g. $HOME, $GEM_HOME, etc) and that
- # it is able to detect newly installed gems.
-- Gem.clear_paths
-+ Gem.clear_paths if defined? Gem
- setup_bundler_support
- app = load_rack_app
+@@ -63,6 +66,7 @@
+ return :vendor
end
-Only in apache-mod_rails-2.2.15/lib/phusion_passenger/rack: application_spawner.rb~
-diff -ur apache-mod_rails-2.2.15-o/lib/phusion_passenger/railz/application_spawner.rb apache-mod_rails-2.2.15/lib/phusion_passenger/railz/application_spawner.rb
---- apache-mod_rails-2.2.15-o/lib/phusion_passenger/railz/application_spawner.rb 2010-06-24 06:23:06.000000000 -0600
-+++ apache-mod_rails-2.2.15/lib/phusion_passenger/railz/application_spawner.rb 2010-08-30 12:32:04.000000000 -0600
-@@ -21,7 +21,10 @@
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- # THE SOFTWARE.
-
--require 'rubygems'
-+begin
-+ require 'rubygems'
-+rescue LoadError
-+end
- require 'socket'
- require 'etc'
- require 'fcntl'
-@@ -173,7 +176,7 @@
- # Make sure RubyGems uses any new environment variable values
- # that have been set now (e.g. $HOME, $GEM_HOME, etc) and that
- # it is able to detect newly installed gems.
-- Gem.clear_paths
-+ Gem.clear_paths if defined? Gem
- setup_bundler_support
-
- require File.expand_path('config/environment')
-@@ -262,7 +265,7 @@
- # Make sure RubyGems uses any new environment variable values
- # that have been set now (e.g. $HOME, $GEM_HOME, etc) and that
- # it is able to detect newly installed gems.
-- Gem.clear_paths
-+ Gem.clear_paths if defined? Gem
- setup_bundler_support
- preload_application
- end
-Only in apache-mod_rails-2.2.15/lib/phusion_passenger/railz: application_spawner.rb~
-diff -ur apache-mod_rails-2.2.15-o/lib/phusion_passenger/railz/framework_spawner.rb apache-mod_rails-2.2.15/lib/phusion_passenger/railz/framework_spawner.rb
---- apache-mod_rails-2.2.15-o/lib/phusion_passenger/railz/framework_spawner.rb 2010-06-24 06:23:06.000000000 -0600
-+++ apache-mod_rails-2.2.15/lib/phusion_passenger/railz/framework_spawner.rb 2010-08-30 12:31:50.000000000 -0600
-@@ -21,7 +21,10 @@
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- # THE SOFTWARE.
-
--require 'rubygems'
-+begin
-+ require 'rubygems'
-+rescue LoadError
-+end
- require 'phusion_passenger/abstract_server'
- require 'phusion_passenger/abstract_server_collection'
- require 'phusion_passenger/railz/application_spawner'
-@@ -299,7 +302,7 @@
- # missing gem. If that's the case then the sysadmin
- # will install probably the gem. So we clear RubyGems's
- # cache so that it can detect new gems.
-- Gem.clear_paths
-+ Gem.clear_paths if defined? Gem
- end
- return
- end
-Only in apache-mod_rails-2.2.15/lib/phusion_passenger/railz: framework_spawner.rb~
-diff -ur apache-mod_rails-2.2.15-o/lib/phusion_passenger/spawn_manager.rb apache-mod_rails-2.2.15/lib/phusion_passenger/spawn_manager.rb
---- apache-mod_rails-2.2.15-o/lib/phusion_passenger/spawn_manager.rb 2010-06-24 06:23:06.000000000 -0600
-+++ apache-mod_rails-2.2.15/lib/phusion_passenger/spawn_manager.rb 2010-08-30 12:29:27.000000000 -0600
-@@ -292,7 +292,7 @@
+
++ return nil if !defined? Gem
+ environment_rb = File.read("#{app_root}/config/environment.rb")
+ environment_rb =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
+ gem_version_spec = $1
+diff -ur apache-mod_rails-3.0.0-o//lib/phusion_passenger/spawn_manager.rb apache-mod_rails-3.0.0/lib/phusion_passenger/spawn_manager.rb
+--- apache-mod_rails-3.0.0-o//lib/phusion_passenger/spawn_manager.rb 2010-10-18 14:08:19.000000000 +0200
++++ apache-mod_rails-3.0.0/lib/phusion_passenger/spawn_manager.rb 2010-11-25 01:20:28.000000000 +0100
+@@ -282,12 +282,12 @@
+ send_error_page(client, 'database_error', :error => e,
+ :app_root => app_root, :app_name => app_name(app_type),
+ :app_type => app_type)
+- elsif load_error?(e)
++ elsif load_error?(e) and defined? Gem
+ # A source file failed to load, maybe because of a
# missing gem. If that's the case then the sysadmin
# will install probably the gem. So we clear RubyGems's
# cache so that it can detect new gems.
send_error_page(client, 'load_error', :error => e, :app_root => app_root,
:app_name => app_name(app_type))
elsif e.child_exception.is_a?(SystemExit)
-diff -ur apache-mod_rails-2.2.15-o/lib/phusion_passenger/utils.rb apache-mod_rails-2.2.15/lib/phusion_passenger/utils.rb
---- apache-mod_rails-2.2.15-o/lib/phusion_passenger/utils.rb 2010-06-24 06:23:06.000000000 -0600
-+++ apache-mod_rails-2.2.15/lib/phusion_passenger/utils.rb 2010-08-30 12:29:27.000000000 -0600
+diff -ur apache-mod_rails-3.0.0-o//lib/phusion_passenger/utils.rb apache-mod_rails-3.0.0/lib/phusion_passenger/utils.rb
+--- apache-mod_rails-3.0.0-o//lib/phusion_passenger/utils.rb 2010-10-18 14:08:19.000000000 +0200
++++ apache-mod_rails-3.0.0/lib/phusion_passenger/utils.rb 2010-11-25 01:20:28.000000000 +0100
@@ -22,7 +22,10 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
require 'thread'
if (!defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby") && RUBY_VERSION < "1.8.7"
require 'fastthread'
+@@ -244,7 +247,7 @@
+ # Make sure RubyGems uses any new environment variable values
+ # that have been set now (e.g. $HOME, $GEM_HOME, etc) and that
+ # it is able to detect newly installed gems.
+- Gem.clear_paths
++ Gem.clear_paths if defined? Gem
+
+ # Because spawned app processes exit using #exit!, #at_exit
+ # blocks aren't called. Here we ninja patch Kernel so that