aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/tika.rb
blob: 058b1787e22bf418f398fc182519bdbb68f1916d (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
require 'formula'

class TikaRestServer < Formula
  url 'http://repo1.maven.org/maven2/org/apache/tika/tika-server/1.2/tika-server-1.2.jar'
  sha1 '1343e490a61f9223832c66ff384a35f73dbc719c'
end

class Tika < Formula
  homepage 'http://tika.apache.org/'
  url 'http://www.apache.org/dyn/closer.cgi/tika/tika-app-1.2.jar'
  sha1 '22c7110997d8ec114c6713cca1aadbbab6472c07'

  def script; <<-EOS.undent
    #!/bin/sh
    java -jar #{libexec}/tika-app-1.2.jar "$@"
    EOS
  end

  def install
    libexec.install 'tika-app-1.2.jar'
    (bin+'tika').write script
    TikaRestServer.new.brew {
      libexec.install 'tika-server-1.2.jar'
      (bin+'tika-rest-server').write <<-EOS.undent
        #!/bin/sh
        java -jar #{libexec}/tika-server-1.2.jar "$@"
        EOS
    }
  end

  def caveats; <<-EOS.undent
    To run Tika:
      tika

    To run Tika's REST server:
      tika-rest-server

    See the Tika homepage for more documentation:
      brew home tika
    EOS
  end
end