Class: Environments::TravisCi

Inherits:
Object
  • Object
show all
Defined in:
lib/flakyci_rspec/environments/travis_ci.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.is_travis_ci?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/flakyci_rspec/environments/travis_ci.rb', line 38

def self.is_travis_ci?()
  ENV["TRAVIS"] == "true"
end

Instance Method Details

#build_idObject



30
31
32
# File 'lib/flakyci_rspec/environments/travis_ci.rb', line 30

def build_id() 
  ENV["TRAVIS_BUILD_ID"]
end

#build_nameObject



34
35
36
# File 'lib/flakyci_rspec/environments/travis_ci.rb', line 34

def build_name() 
  ENV["TRAVIS_JOB_NAME"]
end

#get_infosObject



3
4
5
6
7
8
9
10
11
# File 'lib/flakyci_rspec/environments/travis_ci.rb', line 3

def get_infos() 
  {
    sha: sha(),
    build_id: build_id(),
    ref: get_ref(),
    build_name: build_name(),
    env_name: "travis-ci"
  }
end

#get_refObject



26
27
28
# File 'lib/flakyci_rspec/environments/travis_ci.rb', line 26

def get_ref() 
  ENV["TRAVIS_BRANCH"]
end

#is_travis?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/flakyci_rspec/environments/travis_ci.rb', line 13

def is_travis?
  ENV["TRAVIS"] == "true"
end

#shaObject



17
18
19
20
21
22
23
24
# File 'lib/flakyci_rspec/environments/travis_ci.rb', line 17

def sha() 
  sha = ENV["TRAVIS_PULL_REQUEST_SHA"]
  if sha == ""
    "unknown" 
  else
    sha
  end
end