51 lines
1.5 KiB
Ruby
51 lines
1.5 KiB
Ruby
class JenkinsLts < Formula
|
|
desc "Extendable open source continuous integration server"
|
|
homepage "https://www.jenkins.io/"
|
|
url "https://get.jenkins.io/war-stable/2.375.1/jenkins.war"
|
|
sha256 "e96ae7f59d8a009bdbf3551d5e9facd97ff8a6d404c7ea2438ef267988d53427"
|
|
license "MIT"
|
|
|
|
livecheck do
|
|
url "https://www.jenkins.io/download/"
|
|
regex(%r{href=.*?/war-stable/v?(\d+(?:\.\d+)+)/jenkins\.war}i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, all: "3028e675c3c37823a59f4b4108eb046ee38981ed5d3166f1e0a08a2a533e6806"
|
|
end
|
|
|
|
depends_on "openjdk@17"
|
|
|
|
def install
|
|
system "#{Formula["openjdk@17"].opt_bin}/jar", "xvf", "jenkins.war"
|
|
libexec.install "jenkins.war", "WEB-INF/lib/cli-#{version}.jar"
|
|
bin.write_jar_script libexec/"jenkins.war", "jenkins-lts", java_version: "17"
|
|
bin.write_jar_script libexec/"cli-#{version}.jar", "jenkins-lts-cli", java_version: "17"
|
|
end
|
|
|
|
def caveats
|
|
<<~EOS
|
|
Note: When using launchctl the port will be 8080.
|
|
EOS
|
|
end
|
|
|
|
service do
|
|
run [Formula["openjdk@17"].opt_bin/"java", "-Dmail.smtp.starttls.enable=true", "-jar", opt_libexec/"jenkins.war",
|
|
"--httpListenAddress=127.0.0.1", "--httpPort=8080"]
|
|
end
|
|
|
|
test do
|
|
ENV["JENKINS_HOME"] = testpath
|
|
ENV.prepend "_JAVA_OPTIONS", "-Djava.io.tmpdir=#{testpath}"
|
|
|
|
port = free_port
|
|
fork do
|
|
exec "#{bin}/jenkins-lts --httpPort=#{port}"
|
|
end
|
|
sleep 60
|
|
|
|
output = shell_output("curl localhost:#{port}/")
|
|
assert_match(/Welcome to Jenkins!|Unlock Jenkins|Authentication required/, output)
|
|
end
|
|
end
|