class Zucchini::Config
Public Class Methods
app()
click to toggle source
# File lib/zucchini/config.rb, line 22 def self.app device_name = ENV['ZUCCHINI_DEVICE'] || @@default_device_name device = devices[device_name] app_path = File.absolute_path(device['app'] || @@config['app'] || ENV['ZUCCHINI_APP']) if (device_name == 'iOS Simulator' || device['simulator']) && !File.exists?(app_path) raise "Can't find application at path #{app_path}" end app_path end
base_path()
click to toggle source
# File lib/zucchini/config.rb, line 6 def self.base_path @@base_path end
base_path=(base_path)
click to toggle source
# File lib/zucchini/config.rb, line 10 def self.base_path=(base_path) @@base_path = base_path @@config = YAML::load(ERB::new(File::read("#{base_path}/support/config.yml")).result) @@default_device_name = nil devices.each do |device_name, device| if device['default'] raise "Default device already provided" if @@default_device_name @@default_device_name = device_name end end end
default_device_name()
click to toggle source
# File lib/zucchini/config.rb, line 41 def self.default_device_name @@default_device_name end
device(device_name = nil)
click to toggle source
# File lib/zucchini/config.rb, line 45 def self.device(device_name = nil) device_name ||= @@default_device_name raise "Neither default device nor ZUCCHINI_DEVICE environment variable was set" unless device_name raise "Device '#{device_name}' not listed in config.yml" unless (device = devices[device_name]) { :name => device_name, :udid => device['UDID'], :screen => device['screen'], :simulator => device['simulator'], :orientation => device['orientation'] || 'portrait' } end
devices()
click to toggle source
# File lib/zucchini/config.rb, line 37 def self.devices @@config['devices'] end
resolution_name(dimension)
click to toggle source
# File lib/zucchini/config.rb, line 33 def self.resolution_name(dimension) @@config['resolutions'][dimension.to_i] end
template()
click to toggle source
# File lib/zucchini/config.rb, line 58 def self.template locations = [ `xcode-select -print-path`.gsub(/\n/, '') + "/Platforms/iPhoneOS.platform/Developer/Library/Instruments", "/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents" # Xcode 4.5 ].map do |start_path| "#{start_path}/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate" end locations.each { |path| return path if File.exists?(path) } raise "Can't find Instruments template (tried #{locations.join(', ')})" end