-
-
Notifications
You must be signed in to change notification settings - Fork 12.1k
/
scm-manager.rb
51 lines (43 loc) 路 1.55 KB
/
scm-manager.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
class ScmManager < Formula
desc "Manage Git, Mercurial, and Subversion repos over HTTP"
homepage "https://www.scm-manager.org"
url "https://packages.scm-manager.org/repository/releases/sonia/scm/packaging/unix/3.1.0/unix-3.1.0.tar.gz"
sha256 "889ffe03642de0cc543e36aa8449ab58104b1d0d5521dbc055209c019e4922b5"
license all_of: ["Apache-2.0", "MIT"]
livecheck do
url "https://scm-manager.org/download/"
regex(/href=.*?unix[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 cellar: :any_skip_relocation, all: "e65447c4e4afb2e0e1b8cc7505ace578fe20b9a7df450711e069bada2e42a0e2"
end
depends_on "jsvc"
depends_on "openjdk"
def install
# Replace pre-built `jsvc` with formula to add Apple Silicon support
inreplace "bin/scm-server", %r{ \$BASEDIR/libexec/jsvc-.*"}, " #{Formula["jsvc"].opt_bin}/jsvc\""
rm Dir["libexec/jsvc-*"]
libexec.install Dir["*"]
env = Language::Java.overridable_java_home_env
env["BASEDIR"] = libexec
env["REPO"] = libexec/"lib"
(bin/"scm-server").write_env_script libexec/"bin/scm-server", env
end
service do
run [opt_bin/"scm-server"]
end
test do
port = free_port
cp libexec/"conf/config.yml", testpath
inreplace testpath/"config.yml" do |s|
s.gsub! "./work", testpath/"work"
s.gsub! "port: 8080", "port: #{port}"
end
ENV["JETTY_BASE"] = testpath
pid = fork { exec bin/"scm-server" }
sleep 15
assert_match "<title>SCM-Manager</title>", shell_output("curl http://localhost:#{port}/scm/")
ensure
Process.kill "TERM", pid
end
end