Sha256: 82bcb2402e051869f871b96e94d7ccafbb124bc450dda0f99ca13d72d9d3b7e9

Contents?: true

Size: 969 Bytes

Versions: 13

Compression:

Stored size: 969 Bytes

Contents

# frozen_string_literal: true

require 'forwardable'

module AppInfo
  # iOS Framework parser
  class Framework
    extend Forwardable

    def self.parse(path, name = 'Frameworks')
      files = Dir.glob(::File.join(path, name.to_s, '*'))
      return [] if files.empty?

      files.sort.each_with_object([]) do |file, obj|
        obj << new(file)
      end
    end

    attr_reader :file

    def_delegators :info, :display_name, :bundle_name, :release_version, :build_version,
                   :identifier, :bundle_id, :min_sdk_version, :device_type

    def initialize(file)
      @file = file
    end

    def name
      ::File.basename(file)
    end

    def macho
      return unless lib?

      require 'macho'
      MachO.open(file)
    end

    def lib?
      ::File.file?(file)
    end

    def info
      @info ||= InfoPlist.new(::File.join(file, 'Info.plist'))
    end

    def to_s
      "<#{self.class}:#{object_id} @name=#{name}>"
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
app-info-3.3.0 lib/app_info/ipa/framework.rb
app-info-3.2.0 lib/app_info/ipa/framework.rb
app-info-3.2.0.beta1 lib/app_info/ipa/framework.rb
app-info-3.1.4 lib/app_info/ipa/framework.rb
app-info-3.1.3 lib/app_info/ipa/framework.rb
app-info-3.1.2 lib/app_info/ipa/framework.rb
app-info-3.1.1 lib/app_info/ipa/framework.rb
app-info-3.1.0 lib/app_info/ipa/framework.rb
app-info-3.0.0 lib/app_info/ipa/framework.rb
app-info-3.0.0.beta4 lib/app_info/ipa/framework.rb
app-info-3.0.0.beta3 lib/app_info/ipa/framework.rb
app-info-3.0.0.beta2 lib/app_info/ipa/framework.rb
app-info-3.0.0.beta1 lib/app_info/ipa/framework.rb