Class: RunLoop::Environment

Inherits:
Object
  • Object
show all
Defined in:
lib/run_loop/environment.rb

Class Method Summary collapse

Class Method Details

.bundle_idObject

Returns the value of BUNDLE_ID



35
36
37
38
39
40
41
42
# File 'lib/run_loop/environment.rb', line 35

def self.bundle_id
  value = ENV['BUNDLE_ID']
  if !value || value == ''
    nil
  else
    value
  end
end

.debug?Boolean

Returns true if debugging is enabled.

Returns:

  • (Boolean)


5
6
7
# File 'lib/run_loop/environment.rb', line 5

def self.debug?
  ENV['DEBUG'] == '1'
end

.debug_read?Boolean

Returns true if read debugging is enabled.

Returns:

  • (Boolean)


10
11
12
# File 'lib/run_loop/environment.rb', line 10

def self.debug_read?
  ENV['DEBUG_READ'] == '1'
end

.developer_dirObject

Note:

Never call this directly. Always create an XCTool instance and allow it to derive the path to the Xcode toolchain.

Returns the value of DEVELOPER_DIR



62
63
64
65
66
67
68
69
# File 'lib/run_loop/environment.rb', line 62

def self.developer_dir
  value = ENV['DEVELOPER_DIR']
  if !value || value == ''
    nil
  else
    value
  end
end

.path_to_app_bundleObject

Returns to the path to the app bundle (simulator builds).

Both APP_BUNDLE_PATH and APP are checked and in that order.

Use of APP_BUNDLE_PATH is deprecated and will be removed.



49
50
51
52
53
54
55
56
# File 'lib/run_loop/environment.rb', line 49

def self.path_to_app_bundle
  value = ENV['APP_BUNDLE_PATH'] || ENV['APP']
  if !value || value == ''
    nil
  else
    value
  end
end

.sim_post_launch_waitObject

Returns the value of CAL_SIM_POST_LAUNCH_WAIT

Controls how long to wait after the simulator is opened.

The default wait time is 1.0. This was arrived at through testing.

In CoreSimulator environments, the iOS Simulator starts many async processes that must be allowed to finish before we start operating on the simulator. Until we find the right combination of processes to wait for, this variable will give us the opportunity to control how long we wait.

Essential for managed envs like Travis + Jenkins and on slower machines.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/run_loop/environment.rb', line 83

def self.sim_post_launch_wait
  value = ENV['CAL_SIM_POST_LAUNCH_WAIT']
  float = nil
  begin
    float = value.to_f
  rescue NoMethodError => _

  end

  if float.nil? || float == 0.0
    nil
  else
    float
  end
end

.trace_templateObject

Returns the value of TRACE_TEMPLATE; the Instruments template to use during testing.



21
22
23
# File 'lib/run_loop/environment.rb', line 21

def self.trace_template
  ENV['TRACE_TEMPLATE']
end

.uia_timeoutObject

Returns the value of UIA_TIMEOUT. Use this control how long to wait for instruments to launch and attach to your application.

Non-empty values are converted to a float.



29
30
31
32
# File 'lib/run_loop/environment.rb', line 29

def self.uia_timeout
  timeout = ENV['UIA_TIMEOUT']
  timeout ? timeout.to_f : nil
end

.xtc?Boolean

Returns true if we are running on the XTC

Returns:

  • (Boolean)


15
16
17
# File 'lib/run_loop/environment.rb', line 15

def self.xtc?
  ENV['XAMARIN_TEST_CLOUD'] == '1'
end