module RunLoop::DetectAUT
@!visibility private
@!visibility private
@!visibility private
@!visibility private
Public Class Methods
detect_app_under_test(options)
click to toggle source
@!visibility private
# File lib/run_loop/detect_aut/detect.rb, line 7 def self.detect_app_under_test(options) app = self.detect_app(options) if app.is_a?(RunLoop::App) || app.is_a?(RunLoop::Ipa) { :app => app, :bundle_id => app.bundle_identifier, :is_ipa => app.is_a?(RunLoop::Ipa) } else { :app => nil, :bundle_id => app, :is_ipa => false } end end
Private Class Methods
app_from_constant()
click to toggle source
@!visibility private
# File lib/run_loop/detect_aut/detect.rb, line 145 def self.app_from_constant (defined?(APP_BUNDLE_PATH) && APP_BUNDLE_PATH) || (defined?(APP) && APP) end
app_from_environment()
click to toggle source
@!visibility private
# File lib/run_loop/detect_aut/detect.rb, line 133 def self.app_from_environment app_bundle_path = RunLoop::Environment.path_to_app_bundle candidate = app_bundle_path if app_bundle_path && !File.exist?(app_bundle_path) candidate = File.basename(app_bundle_path) end candidate || RunLoop::Environment.bundle_id end
app_from_options(options)
click to toggle source
@!visibility private
# File lib/run_loop/detect_aut/detect.rb, line 128 def self.app_from_options(options) options[:app] || options[:bundle_id] end
app_from_opts_or_env_or_constant(options)
click to toggle source
@!visibility private
# File lib/run_loop/detect_aut/detect.rb, line 151 def self.app_from_opts_or_env_or_constant(options) self.app_from_options(options) || self.app_from_environment || self.app_from_constant end
detect_app(options)
click to toggle source
@!visibility private
# File lib/run_loop/detect_aut/detect.rb, line 163 def self.detect_app(options) app = self.app_from_opts_or_env_or_constant(options) # Options or constant defined an instance of App or Ipa return app if app && (app.is_a?(RunLoop::App) || app.is_a?(RunLoop::Ipa)) # User provided no information, so we attempt to auto detect if app.nil? || app == "" return self.detector.app_for_simulator end extension = File.extname(app) if extension == ".ipa" && File.exist?(app) RunLoop::Ipa.new(app) elsif extension == ".app" && File.exist?(app) RunLoop::App.new(app) else # Probably a bundle identifier. app end end
detector()
click to toggle source
@!visibility private
# File lib/run_loop/detect_aut/detect.rb, line 158 def self.detector RunLoop::DetectAUT::Detect.new end