Class: CI

Inherits:
Object
  • Object
show all
Defined in:
lib/helpers/ci.rb

Constant Summary collapse

DEFAULT_BUILD_NO =
'1'

Class Method Summary collapse

Class Method Details

.branchObject



14
15
16
# File 'lib/helpers/ci.rb', line 14

def self.branch
  ENV['TRAVIS_BRANCH'] || ENV['CIRCLE_BRANCH']
end

.build_noObject



10
11
12
# File 'lib/helpers/ci.rb', line 10

def self.build_no
  ENV["TRAVIS_BUILD_NUMBER"] || ENV["CIRCLE_BUILD_NUM"] || DEFAULT_BUILD_NO
end

.commitObject



26
27
28
# File 'lib/helpers/ci.rb', line 26

def self.commit
  ENV['TRAVIS_COMMIT'] || ENV['CIRCLE_SHA1']
end

.repoObject



18
19
20
# File 'lib/helpers/ci.rb', line 18

def self.repo
  ENV['TRAVIS_REPO_SLUG'] || ENV['CIRCLE_PROJECT_REPONAME']
end

.tagged_build?(travis_tag = '') ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
# File 'lib/helpers/ci.rb', line 5

def self.tagged_build?(travis_tag='')
  travis_tag = !travis_tag.empty? ? travis_tag : ENV['TRAVIS_TAG'] || ''
  !travis_tag.empty? && !(travis_tag == 'EMPTY') #magic default value used by legacy build scripts
end

.version_suffixObject



22
23
24
# File 'lib/helpers/ci.rb', line 22

def self.version_suffix
  ENV['VERSION_SUFFIX'] || ''
end