blob: cf68bc02e0c8a1ec1eb588570ef5f04a88ce651b (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
 | require 'formula'
class Kestrel < Formula
  homepage 'http://robey.github.io/kestrel/'
  url 'http://robey.github.com/kestrel/download/kestrel-2.4.1.zip'
  sha1 'd6e6dabf1848fea306419c19ada0b89b6d1ad571'
  def install
    inreplace 'scripts/kestrel.sh' do |s|
      s.change_make_var! "APP_HOME", libexec
      # Fix var paths.
      s.gsub! "/var/", "/#{var}/"
      # Fix path to script in help message.
      s.gsub! "Usage: /etc/init.d/${APP_NAME}.sh", "Usage: kestrel"
      # Don't call ulimit as not root.
      s.gsub! "ulimit -", "# ulimit -"
    end
    inreplace 'config/production.scala' do |s|
      # Fix var paths.
      s.gsub! "/var/", "/#{var}/"
    end
    libexec.install Dir['*']
    (libexec + 'scripts/kestrel.sh').chmod 0755
    (libexec + 'scripts/devel.sh').chmod 0755
    (var + 'log/kestrel').mkpath
    (var + 'run/kestrel').mkpath
    (var + 'spool/kestrel').mkpath
    (bin + 'kestrel').write <<-EOS.undent
      #!/bin/bash
      exec "#{libexec}/scripts/kestrel.sh" "$@"
    EOS
  end
  test do
    system "#{bin}/kestrel", "status"
  end
end
 |