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.38.4/gitbucket.war"
sha256 "d293f5e12c2f10592f950bac046880556973c6b903cd84aee2a55b68d82e8eea"
license "Apache-2.0"
bottle do
sha256 cellar: :any_skip_relocation, all: "c1a2c3f79bb3487ead081c03a36143233976532f6302d40b2b9c76c87a12ef75"
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").exclude?("Exception")
end
end