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.2/gitbucket.war"
sha256 "5fc84406cf9dd7fb4326eb4569e750777b3ce4bc1d62fcab28ed2032534a092d"
license "Apache-2.0"
bottle do
sha256 cellar: :any_skip_relocation, all: "98b97f4282dcec2c311c2ed9c35e3e43fdbf2340215b124ff36e59fa6372e6f9"
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