homebrew-core/Formula/gitbucket.rb

49 lines
1.3 KiB
Ruby

class Gitbucket < Formula
desc "Git platform powered by Scala offering"
homepage "https://github.com/gitbucket/gitbucket"
url "https://github.com/gitbucket/gitbucket/releases/download/4.37.2/gitbucket.war"
sha256 "b6245065c504a6bd2135a76d0fb0e2495d9d2b4221879491b0bafb960df02cdc"
license "Apache-2.0"
bottle do
sha256 cellar: :any_skip_relocation, all: "cc7a64c312dc42279b1934263fd487500da5066d379fbf38b5d864ef970f3c39"
end
head do
url "https://github.com/gitbucket/gitbucket.git", branch: "master"
depends_on "sbt" => :build
end
depends_on "openjdk"
def install
if build.head?
system "sbt", "executable"
libexec.install "target/executable/gitbucket.war"
else
libexec.install "gitbucket.war"
end
end
def caveats
<<~EOS
Note: When using `brew services` the port will be 8080.
EOS
end
service do
run [Formula["openjdk"].opt_bin/"java", "-Dmail.smtp.starttls.enable=true", "-jar", opt_libexec/"gitbucket.war",
"--host=127.0.0.1", "--port=8080"]
end
test do
java = Formula["openjdk"].opt_bin/"java"
fork do
$stdout.reopen(testpath/"output")
exec "#{java} -jar #{libexec}/gitbucket.war --port=#{free_port}"
end
sleep 12
File.read("output") !~ /Exception/
end
end