Class: FIR::Parser::Ipa::App

Inherits:
Object
  • Object
show all
Defined in:
lib/fir/util/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ App

Returns a new instance of App.



60
61
62
# File 'lib/fir/util/parser.rb', line 60

def initialize(path)
  @path = path
end

Instance Method Details

#devicesObject



126
127
128
# File 'lib/fir/util/parser.rb', line 126

def devices
  mobileprovision['ProvisionedDevices'] if has_mobileprovision?
end

#display_nameObject



77
78
79
# File 'lib/fir/util/parser.rb', line 77

def display_name
  info['CFBundleDisplayName']
end

#distribution_nameObject



130
131
132
# File 'lib/fir/util/parser.rb', line 130

def distribution_name
  "#{mobileprovision['Name']} - #{mobileprovision['TeamName']}" if has_mobileprovision?
end

#has_mobileprovision?Boolean

Returns:

  • (Boolean)


114
115
116
# File 'lib/fir/util/parser.rb', line 114

def has_mobileprovision?
  File.file? mobileprovision_path
end

#hide_developer_certificatesObject



122
123
124
# File 'lib/fir/util/parser.rb', line 122

def hide_developer_certificates
  mobileprovision.delete('DeveloperCertificates') if has_mobileprovision?
end

#iconsObject



89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/fir/util/parser.rb', line 89

def icons
  @icons ||= begin
    icons = []
    info['CFBundleIcons']['CFBundlePrimaryIcon']['CFBundleIconFiles'].each do |name|
      icons << get_image(name)
      icons << get_image("#{name}@2x")
    end
    icons.delete_if { |i| !i }
  rescue NoMethodError
    []
  end
end

#identifierObject



73
74
75
# File 'lib/fir/util/parser.rb', line 73

def identifier
  info['CFBundleIdentifier']
end

#infoObject



64
65
66
67
# File 'lib/fir/util/parser.rb', line 64

def info
  @info ||= CFPropertyList.native_types(
    CFPropertyList::List.new(file: File.join(@path, 'Info.plist')).value)
end

#mobileprovisionObject



102
103
104
105
106
107
108
109
110
111
112
# File 'lib/fir/util/parser.rb', line 102

def mobileprovision
  return unless has_mobileprovision?
  return @mobileprovision if @mobileprovision

  cmd = "security cms -D -i \"#{mobileprovision_path}\""
  begin
    @mobileprovision = CFPropertyList.native_types(CFPropertyList::List.new(data: `#{cmd}`).value)
  rescue CFFormatError
    @mobileprovision = {}
  end
end

#mobileprovision_pathObject



118
119
120
# File 'lib/fir/util/parser.rb', line 118

def mobileprovision_path
  @mobileprovision_path ||= File.join(@path, 'embedded.mobileprovision')
end

#nameObject



69
70
71
# File 'lib/fir/util/parser.rb', line 69

def name
  info['CFBundleName']
end

#release_typeObject



134
135
136
137
138
139
140
141
142
# File 'lib/fir/util/parser.rb', line 134

def release_type
  if has_mobileprovision?
    if devices
      'adhoc'
    else
      'inhouse'
    end
  end
end

#short_versionObject



85
86
87
# File 'lib/fir/util/parser.rb', line 85

def short_version
  info['CFBundleShortVersionString']
end

#versionObject



81
82
83
# File 'lib/fir/util/parser.rb', line 81

def version
  info['CFBundleVersion']
end