Class: XCSim::GetBundle
- Inherits:
-
Object
- Object
- XCSim::GetBundle
- Defined in:
- lib/xcsim/rbBundleInfo.rb
Overview
A class encapsulating logic of searching for an applciation bundle in #xcsim function (i.e. implementation of #xcsim bundle mode)
Instance Method Summary collapse
-
#initialize(deviceSet) ⇒ GetBundle
constructor
Initializes a GetBundle instance with a given device set of OSDevices type.
-
#withOptions(options) ⇒ Object
Performs search for the application bundle matching the provided options.
Constructor Details
#initialize(deviceSet) ⇒ GetBundle
Initializes a GetBundle instance with a given device set of OSDevices type
100 101 102 |
# File 'lib/xcsim/rbBundleInfo.rb', line 100 def initialize(deviceSet) @deviceSet = deviceSet end |
Instance Method Details
#withOptions(options) ⇒ Object
Performs search for the application bundle matching the provided options. See #xcsim description (Bundle Mode section) for more info.
Returns a BundleInfo object
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/xcsim/rbBundleInfo.rb', line 108 def withOptions() bundleID = [:bundleID] if bundleID == nil raise ArgumentError end os = osNamed([:os] || XCSim::defaultOSName) device = deviceNamed(os, [:device] || XCSim::defaultDeviceName) bundles = XCSim::parseInstalledBundles(device).values matchingBundles = bundles.select { |bundle| bundle.bundleID.end_with? bundleID } if matchingBundles.count > 1 raise NonUniqueBundleIDError.new(device, bundleID, matchingBundles.map { |b| b.bundleID }) elsif matchingBundles.empty? raise BundleNotFoundError.new(os, device, bundleID) else return matchingBundles.first end end |