63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
# File 'lib/run_loop.rb', line 63
def self.run(options={})
if RunLoop::Instruments.new.instruments_app_running?
raise %q(The Instruments.app is open.
If the Instruments.app is open, the instruments command line tool cannot take
control of your application.
Please quit the Instruments.app and try again.)
end
uia_strategy = options[:uia_strategy]
if options[:script]
script = validate_script(options[:script])
else
if uia_strategy
script = default_script_for_uia_strategy(uia_strategy)
else
if options[:calabash_lite]
uia_strategy = :host
script = Core.script_for_key(:run_loop_host)
else
uia_strategy = :preferences
script = default_script_for_uia_strategy(uia_strategy)
end
end
end
unless uia_strategy
desired_script = options[:script]
if desired_script.is_a?(String)
uia_strategy = :host
elsif desired_script == :run_loop_host
uia_strategy = :host
elsif desired_script == :run_loop_fast_uia
uia_strategy = :preferences
elsif desired_script == :run_loop_shared_element
uia_strategy = :shared_element
else
raise "Inconsistent state: desired script #{desired_script} has not uia_strategy"
end
end
cloned_options = options.clone
cloned_options[:script] = script
cloned_options[:uia_strategy] = uia_strategy
if options[:xcode]
cloned_options[:xcode] = options[:xcode]
end
if options[:sim_control]
cloned_options[:sim_control] = options[:sim_control]
end
Core.run_with_options(cloned_options)
end
|