Sha256: 139560b39254f489a65b3993800f1adda688c737906b0aafc72bdbd8fdb1c213
Contents?: true
Size: 1.4 KB
Versions: 3
Compression:
Stored size: 1.4 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 if source = @config.kext.sources[name] and github = source&.github auth = [ @config.github.user, @config.github.access_token ].compact auth.empty? and auth = nil suffix = source.debug? ? 'DEBUG' : 'RELEASE' @remote_kext = Hackmac::KextSource.new(github, auth: auth, suffix: suffix) 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hackmac-0.6.2 | lib/hackmac/kext.rb |
hackmac-0.6.1 | lib/hackmac/kext.rb |
hackmac-0.6.0 | lib/hackmac/kext.rb |