diff options
| author | Jack Nagel | 2014-03-26 17:27:10 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-03-26 17:38:24 -0500 |
| commit | 63e1263ef2742ce011d659ead1f5c8e074a2a31f (patch) | |
| tree | 3880c30fc5498caa39147bbb62a89ee98df87ce0 /Library | |
| parent | 55aa56a1e2badbe580aa4794bd6249c96358697b (diff) | |
| download | homebrew-63e1263ef2742ce011d659ead1f5c8e074a2a31f.tar.bz2 | |
nginx: move location-dependent things to post_install
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Formula/nginx.rb | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/Library/Formula/nginx.rb b/Library/Formula/nginx.rb index 05bd147d2..6e20d2e96 100644 --- a/Library/Formula/nginx.rb +++ b/Library/Formula/nginx.rb @@ -86,31 +86,31 @@ class Nginx < Formula system "make install" man8.install "objs/nginx.8" (var/'run/nginx').mkpath + end + def post_install # nginx's docroot is #{prefix}/html, this isn't useful, so we symlink it # to #{HOMEBREW_PREFIX}/var/www. The reason we symlink instead of patching # is so the user can redirect it easily to something else if they choose. - prefix.cd do - dst = HOMEBREW_PREFIX/"var/www" - if not dst.exist? - dst.dirname.mkpath - mv "html", dst - else - rm_rf "html" - dst.mkpath - end - Pathname.new("#{prefix}/html").make_relative_symlink(dst) + html = prefix/"html" + dst = var/"www" + + if dst.exist? + html.rmtree + dst.mkpath + else + dst.dirname.mkpath + html.rename(dst) end + prefix.install_symlink dst => "html" + # for most of this formula's life the binary has been placed in sbin # and Homebrew used to suggest the user copy the plist for nginx to their # ~/Library/LaunchAgents directory. So we need to have a symlink there # for such cases - if (HOMEBREW_CELLAR/'nginx').subdirs.any?{|d| (d/:sbin).directory? } - sbin.mkpath - sbin.cd do - (sbin/'nginx').make_relative_symlink(bin/'nginx') - end + if rack.subdirs.any? { |d| (d/:sbin).directory? } + sbin.install_symlink bin/"nginx" end end |
