Class: RunLoop::Ipa

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

Overview

A model of the an .ipa - a application binary for iOS devices.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path_to_ipa) ⇒ Calabash::Ipa

Create a new ipa instance.

Parameters:

  • path_to_ipa (String)

    The path the .ipa file.

Raises:

  • (RuntimeError)

    If the file does not exist.

  • (RuntimeError)

    If the file does not end in .ipa.



29
30
31
32
33
34
35
36
37
38
# File 'lib/run_loop/ipa.rb', line 29

def initialize(path_to_ipa)
  if !File.exist? path_to_ipa
    raise "Expected an ipa at '#{path_to_ipa}'"
  end

  if !RunLoop::Ipa.is_ipa?(path_to_ipa)
    raise "Expected '#{path_to_ipa}' have extension .ipa or be a zip archive"
  end
  @path = path_to_ipa
end

Instance Attribute Details

#pathString (readonly)

The path to this .ipa.

Returns:

  • (String)

    A path to this .ipa.



22
23
24
# File 'lib/run_loop/ipa.rb', line 22

def path
  @path
end

Class Method Details

.is_ipa?(path_to_ipa) ⇒ Boolean

Return true if the path_to_ipa is probably an .ipa

Returns:

  • (Boolean)


15
16
17
# File 'lib/run_loop/ipa.rb', line 15

def self.is_ipa?(path_to_ipa)
  path_to_ipa.end_with?('.ipa') || RunLoop::Ipa.is_zip_archive?(path_to_ipa)
end

.is_zip_archive?(path_to_ipa) ⇒ Boolean

Return true if the path_to_ipa to a zip archive

Returns:

  • (Boolean)


8
9
10
11
12
# File 'lib/run_loop/ipa.rb', line 8

def self.is_zip_archive?(path_to_ipa)
  hash = RunLoop::Shell.run_shell_command(["file", path_to_ipa],
                                          {log_cmd: true})
  hash[:out][/Zip archive data/]
end

Instance Method Details

#archesObject

Returns the arches for the binary.



76
77
78
# File 'lib/run_loop/ipa.rb', line 76

def arches
  app.arches
end

#bundle_identifierString

The bundle identifier of this ipa.

Returns:

  • (String)

    A string representation of this ipa’s CFBundleIdentifier



65
66
67
# File 'lib/run_loop/ipa.rb', line 65

def bundle_identifier
  app.bundle_identifier
end

#calabash_server_versionObject

Inspects the app’s executables for the server version @return a version instance



82
83
84
# File 'lib/run_loop/ipa.rb', line 82

def calabash_server_version
  app.calabash_server_version
end

#executable_nameString

Inspects the app’s Info.plist for the executable name.

Returns:

  • (String)

    The value of CFBundleExecutable.



71
72
73
# File 'lib/run_loop/ipa.rb', line 71

def executable_name
  app.executable_name
end