Sha256: 0f6bb8c6bdf222a36212900c3f093e658a4edf828439660ce453aca4e3e91a43
Contents?: true
Size: 1.7 KB
Versions: 23
Compression:
Stored size: 1.7 KB
Contents
require 'hackmac/plist' require 'pathname' require 'tins/string_version' module Hackmac class Kext include Hackmac::Plist include Tins::StringVersion def initialize(path:, config: nil) @path = path info = Pathname.new(@path) + 'Contents/Info.plist' @plist = File.open(info, encoding: 'UTF-8') { |f| ::Plist.parse_xml(f) } @config = config end attr_reader :path def identifier CFBundleIdentifier() end def name CFBundleName() || File.basename(identifier) end def version unless @version if version = CFBundleShortVersionString() begin @version = Version.new(version) rescue ArgumentError @version = version end end end @version end def remote_kext return @remote_kext if @remote_kext if @config source = @config.kext.sources[name] or return case when github = source&.github? auth = [ @config.github.user, @config.github.access_token ].compact auth.empty? and auth = nil suffix = case debug = source.debug? when true then 'DEBUG' when false then 'RELEASE' when nil then nil end @remote_kext = Hackmac::GithubSource.new(github, auth: auth, suffix: suffix) when download = source&.download @remote_kext = Hackmac::URLDownload.new(download.name, download.version, download.url) end end end def remote_version remote_kext&.version end def inspect "#<#{self.class}: #{to_s}>" end def to_s "#{name} #{version}" end end end
Version data entries
23 entries across 23 versions & 1 rubygems
Version | Path |
---|---|
hackmac-1.0.2 | lib/hackmac/kext.rb |
hackmac-1.0.1 | lib/hackmac/kext.rb |
hackmac-1.0.0 | lib/hackmac/kext.rb |