Skip to content

Commit 8a1d4c5

Browse files
committed
update ruby file
1 parent e948f46 commit 8a1d4c5

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

Formula/zoomrecovery.rb

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,18 @@ class Zoomrecovery < Formula
77

88
depends_on "spoof-mac"
99

10-
def install
11-
# Replace any existing BAKED_VERSION="..." line (placeholder or baked value)
12-
# with the formula version string. Robust against both placeholder and
13-
# baked-version tarballs and avoids passing a Version object to inreplace.
14-
inreplace "zoomrecovery" do |s|
15-
s.gsub!(/VERSION_PLACEHOLDER/, version.to_s)
16-
s.gsub!(/BAKED_VERSION=["'].*?["']/, "BAKED_VERSION=\"#{version}\"")
10+
inreplace "zoomrecovery" do |s|
11+
replaced = false
12+
[
13+
/BAKED_VERSION\s*=\s*["'].*?["']/,
14+
/BAKED_VERSION\s*=\s*[0-9]+\.[0-9]+(?:\.[0-9]+)?/,
15+
/BAKED_VERSION\s*:\s*["'].*?["']/,
16+
/BAKED_VERSION\s*[:=]\s*["']?.*?["']?/
17+
].each do |rx|
18+
if s.sub!(rx, "BAKED_VERSION=\"#{version}\"")
19+
replaced = true
20+
break
21+
end
1722
end
18-
19-
chmod 0755, "zoomrecovery"
20-
bin.install "zoomrecovery"
21-
end
22-
23-
test do
24-
out = shell_output("#{bin}/zoomrecovery --version")
25-
assert_match version.to_s, out
26-
end
27-
end
23+
s.prepend("BAKED_VERSION=\"#{version}\"\n") unless replaced
24+
end

0 commit comments

Comments
 (0)