2013-06-20 12:57:46 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Passenger < Formula
|
|
|
|
homepage 'https://www.phusionpassenger.com/'
|
2014-03-18 23:23:30 +00:00
|
|
|
url 'http://s3.amazonaws.com/phusion-passenger/releases/passenger-4.0.40.tar.gz'
|
|
|
|
sha1 '62de2fc16b72f3c2c8d632131269cfb2c97a9069'
|
2013-08-19 19:13:04 +00:00
|
|
|
head 'https://github.com/phusion/passenger.git'
|
2013-06-20 12:57:46 +00:00
|
|
|
|
2014-03-10 11:29:01 +00:00
|
|
|
bottle do
|
2014-03-19 09:50:27 +00:00
|
|
|
sha1 "50ff5780d992e39eb25184c12ea8c51bce8ca67e" => :mavericks
|
|
|
|
sha1 "68f1c966547d54f24823c3682f10fff17cc7d6ca" => :mountain_lion
|
|
|
|
sha1 "3f2d79c682d5b6f5b913b47f7a799eeae0808658" => :lion
|
2014-03-10 11:29:01 +00:00
|
|
|
end
|
|
|
|
|
2014-01-15 23:11:03 +00:00
|
|
|
depends_on 'pcre'
|
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"
|
2014-01-15 23:11:03 +00:00
|
|
|
rake "webhelper"
|
2013-09-13 09:23:11 +00:00
|
|
|
|
|
|
|
necessary_files = Dir["configure", "Rakefile", "README.md", "CONTRIBUTORS",
|
2014-03-10 11:16:56 +00:00
|
|
|
"CONTRIBUTING.md", "LICENSE", "CHANGELOG", "INSTALL.md",
|
|
|
|
"passenger.gemspec", "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.
|
2014-01-15 23:11:03 +00:00
|
|
|
locations_ini = `/usr/bin/ruby ./bin/passenger-config --make-locations-ini --for-native-packaging-method=homebrew`
|
|
|
|
locations_ini.gsub!(/=#{Regexp.escape Dir.pwd}/, "=#{libexec}")
|
2014-01-03 23:50:42 +00:00
|
|
|
(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:
|
2014-03-06 05:28:31 +00:00
|
|
|
LoadModule passenger_module #{opt_libexec}/buildout/apache2/mod_passenger.so
|
|
|
|
PassengerRoot #{opt_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
|