-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathunison-language.template.rb
More file actions
75 lines (66 loc) · 2.26 KB
/
unison-language.template.rb
File metadata and controls
75 lines (66 loc) · 2.26 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
class UnisonLanguage < Formula
desc "Unison [Language] and Codebase Manager"
homepage "https://unisonweb.org"
license "MIT"
version_scheme 2
version "${version}"
on_macos do
if Hardware::CPU.intel?
url "https://github.com/unisonweb/unison/releases/download/release%2F${version}/ucm-macos-x64.tar.gz"
sha256 "${macos_x64_sha}"
head "https://github.com/unisonweb/unison/releases/download/trunk-build/ucm-macos-x64.tar.gz"
elsif Hardware::CPU.arm?
url "https://github.com/unisonweb/unison/releases/download/release%2F${version}/ucm-macos-arm64.tar.gz"
sha256 "${macos_arm64_sha}"
head "https://github.com/unisonweb/unison/releases/download/trunk-build/ucm-macos-arm64.tar.gz"
else
odie "Unsupported architecture for ucm"
end
end
on_linux do
if Hardware::CPU.intel?
url "https://github.com/unisonweb/unison/releases/download/release%2F${version}/ucm-linux-x64.tar.gz"
sha256 "${linux_x64_sha}"
head "https://github.com/unisonweb/unison/releases/download/trunk-build/ucm-linux-x64.tar.gz"
elsif Hardware::CPU.arm?
url "https://github.com/unisonweb/unison/releases/download/release%2F${version}/ucm-linux-arm64.tar.gz"
sha256 "${linux_arm64_sha}"
head "https://github.com/unisonweb/unison/releases/download/trunk-build/ucm-linux-arm64.tar.gz"
else
odie "Unsupported architecture for ucm"
end
end
depends_on "fzf" => :recommended
def install
libexec.install "unison/unison"
pkgshare.install "ui"
(bin/"ucm").write <<~EOS
#!/bin/bash
UCM_WEB_UI="#{pkgshare}/ui" \\
#{opt_libexec}/unison \\
"$@"
EOS
end
test do
ohai "Setting up project and downloading base..."
(testpath/"setup.md").write <<~EOS
```ucm
scratch/main> project.create proj
```
```unison
helloWorld = do printLine "Hello, World!"
```
```ucm
proj/main> add
```
EOS
system "ucm", "transcript", "--save-codebase-to", testpath/"codebase", testpath/"setup.md"
ohai "Running helloWorld..."
(testpath/"run.md").write <<~EOS
```ucm
proj/main> run helloWorld
```
EOS
system "ucm", "transcript.fork", "--codebase", testpath/"codebase", testpath/"run.md"
end
end