Class: Cucumber::CiEnvironment

Inherits:
Object
  • Object
show all
Extended by:
VariableExpression
Defined in:
lib/cucumber/ci_environment.rb

Constant Summary collapse

CI_ENVIRONMENTS_PATH =
File.join(File.dirname(__FILE__), './CiEnvironments.json')

Class Method Summary collapse

Methods included from VariableExpression

evaluate, get_value

Class Method Details

.detect_ci_environment(env) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/cucumber/ci_environment.rb', line 15

def detect_ci_environment(env)
  ci_environments = JSON.parse(File.read(CI_ENVIRONMENTS_PATH))
  ci_environments.each do |ci_environment|
    detected = detect(ci_environment, env)
    return detected unless detected.nil?
  end

  nil
end

.remove_userinfo_from_url(value) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/cucumber/ci_environment.rb', line 25

def remove_userinfo_from_url(value)
  return nil if value.nil?

  begin
    uri = URI(value)
    uri.userinfo = ''
    uri.to_s
  rescue StandardError
    value
  end
end