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



41
42
43
44
45
46
47
48
# File 'lib/run_loop/environment.rb', line 41

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)


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

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

.debug_read?Boolean

Returns true if read debugging is enabled.

Returns:

  • (Boolean)


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

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



68
69
70
71
72
73
74
75
# File 'lib/run_loop/environment.rb', line 68

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.



55
56
57
58
59
60
61
62
# File 'lib/run_loop/environment.rb', line 55

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.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/run_loop/environment.rb', line 89

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.



27
28
29
# File 'lib/run_loop/environment.rb', line 27

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.



35
36
37
38
# File 'lib/run_loop/environment.rb', line 35

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

.uidInteger

Returns the user’s Unix uid.

Returns:

  • (Integer)

    The user’s Unix uid as an integer.



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

def self.uid
  `id -u`.strip.to_i
end

.xtc?Boolean

Returns true if we are running on the XTC

Returns:

  • (Boolean)


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

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