Sha256: e1a282f1e9808fd0231fcd6a95f5e9bd20821fcbba629c60a24816abf5f5d61a
Contents?: true
Size: 953 Bytes
Versions: 3
Compression:
Stored size: 953 Bytes
Contents
module Fontist module Utils module RpmExtractor def rpm_extract(resource) file = download_file(resource) extract_rpm_file(file) end private def extract_rpm_file(file) rpm = rpm_class.new(file) content = rpm.payload.read path = rpm_target_path(file.path, rpm.tags) File.write(path, content, mode: "wb") path end def rpm_class @rpm_class ||= begin require "arr-pm" RPM::File end end def rpm_target_path(archive, tags) basename = File.basename(archive, ".*") archive_format = tags[:payloadformat] compression_format = tags[:payloadcompressor] == "gzip" ? "gz" : tags[:payloadcompressor] filename = basename + "." + archive_format + "." + compression_format File.join(Dir.mktmpdir, filename) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fontist-1.8.6 | lib/fontist/utils/rpm_extractor.rb |
fontist-1.8.5 | lib/fontist/utils/rpm_extractor.rb |
fontist-1.8.4 | lib/fontist/utils/rpm_extractor.rb |