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.1/gitbucket.war"
sha256 "51ee6b7f560d2a37ad6c4aacbbe163163213adae33911b561e50b4119c7aa77a"
license "Apache-2.0"
bottle do
sha256 cellar: :any_skip_relocation, all: "a4b4539b09333d1f9d2ad3122978324efd1522bb91bd2ae3d603ab0f6d49be06"
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