49 lines
1.2 KiB
Ruby
49 lines
1.2 KiB
Ruby
class Polynote < Formula
|
|
desc "Polyglot notebook with first-class Scala support"
|
|
homepage "https://polynote.org/"
|
|
url "https://github.com/polynote/polynote/releases/download/0.3.12/polynote-dist.tar.gz"
|
|
sha256 "09e75030fc168f715351ed6afd88b56fab00ea6611861b9143a40569c71e2cb2"
|
|
license "Apache-2.0"
|
|
|
|
bottle :unneeded
|
|
|
|
depends_on "openjdk"
|
|
|
|
def install
|
|
libexec.install Dir["*"]
|
|
|
|
(bin/"polynote").write_env_script libexec/"polynote.jar", Language::Java.overridable_java_home_env
|
|
end
|
|
|
|
test do
|
|
mkdir testpath/"notebooks"
|
|
|
|
assert_predicate bin/"polynote", :exist?
|
|
assert_predicate bin/"polynote", :executable?
|
|
|
|
output = shell_output("#{bin}/polynote version 2>&1", 1)
|
|
assert_match "Unknown command version", output
|
|
|
|
port = free_port
|
|
(testpath/"config.yml").write <<~EOS
|
|
listen:
|
|
host: 127.0.0.1
|
|
port: #{port}
|
|
storage:
|
|
dir: #{testpath}/notebooks
|
|
EOS
|
|
|
|
begin
|
|
pid = fork do
|
|
exec bin/"polynote", "--config", "#{testpath}/config.yml"
|
|
end
|
|
sleep 5
|
|
|
|
assert_match "<title>Polynote</title>", shell_output("curl -s 127.0.0.1:#{port}")
|
|
ensure
|
|
Process.kill("TERM", pid)
|
|
Process.wait(pid)
|
|
end
|
|
end
|
|
end
|