homebrew-core/Formula/gitbucket.rb
2015-06-27 19:28:34 +08:00

65 lines
1.9 KiB
Ruby

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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>gitbucket</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/java</string>
<string>-Dmail.smtp.starttls.enable=true</string>
<string>-jar</string>
<string>#{opt_libexec}/gitbucket.war</string>
<string>--host=127.0.0.1</string>
<string>--port=8080</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
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