Class: RunLoop::Ipa
- Inherits:
-
Object
- Object
- RunLoop::Ipa
- Defined in:
- lib/run_loop/ipa.rb
Overview
A model of the an .ipa - a application binary for iOS devices.
Instance Attribute Summary collapse
-
#bundle_identifier ⇒ String
readonly
The bundle identifier of this ipa.
-
#path ⇒ String
readonly
The path to this .ipa.
Instance Method Summary collapse
-
#executable_name ⇒ String
Inspects the app’s Info.plist for the executable name.
-
#initialize(path_to_ipa) ⇒ Calabash::Ipa
constructor
Create a new ipa instance.
Constructor Details
#initialize(path_to_ipa) ⇒ Calabash::Ipa
Create a new ipa instance.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/run_loop/ipa.rb', line 22 def initialize(path_to_ipa) unless File.exist? path_to_ipa raise "Expected an ipa at '#{path_to_ipa}'" end unless path_to_ipa.end_with?('.ipa') raise "Expected '#{path_to_ipa}' to be an .ipa" end @path = path_to_ipa end |
Instance Attribute Details
#bundle_identifier ⇒ String (readonly)
The bundle identifier of this ipa.
15 16 17 |
# File 'lib/run_loop/ipa.rb', line 15 def bundle_identifier @bundle_identifier end |
#path ⇒ String (readonly)
The path to this .ipa.
9 10 11 |
# File 'lib/run_loop/ipa.rb', line 9 def path @path end |
Instance Method Details
#executable_name ⇒ String
Inspects the app’s Info.plist for the executable name.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/run_loop/ipa.rb', line 71 def executable_name if bundle_dir.nil? || !File.exist?(bundle_dir) raise "Expected a '#{File.basename(path).split('.').first}.app'\nat path '#{payload_dir}'" end @executable_name ||= lambda { info_plist_path = File.join(bundle_dir, 'Info.plist') unless File.exist? info_plist_path raise "Expected an 'Info.plist' at '#{bundle_dir}'" end name = plist_buddy.plist_read('CFBundleExecutable', info_plist_path) unless name raise "Expected key 'CFBundleExecutable' in '#{info_plist_path}'" end name }.call end |