Skip to content

Instantly share code, notes, and snippets.

@aryairani
Last active February 6, 2024 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aryairani/891e1d445b4ec180411361c1abb897c3 to your computer and use it in GitHub Desktop.
Save aryairani/891e1d445b4ec180411361c1abb897c3 to your computer and use it in GitHub Desktop.
home brew formula for unison
class UnisonFromSrc < Formula
desc "Unison Language and Codebase Manager"
homepage "https://unisonweb.org"
url "https://github.com/unisonweb/unison/archive/refs/tags/release/0.5.15.tar.gz"
sha256 "03b2334fc75edafbe5300284ae19d0b9abeaf4e8c5c13d1c899c80c9e6050990"
license "MIT"
version_scheme 1
depends_on "ghc@9.2" => :build
depends_on "haskell-stack" => :build
depends_on "npm" => :build
depends_on "fzf" => :recommended
depends_on "minimal-racket" => :optional
uses_from_macos "less" => :recommended
resource "local-ui" do
url "https://github.com/unisonweb/unison-local-ui/archive/refs/tags/release/0.5.15.tar.gz"
sha256 "fcc74ef9f41388588e9c29ebdf6759ee27168a8c650408dd695b7c65d117b1f5"
end
def install
localui = libexec/"ui"
resource("local-ui").stage do
system "npm", "ci"
system "npm", "run", "ui-core-install"
system "npm", "run", "build"
localui.install Dir["dist/unisonLocal/*"]
end
system "stack", "--no-terminal", "build", "--flag", "unison-parser-typechecker:optimized"
libexec.install `stack exec which unison`.strip "ucm"
end
test do
(testpath/"getbase.md").write <<~EOS
```ucm
.> project.create test
```
```unison
> "Hello, World!"
```
EOS
system "#{bin}/ucm", "transcript", testpath/"getbase.md"
end
end
class Unisonlang < Formula
desc "Unison Language and Codebase Manager"
homepage "https://unisonweb.org"
url "https://github.com/unisonweb/unison/archive/refs/tags/release/0.5.15.tar.gz"
sha256 "03b2334fc75edafbe5300284ae19d0b9abeaf4e8c5c13d1c899c80c9e6050990"
license "MIT"
depends_on "ghc@9.2" => :build
depends_on "haskell-stack" => :build
depends_on "npm" => :build
depends_on "unison-local-ui"
depends_on "fzf" => :recommended
depends_on "minimal-racket" => :optional
uses_from_macos "less" => :recommended
def install
system "stack", "--no-terminal", "build", "--flag", "unison-parser-typechecker:optimized"
libexec.install `stack exec which unison`.strip
libexec.install_symlink Formula["unison-local-ui"].opt_share/"ui"
(bin/"ucm").write <<~EOS
#!/bin/bash
#{libexec}/unison $@
EOS
end
test do
(testpath/"getbase.md").write <<~EOS
```ucm
.> project.create test
```
```unison
> "Hello, World!"
```
EOS
system "#{bin}/ucm", "transcript", testpath/"getbase.md"
end
end
class UnisonLocalUi < Formula
desc "Unison Language and Codebase Manager"
homepage "https://unisonweb.org"
url "https://github.com/unisonweb/unison-local-ui/archive/refs/tags/release/0.5.15.tar.gz"
sha256 "fcc74ef9f41388588e9c29ebdf6759ee27168a8c650408dd695b7c65d117b1f5"
license "MIT"
depends_on "npm" => :build
def install
system "npm", "ci"
system "npm", "run", "ui-core-install"
system "npm", "run", "build"
(pkgshare/"ui").install Dir["dist/unisonLocal/*"]
end
test do
assert_predicate opt_share/"ui"/"index.html", :exist?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment