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.36.2/gitbucket.war"
sha256 "d22089c0ba131c82c70c55bc9427b2ec095098815f96ca31f88edd7c2882d62d"
license "Apache-2.0"
bottle do
sha256 cellar: :any_skip_relocation, all: "e36a21cee810ab68ae0fa938fbbf070262a8d2d0032725d8fa6cc0a8648fa1da"
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