aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/qi.rb
blob: 7dc4f9667176e3fb782c95f41427b5b1f9fb6f8c (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
class Qi < Formula
  homepage "http://www.lambdassociates.org/"
  url "http://www.lambdassociates.org/Download/QiII1.07.zip"
  sha256 "515bb99efa1da3f8d416c370c9d98776d273c593efa241dc243da543118fc521"

  bottle do
    cellar :any
    sha256 "b52934ecc91ecffcd08c73180db59084ede6ad301d856681ed4d795e60a4079f" => :yosemite
    sha256 "26d53a5485f8fe56eced34ea9fd86db26d90853fa180a982bb2e59a216ee2e97" => :mavericks
    sha256 "facde8f9c5e8ae39761259769c28733c338d2e97c92a672c7266ac01e2d5b83c" => :mountain_lion
  end

  depends_on "sbcl" => :optional

  deprecated_option "SBCL" => "with-sbcl"

  if build.without? "sbcl"
    depends_on "clisp"
  end

  def install
    if build.with? "sbcl"
      cd "Lisp" do
        system "sbcl", "--load", "install.lsp"
      end

      (bin/"qi").write "#!/bin/bash\nsbcl --core #{prefix}/Qi.core $*"
      prefix.install "Lisp/Qi.core"
    else
      cd "Lisp" do
        system "clisp", "install.lsp"
      end

      (bin/"qi").write "#!/bin/bash\nclisp -M #{prefix}/Qi.mem $*"
      prefix.install "Lisp/Qi.mem"
    end
    chmod 0755, bin/"qi"
  end

  test do
    assert_match(/\(0-\) 42/,
                pipe_output("#{bin}/qi", "(+ 40 1 1)\n(quit)\n", 0))
  end
end