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

class Epubcheck < Formula
  homepage 'http://code.google.com/p/epubcheck/'
  url 'http://epubcheck.googlecode.com/files/epubcheck-1.2.zip'
  sha1 '86036eadad8408070791b3da368958239ed8a410'

  devel do
    url 'http://epubcheck.googlecode.com/files/epubcheck-3.0b5.zip'
    sha1 'd5f9d60733f587946fc853f561ca2f13e3b8f83d'
  end

  def install
    if build.devel?
      libexec.install "epubcheck-3.0b5.jar", "lib"
      (bin/'epubcheck').write <<-EOS.undent
        #!/bin/sh
        java -jar "#{libexec}/epubcheck-3.0b5.jar" "$@"
      EOS
    else
      libexec.install "epubcheck-1.2.jar", "lib"
      (bin/'epubcheck').write <<-EOS.undent
        #!/bin/sh
        java -jar "#{libexec}/epubcheck-1.2.jar" "$@"
      EOS
    end
  end

  def test
    puts <<-EOS.undent
      To test epubcheck, find a epub file that doesn't have any errors and then:
        epubcheck file.epub

      The reply should look like:
        Epubcheck Version 1.2 or 3.0b5

        No errors or warnings detected
    EOS
  end
end