Class: IPASend::IPA

Inherits:
Object
  • Object
show all
Defined in:
lib/ipasend/ipa.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ IPA

Returns a new instance of IPA.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/ipasend/ipa.rb', line 11

def initialize(options)
  @ipa_file = Tempfile.new(['APP', '.ipa'])
  @archive_path = options.archive_path

  info_path = File.join(@archive_path, 'Info.plist')

  @info_plist = Plist::parse_xml(info_path)
  if @info_plist.nil?
    puts "!!! Invalid archive path #{@archive_path}"
    exit 1
  end

  @props = @info_plist['ApplicationProperties']

  @app_path = File.join(@archive_path, 'Products', @props['ApplicationPath'])
  @name = File.basename(@app_path, '.app')

  puts `/usr/bin/xcrun -sdk iphoneos PackageApplication "#{@app_path}" -o "#{@ipa_file.path}"`

  if $?.to_i != 0
    puts "!! Error while calling xcrun"
    exit 1
  end

  Dir.chdir @app_path
  icon_path = Dir['**/iTunesArtwork@2x'].first || Dir['**/Icon*@2x.png'].first

  image_path = options.image_path || icon_path

  if image_path
    image_path = File.expand_path(image_path)
    image = Magick::Image.read(image_path).first

    @large_image = image.resize_to_fit(144)
    @small_image = image.resize_to_fit(72)
  end
end

Instance Attribute Details

#app_pathObject (readonly)

Returns the value of attribute app_path.



8
9
10
# File 'lib/ipasend/ipa.rb', line 8

def app_path
  @app_path
end

#dataObject (readonly)

Returns the value of attribute data.



8
9
10
# File 'lib/ipasend/ipa.rb', line 8

def data
  @data
end

#info_plistObject (readonly)

Returns the value of attribute info_plist.



8
9
10
# File 'lib/ipasend/ipa.rb', line 8

def info_plist
  @info_plist
end

#large_imageObject (readonly)

Returns the value of attribute large_image.



9
10
11
# File 'lib/ipasend/ipa.rb', line 9

def large_image
  @large_image
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/ipasend/ipa.rb', line 8

def name
  @name
end

#small_imageObject (readonly)

Returns the value of attribute small_image.



9
10
11
# File 'lib/ipasend/ipa.rb', line 9

def small_image
  @small_image
end

Instance Method Details

#bundle_identifierObject



61
62
63
# File 'lib/ipasend/ipa.rb', line 61

def bundle_identifier
  @props['CFBundleIdentifier']
end

#bundle_short_versionObject



53
54
55
# File 'lib/ipasend/ipa.rb', line 53

def bundle_short_version
  @props['CFBundleShortVersionString']
end

#bundle_versionObject



57
58
59
# File 'lib/ipasend/ipa.rb', line 57

def bundle_version
  @props['CFBundleVersion']
end