class SimCtl::DevicePath
Attributes
device[R]
Public Class Methods
new(device)
click to toggle source
# File lib/simctl/device_path.rb, line 5 def initialize(device) @device = device end
Public Instance Methods
device_plist()
click to toggle source
# File lib/simctl/device_path.rb, line 9 def device_plist @device_plist ||= File.join(home, 'device.plist') end
global_preferences_plist()
click to toggle source
# File lib/simctl/device_path.rb, line 13 def global_preferences_plist @global_preferences_plist ||= File.join(home, 'data/Library/Preferences/.GlobalPreferences.plist') end
home()
click to toggle source
# File lib/simctl/device_path.rb, line 17 def home @home ||= File.join(device_set_path, device.udid) end
launchctl()
click to toggle source
# File lib/simctl/device_path.rb, line 21 def launchctl @launchctl ||= File.join(runtime_root, 'bin/launchctl') end
preferences_plist()
click to toggle source
# File lib/simctl/device_path.rb, line 25 def preferences_plist @preferences_plist ||= File.join(home, 'data/Library/Preferences/com.apple.Preferences.plist') end
Private Instance Methods
device_set_path()
click to toggle source
# File lib/simctl/device_path.rb, line 33 def device_set_path return SimCtl.device_set_path unless SimCtl.device_set_path.nil? File.join(ENV['HOME'], 'Library/Developer/CoreSimulator/Devices') end
locate_runtime_root()
click to toggle source
# File lib/simctl/device_path.rb, line 38 def locate_runtime_root runtime_identifier = device.runtime.identifier [ Xcode::Path.runtime_profiles, '/Library/Developer/CoreSimulator/Profiles/Runtimes/' ].each do |parent_dir| Dir.glob(File.join(File.expand_path(parent_dir), '*')).each do |dir| plist_path = File.join(dir, 'Contents/Info.plist') next unless File.exist?(plist_path) info = CFPropertyList.native_types(CFPropertyList::List.new(file: plist_path).value) next unless info.is_a?(Hash) && (info['CFBundleIdentifier'] == runtime_identifier) root_path = File.join(dir, 'Contents/Resources/RuntimeRoot') return root_path if File.exist?(root_path) end end Xcode::Path.sdk_root end
runtime_root()
click to toggle source
# File lib/simctl/device_path.rb, line 58 def runtime_root @runtime_root ||= locate_runtime_root end