Class: Lagunitas::App

Inherits:
Object
  • Object
show all
Defined in:
lib/lagunitas.ext.rb,
lib/lagunitas.patch.rb

Instance Method Summary collapse

Constructor Details

#initialize(path, root) ⇒ App

Returns a new instance of App.



5
6
7
8
# File 'lib/lagunitas.ext.rb', line 5

def initialize(path, root)
  @path = path
  @root = root
end

Instance Method Details

#devicesObject



20
21
22
# File 'lib/lagunitas.ext.rb', line 20

def devices
  mobileprovision['ProvisionedDevices'] if mobileprovision
end

#distribution_nameObject



23
24
25
26
# File 'lib/lagunitas.ext.rb', line 23

def distribution_name
  # mobileprovision['DeveloperCertificates'] if mobileprovision
  "#{ mobileprovision['Name'] }: #{ mobileprovision['TeamName'] }" if mobileprovision
end

#iconsObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/lagunitas.patch.rb', line 8

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
    # info['CFBundleIcons'] might be nil
    nil
  end
end

#metadataObject



27
28
29
30
# File 'lib/lagunitas.ext.rb', line 27

def 
  return if !metadata?
   ||= CFPropertyList.native_types(CFPropertyList::List.new(file: File.join(@root, 'iTunesMetadata.plist')).value)
end

#metadata?Boolean

Returns:

  • (Boolean)


31
32
33
34
# File 'lib/lagunitas.ext.rb', line 31

def metadata?
  return true if 
  File.exists? File.join @root, 'iTunesMetadata.plist'
end

#mobileprovisionObject



12
13
14
15
# File 'lib/lagunitas.ext.rb', line 12

def mobileprovision
  return if !mobileprovision?
  @mobileprovision ||= CFPropertyList.native_types CFPropertyList::List.new(:data => `security cms -D -i #{File.join @path, 'embedded.mobileprovision'}`).value
end

#mobileprovision?Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/lagunitas.ext.rb', line 16

def mobileprovision?
  return true if @mobileprovision
  File.exists? File.join @path, 'embedded.mobileprovision'
end

#nameObject



9
10
11
# File 'lib/lagunitas.ext.rb', line 9

def name
  @info['CFBundleName']
end

#release_typeObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/lagunitas.ext.rb', line 35

def release_type
  @release_type ||= begin
    if mobileprovision?
      if devices
        'adhoc'
      else
        'inhouse'
      end
    elsif metadata?
      'store'
    else
      'adhoc'
    end
  end
end