Class: RunLoop::Environment
- Inherits:
-
Object
- Object
- RunLoop::Environment
- Defined in:
- lib/run_loop/environment.rb
Class Method Summary collapse
-
.bundle_id ⇒ Object
Returns the value of BUNDLE_ID.
-
.cbxdevice ⇒ Object
Returns the value of CBXDEVICE.
-
.cbxsim ⇒ Object
Returns the value of CBXSIM.
-
.ci? ⇒ Boolean
Returns true if running in a CI environment.
-
.circle_ci? ⇒ Boolean
Returns true if running in Circle CI.
-
.codesign_identity ⇒ Object
Returns the value of CODESIGN_IDENTITY.
-
.debug? ⇒ Boolean
Returns true if debugging is enabled.
-
.debug_read? ⇒ Boolean
Returns true if read debugging is enabled.
-
.derived_data ⇒ Object
Returns the value of DERIVED_DATA which can be used to specify an alternative DerivedData directory.
-
.developer_dir ⇒ Object
Returns the value of DEVELOPER_DIR.
-
.device_agent_url ⇒ Object
Returns the value of DEVICE_ENDPOINT.
-
.device_endpoint ⇒ Object
Returns the value of DEVICE_ENDPOINT.
-
.device_target ⇒ Object
Returns the value of DEVICE_TARGET.
-
.gitlab? ⇒ Boolean
Returns true if running in Teamcity.
-
.jenkins? ⇒ Boolean
Returns true if running in Jenkins CI.
-
.keychain ⇒ Object
Returns the value of KEYCHAIN.
-
.path_to_app_bundle ⇒ Object
Returns to the path to the app bundle (simulator builds).
-
.reset_between_scenarios? ⇒ Boolean
Should the app data be reset between Scenarios?.
-
.solution ⇒ Object
Returns the value of SOLUTION which can be used to specify a Xamarin Studio .sln.
-
.teamcity? ⇒ Boolean
Returns true if running in Teamcity.
-
.trace_template ⇒ Object
Returns the value of TRACE_TEMPLATE; the Instruments template to use during testing.
-
.travis? ⇒ Boolean
Returns true if running in Travis CI.
-
.uia_timeout ⇒ Object
Returns the value of UIA_TIMEOUT.
-
.user_home_directory ⇒ Object
Returns the user home directory.
-
.windows_env? ⇒ Boolean
Returns true if Windows environment.
-
.with_debugging(debug, &block) ⇒ Object
!@visibility private.
-
.xcodeproj ⇒ Object
Returns the value of XCODEPROJ which can be used to specify an Xcode project directory (my.xcodeproj).
-
.xctestctl ⇒ Object
Returns the value of XCTESTCTL.
-
.xtc? ⇒ Boolean
Returns true if we are running on the XTC.
Class Method Details
.bundle_id ⇒ Object
Returns the value of BUNDLE_ID
129 130 131 132 133 134 135 136 |
# File 'lib/run_loop/environment.rb', line 129 def self.bundle_id value = ENV['BUNDLE_ID'] if !value || value == '' nil else value end end |
.cbxdevice ⇒ Object
Returns the value of CBXDEVICE
Use this to specify a non-default CBX-Runner for physical devices.
The default CBX-Runner is bundled with this gem.
208 209 210 211 212 213 214 215 |
# File 'lib/run_loop/environment.rb', line 208 def self.cbxdevice value = ENV["CBXDEVICE"] if !value || value == "" nil else value end end |
.cbxsim ⇒ Object
Returns the value of CBXSIM
Use this to specify a non-default CBX-Runner for simulators.
The default CBX-Runner is bundled with this gem.
222 223 224 225 226 227 228 229 |
# File 'lib/run_loop/environment.rb', line 222 def self.cbxsim value = ENV["CBXSIM"] if !value || value == "" nil else value end end |
.ci? ⇒ Boolean
Returns true if running in a CI environment
282 283 284 285 286 287 288 289 290 291 |
# File 'lib/run_loop/environment.rb', line 282 def self.ci? [ self.ci_var_defined?, self.travis?, self.jenkins?, self.circle_ci?, self.teamcity?, self.gitlab? ].any? end |
.circle_ci? ⇒ Boolean
Returns true if running in Circle CI
Checks the value of CIRCLECI
260 261 262 263 |
# File 'lib/run_loop/environment.rb', line 260 def self.circle_ci? value = ENV["CIRCLECI"] !!value && value != '' end |
.codesign_identity ⇒ Object
Returns the value of CODESIGN_IDENTITY
166 167 168 169 170 171 172 173 |
# File 'lib/run_loop/environment.rb', line 166 def self.codesign_identity value = ENV["CODESIGN_IDENTITY"] if !value || value == "" nil else value end end |
.debug? ⇒ Boolean
Returns true if debugging is enabled.
26 27 28 |
# File 'lib/run_loop/environment.rb', line 26 def self.debug? ENV['DEBUG'] == '1' end |
.debug_read? ⇒ Boolean
Returns true if read debugging is enabled.
31 32 33 |
# File 'lib/run_loop/environment.rb', line 31 def self.debug_read? ENV['DEBUG_READ'] == '1' end |
.derived_data ⇒ Object
Returns the value of DERIVED_DATA which can be used to specify an alternative DerivedData directory.
The default is ~/Library/Xcode/DerivedData, but Xcode allows you to change this value.
85 86 87 88 89 90 91 92 |
# File 'lib/run_loop/environment.rb', line 85 def self.derived_data value = ENV["DERIVED_DATA"] if value.nil? || value == "" nil else File.(value) end end |
.developer_dir ⇒ Object
Never call this directly. Always create an Xcode instance and allow it to derive the path to the Xcode toolchain.
Returns the value of DEVELOPER_DIR
156 157 158 159 160 161 162 163 |
# File 'lib/run_loop/environment.rb', line 156 def self.developer_dir value = ENV['DEVELOPER_DIR'] if !value || value == '' nil else value end end |
.device_agent_url ⇒ Object
Returns the value of DEVICE_ENDPOINT
232 233 234 235 236 237 238 239 |
# File 'lib/run_loop/environment.rb', line 232 def self.device_agent_url value = ENV["DEVICE_AGENT_URL"] if value.nil? || value == "" nil else value end end |
.device_endpoint ⇒ Object
Returns the value of DEVICE_ENDPOINT
51 52 53 54 55 56 57 58 |
# File 'lib/run_loop/environment.rb', line 51 def self.device_endpoint value = ENV["DEVICE_ENDPOINT"] if value.nil? || value == "" nil else value end end |
.device_target ⇒ Object
Returns the value of DEVICE_TARGET
41 42 43 44 45 46 47 48 |
# File 'lib/run_loop/environment.rb', line 41 def self.device_target value = ENV["DEVICE_TARGET"] if value.nil? || value == "" nil else value end end |
.gitlab? ⇒ Boolean
Returns true if running in Teamcity
Checks the value of GITLAB_CI
276 277 278 279 |
# File 'lib/run_loop/environment.rb', line 276 def self.gitlab? value = ENV["GITLAB_CI"] !!value && value != '' end |
.jenkins? ⇒ Boolean
Returns true if running in Jenkins CI
Checks the value of JENKINS_HOME
244 245 246 247 |
# File 'lib/run_loop/environment.rb', line 244 def self.jenkins? value = ENV["JENKINS_HOME"] !!value && value != '' end |
.keychain ⇒ Object
Returns the value of KEYCHAIN
Use this to specify a non-default KEYCHAIN for code signing.
The default KEYCHAIN is login.keychain.
180 181 182 183 184 185 186 187 |
# File 'lib/run_loop/environment.rb', line 180 def self.keychain value = ENV["KEYCHAIN"] if !value || value == "" nil else value end end |
.path_to_app_bundle ⇒ Object
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.
143 144 145 146 147 148 149 150 |
# File 'lib/run_loop/environment.rb', line 143 def self.path_to_app_bundle value = ENV['APP_BUNDLE_PATH'] || ENV['APP'] if !value || value == '' nil else File.(value) end end |
.reset_between_scenarios? ⇒ Boolean
Should the app data be reset between Scenarios?
61 62 63 |
# File 'lib/run_loop/environment.rb', line 61 def self.reset_between_scenarios? ENV["RESET_BETWEEN_SCENARIOS"] == "1" end |
.solution ⇒ Object
Returns the value of SOLUTION which can be used to specify a Xamarin Studio .sln
This is useful if your project has multiple solutions (.sln) and Calabash cannot detect the correct one.
99 100 101 102 103 104 105 106 |
# File 'lib/run_loop/environment.rb', line 99 def self.solution value = ENV["SOLUTION"] if value.nil? || value == "" nil else File.(value) end end |
.teamcity? ⇒ Boolean
Returns true if running in Teamcity
Checks the value of TEAMCITY_PROJECT_NAME
268 269 270 271 |
# File 'lib/run_loop/environment.rb', line 268 def self.teamcity? value = ENV["TEAMCITY_PROJECT_NAME"] !!value && value != '' end |
.trace_template ⇒ Object
Returns the value of TRACE_TEMPLATE; the Instruments template to use during testing.
110 111 112 113 114 115 116 117 |
# File 'lib/run_loop/environment.rb', line 110 def self.trace_template value = ENV['TRACE_TEMPLATE'] if value.nil? || value == "" nil else File.(value) end end |
.travis? ⇒ Boolean
Returns true if running in Travis CI
Checks the value of TRAVIS
252 253 254 255 |
# File 'lib/run_loop/environment.rb', line 252 def self.travis? value = ENV["TRAVIS"] !!value && value != '' end |
.uia_timeout ⇒ Object
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.
123 124 125 126 |
# File 'lib/run_loop/environment.rb', line 123 def self.uia_timeout timeout = ENV['UIA_TIMEOUT'] timeout ? timeout.to_f : nil end |
.user_home_directory ⇒ Object
Returns the user home directory
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/run_loop/environment.rb', line 5 def self.user_home_directory if self.xtc? home = File.join("./", "tmp", "home") FileUtils.mkdir_p(home) home else require 'etc' Etc.getpwuid.dir end end |
.windows_env? ⇒ Boolean
Returns true if Windows environment
17 18 19 20 21 22 23 |
# File 'lib/run_loop/environment.rb', line 17 def self.windows_env? if @@windows_env.nil? @@windows_env = Environment.host_os_is_win? end @@windows_env end |
.with_debugging(debug, &block) ⇒ Object
!@visibility private
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
# File 'lib/run_loop/environment.rb', line 294 def self.with_debugging(debug, &block) if debug original_value = ENV['DEBUG'] begin ENV['DEBUG'] = '1' block.call ensure ENV['DEBUG'] = original_value end else block.call end end |
.xcodeproj ⇒ Object
Returns the value of XCODEPROJ which can be used to specify an Xcode project directory (my.xcodeproj).
This is useful if your project has multiple xcodeproj directories.
Most users should not set this variable.
71 72 73 74 75 76 77 78 |
# File 'lib/run_loop/environment.rb', line 71 def self.xcodeproj value = ENV["XCODEPROJ"] if value.nil? || value == "" nil else File.(value) end end |
.xctestctl ⇒ Object
Returns the value of XCTESTCTL
Use this to specify a non-default xctestctl binary.
The default xctestctl binary is bundled with this gem.
194 195 196 197 198 199 200 201 |
# File 'lib/run_loop/environment.rb', line 194 def self.xctestctl value = ENV["XCTESTCTL"] if !value || value == "" nil else value end end |
.xtc? ⇒ Boolean
Returns true if we are running on the XTC
36 37 38 |
# File 'lib/run_loop/environment.rb', line 36 def self.xtc? ENV['XAMARIN_TEST_CLOUD'] == '1' end |