Sha256: 55c703da85fed0420668bb01cc772390237a975eda2deb9246f11c72edc69e20

Contents?: true

Size: 1.27 KB

Versions: 29

Compression:

Stored size: 1.27 KB

Contents

#!/usr/bin/env ruby
# encoding: utf-8

# This script changes the bootstrap code for all Phusion Passenger commands,
# as well as the Nginx module config script, so that they work no
# matter which Ruby interpreter is currently in $PATH, and no matter how
# Phusion Passenger is packaged.
# 
# The bootstrap code must not add ruby_libdir to $LOAD_PATH. The active Ruby
# can be *any* Ruby interpreter, maybe not even MRI. ruby_libdir belongs to
# a Ruby interpreter installed by the distribution, and the files in it may
# may be incompatible with the active Ruby.

type = ARGV.shift

if type == "--ruby"
	ruby_libdir = ARGV.shift
	BOOTSTRAP_CODE = %Q{
		ENV["PASSENGER_LOCATION_CONFIGURATION_FILE"] = "#{ruby_libdir}/phusion_passenger/locations.ini"
		begin
			require 'rubygems'
		rescue LoadError
		end
		require '#{ruby_libdir}/phusion_passenger'
	}
elsif type == "--nginx-module-config"
	bindir = ARGV.shift
	BOOTSTRAP_CODE = %Q{
		PASSENGER_CONFIG=#{bindir}/passenger-config
	}
else
	abort "Invalid type"
end
BOOTSTRAP_CODE.gsub!(/^\t\t/, '').strip

ARGV.each do |filename|
	File.open(filename, "r+") do |f|
		text = f.read
		text.sub!(
			/^## Magic comment: begin bootstrap ##.*## Magic comment: end bootstrap \#\#$/m,
			BOOTSTRAP_CODE)
		f.rewind
		f.truncate(0)
		f.write(text)
	end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
passenger-4.0.60 dev/install_scripts_bootstrap_code.rb
passenger-4.0.59 dev/install_scripts_bootstrap_code.rb
passenger-5.0.0.beta3 dev/install_scripts_bootstrap_code.rb
passenger-4.0.58 dev/install_scripts_bootstrap_code.rb
passenger-4.0.57 dev/install_scripts_bootstrap_code.rb
passenger-5.0.0.beta2 dev/install_scripts_bootstrap_code.rb
passenger-4.0.56 dev/install_scripts_bootstrap_code.rb
passenger-4.0.55 dev/install_scripts_bootstrap_code.rb
passenger-5.0.0.beta1 dev/install_scripts_bootstrap_code.rb
passenger-4.0.53 dev/install_scripts_bootstrap_code.rb
passenger-4.0.52 dev/install_scripts_bootstrap_code.rb
passenger-4.0.51 dev/install_scripts_bootstrap_code.rb
passenger-4.0.50 dev/install_scripts_bootstrap_code.rb
passenger-4.0.49 dev/install_scripts_bootstrap_code.rb
passenger-4.0.48 dev/install_scripts_bootstrap_code.rb
passenger-4.0.46 dev/install_scripts_bootstrap_code.rb
passenger-4.0.45 dev/install_scripts_bootstrap_code.rb
passenger-4.0.44 dev/install_scripts_bootstrap_code.rb
passenger-4.0.43 dev/install_scripts_bootstrap_code.rb
passenger-4.0.42 dev/install_scripts_bootstrap_code.rb