class Gitbucket < Formula desc "GitHub clone" homepage "https://github.com/takezoe/gitbucket" url "https://github.com/takezoe/gitbucket/releases/download/3.4/gitbucket.war" sha256 "a43f8a5d92381e9508a7c85ab3e4954f6038465edc7d370c083b121f0dc08ad6" bottle do cellar :any sha256 "11ec3f54dca6e54515feaae91ed666dce516f0ad5586920934516fb18d38e25f" => :yosemite sha256 "e817a050e05128c5c30da71391e044997646e090611ac2bbe53a76ed249e7309" => :mavericks sha256 "aa767e27d98c81fe402588f0780d1f58b84b2042c5c2e43b0aa929f6dbfa1969" => :mountain_lion end head do url "https://github.com/takezoe/gitbucket.git" depends_on :ant => :build end def install if build.head? system "ant" libexec.install "war/target/gitbucket.war", "." else libexec.install "gitbucket.war" end end plist_options :manual => "java -jar #{HOMEBREW_PREFIX}/opt/gitbucket/libexec/gitbucket.war" def plist; <<-EOS.undent Label gitbucket ProgramArguments /usr/bin/java -Dmail.smtp.starttls.enable=true -jar #{opt_libexec}/gitbucket.war --host=127.0.0.1 --port=8080 RunAtLoad EOS end def caveats; <<-EOS.undent Note: When using launchctl the port will be 8080. EOS end test do io = IO.popen("java -jar #{libexec}/gitbucket.war") sleep 12 Process.kill("SIGINT", io.pid) Process.wait(io.pid) io.read !~ /Exception/ end end