2013-06-20 12:57:46 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Passenger < Formula
|
|
|
|
homepage 'https://www.phusionpassenger.com/'
|
2014-01-02 14:55:50 +00:00
|
|
|
url 'http://s3.amazonaws.com/phusion-passenger/releases/passenger-4.0.33.tar.gz'
|
|
|
|
sha1 'b82ef1f51eab692ea0422028ced210c65d192083'
|
2013-08-19 19:13:04 +00:00
|
|
|
head 'https://github.com/phusion/passenger.git'
|
2013-06-20 12:57:46 +00:00
|
|
|
|
2013-09-10 08:06:14 +00:00
|
|
|
depends_on :macos => :lion
|
2013-06-20 12:57:46 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
rake "apache2"
|
|
|
|
rake "nginx"
|
2013-09-13 09:23:11 +00:00
|
|
|
|
|
|
|
necessary_files = Dir["configure", "Rakefile", "README.md", "CONTRIBUTORS",
|
|
|
|
"CONTRIBUTING.md", "LICENSE", "INSTALL.md", "NEWS", "passenger.gemspec",
|
2013-10-23 08:18:13 +00:00
|
|
|
"build", "lib", "node_lib", "bin", "doc", "man", "helper-scripts",
|
|
|
|
"ext", "resources", "buildout"]
|
2013-09-13 09:23:11 +00:00
|
|
|
libexec.mkpath
|
|
|
|
cp_r necessary_files, libexec, :preserve => true
|
2013-06-20 12:57:46 +00:00
|
|
|
|
2014-01-03 23:50:42 +00:00
|
|
|
# Allow Homebrew to create symlinks for the Phusion Passenger commands.
|
2013-09-13 09:23:11 +00:00
|
|
|
bin.mkpath
|
|
|
|
Dir[libexec/"bin/*"].each do |orig_script|
|
2013-06-20 12:57:46 +00:00
|
|
|
name = File.basename(orig_script)
|
2014-01-03 23:50:42 +00:00
|
|
|
ln_s orig_script, bin/name
|
2013-06-20 12:57:46 +00:00
|
|
|
end
|
2014-01-03 23:50:42 +00:00
|
|
|
|
|
|
|
# Ensure that the Phusion Passenger commands can always find their library
|
|
|
|
# files.
|
|
|
|
locations_ini = `/usr/bin/ruby ./bin/passenger-config --make-locations-ini`
|
|
|
|
locations_ini.gsub!(/=#{Regexp.compile Dir.pwd}\//, "=#{libexec}/")
|
|
|
|
(libexec/"lib/phusion_passenger/locations.ini").write(locations_ini)
|
|
|
|
system "/usr/bin/ruby", "./dev/install_scripts_bootstrap_code.rb",
|
|
|
|
"--ruby", libexec/"lib", *Dir[libexec/"bin/*"]
|
|
|
|
system "/usr/bin/ruby", "./dev/install_scripts_bootstrap_code.rb",
|
|
|
|
"--nginx-module-config", libexec/"bin", libexec/"ext/nginx/config"
|
|
|
|
|
2013-09-13 09:23:11 +00:00
|
|
|
mv libexec/'man', share
|
2013-06-20 12:57:46 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def caveats; <<-EOS.undent
|
|
|
|
To activate Phusion Passenger for Apache, create /etc/apache2/other/passenger.conf:
|
2013-09-13 09:23:11 +00:00
|
|
|
LoadModule passenger_module #{opt_prefix}/libexec/buildout/apache2/mod_passenger.so
|
2014-01-03 23:50:42 +00:00
|
|
|
PassengerRoot #{opt_prefix}/libexec/lib/phusion_passenger/locations.ini
|
2013-06-20 12:57:46 +00:00
|
|
|
PassengerDefaultRuby /usr/bin/ruby
|
|
|
|
|
|
|
|
To activate Phusion Passenger for Nginx, run:
|
|
|
|
brew install nginx --with-passenger
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2014-01-03 23:50:42 +00:00
|
|
|
ruby_libdir = `#{HOMEBREW_PREFIX}/bin/passenger-config --ruby-libdir`.strip
|
|
|
|
if ruby_libdir != (libexec/"lib").to_s
|
|
|
|
raise "Invalid installation"
|
2013-06-20 12:57:46 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|