-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #420 from calabash/feature/improve-installed-app-c…
…heck-for-xcode-7-sims Improve installed app check for Xcode 7 simulators
- Loading branch information
Showing
21 changed files
with
282 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
module RunLoop | ||
|
||
# @!visibility private | ||
# An interface to the `simctl` command line tool for CoreSimulator. | ||
# | ||
# Replacement for SimControl. | ||
class Simctl | ||
|
||
# @!visibility private | ||
DEFAULTS = { | ||
:timeout => RunLoop::Environment.ci? ? 90 : 30, | ||
:log_cmd => true | ||
} | ||
|
||
# @!visibility private | ||
SIMCTL_PLIST_DIR = lambda { | ||
dirname = File.dirname(__FILE__) | ||
joined = File.join(dirname, '..', '..', 'plists', 'simctl') | ||
File.expand_path(joined) | ||
}.call | ||
|
||
# @!visibility private | ||
def self.uia_automation_plist | ||
File.join(SIMCTL_PLIST_DIR, 'com.apple.UIAutomation.plist') | ||
end | ||
|
||
# @!visibility private | ||
def self.uia_automation_plugin_plist | ||
File.join(SIMCTL_PLIST_DIR, 'com.apple.UIAutomationPlugIn.plist') | ||
end | ||
|
||
# @!visibility private | ||
attr_accessor :device | ||
|
||
# @!visibility private | ||
# | ||
# @param [RunLoop::Device] device Cannot be nil. | ||
def initialize(device) | ||
@device = device | ||
end | ||
|
||
# @!visibility private | ||
def to_s | ||
"#<Simctl: #{device.name} #{device.udid}>" | ||
end | ||
|
||
# @!visibility private | ||
def inspect | ||
to_s | ||
end | ||
|
||
# @!visibility private | ||
# | ||
# This method is not supported on Xcode < 7 - returns nil. | ||
# | ||
# @param [String] bundle_id The CFBundleIdentifier of the app. | ||
# @return [String] The path to the .app bundle if it exists; nil otherwise. | ||
def app_container(bundle_id) | ||
return nil if !xcode.version_gte_7? | ||
cmd = ["simctl", "get_app_container", device.udid, bundle_id] | ||
hash = execute(cmd, DEFAULTS) | ||
|
||
exit_status = hash[:exit_status] | ||
if exit_status != 0 | ||
nil | ||
else | ||
hash[:out].strip | ||
end | ||
end | ||
|
||
private | ||
|
||
# @!visibility private | ||
def execute(array, options) | ||
merged = DEFAULTS.merge(options) | ||
xcrun.exec(array, merged) | ||
end | ||
|
||
# @!visibility private | ||
def xcrun | ||
@xcrun ||= RunLoop::Xcrun.new | ||
end | ||
|
||
# @!visibility private | ||
def xcode | ||
@xcode ||= RunLoop::Xcode.new | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.