49 lines
1.6 KiB
Ruby
49 lines
1.6 KiB
Ruby
class Unrar < Formula
|
|
desc "Extract, view, and test RAR archives"
|
|
homepage "https://www.rarlab.com/"
|
|
url "https://www.rarlab.com/rar/unrarsrc-6.0.1.tar.gz"
|
|
sha256 "43e4d3ac762e2f58bfa9e37693efa342c1363eb1029fab409dfdf69171201450"
|
|
|
|
livecheck do
|
|
url "https://www.rarlab.com/rar_add.htm"
|
|
regex(/href=.*?unrarsrc[._-]v?(\d+(?:\.\d+)+)\.t/i)
|
|
end
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "b3137b509d177d0f1a48d19e0ee5526a62daca75bb25bc07e02815e651314dd2" => :catalina
|
|
sha256 "0460123b46e8eaeeca744c034ce95a28e890313dfbd73675ca71ecb961f4d287" => :mojave
|
|
sha256 "b482ba1dccf93e0819649b8cff67f967bad0562df2e71b0168d488ea71829868" => :high_sierra
|
|
end
|
|
|
|
def install
|
|
# upstream doesn't particularly care about their unix targets,
|
|
# so we do the dirty work of renaming their shared objects to
|
|
# dylibs for them.
|
|
inreplace "makefile", "libunrar.so", "libunrar.dylib"
|
|
|
|
system "make"
|
|
bin.install "unrar"
|
|
|
|
# Explicitly clean up for the library build to avoid an issue with an
|
|
# apparent implicit clean which confuses the dependencies.
|
|
system "make", "clean"
|
|
system "make", "lib"
|
|
lib.install shared_library("libunrar")
|
|
end
|
|
|
|
test do
|
|
contentpath = "directory/file.txt"
|
|
rarpath = testpath/"archive.rar"
|
|
data = "UmFyIRoHAM+QcwAADQAAAAAAAACaCHQggDIACQAAAAkAAAADtPej1LZwZE" \
|
|
"QUMBIApIEAAGRpcmVjdG9yeVxmaWxlLnR4dEhvbWVicmV3CsQ9ewBABwA="
|
|
|
|
rarpath.write data.unpack1("m")
|
|
assert_equal contentpath, `#{bin}/unrar lb #{rarpath}`.strip
|
|
assert_equal 0, $CHILD_STATUS.exitstatus
|
|
|
|
system "#{bin}/unrar", "x", rarpath, testpath
|
|
assert_equal "Homebrew\n", (testpath/contentpath).read
|
|
end
|
|
end
|