mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
16 lines
480 B
Ruby
16 lines
480 B
Ruby
![]() |
require_relative "uncompressed"
|
||
|
|
||
|
module UnpackStrategy
|
||
|
class LuaRock < Uncompressed
|
||
|
def self.can_extract?(path:, magic_number:)
|
||
|
return false unless Zip.can_extract?(path: path, magic_number: magic_number)
|
||
|
|
||
|
# Check further if the ZIP is a LuaRocks package.
|
||
|
out, = Open3.capture3("zipinfo", "-1", path)
|
||
|
out.encode(Encoding::UTF_8, invalid: :replace)
|
||
|
.split("\n")
|
||
|
.any? { |line| line.match?(%r{\A[^/]+.rockspec\Z}) }
|
||
|
end
|
||
|
end
|
||
|
end
|