Class: CodeStats::Metrics::Reporter::Ci

Inherits:
Object
  • Object
show all
Defined in:
lib/code_stats/metrics/reporter/ci.rb

Class Method Summary collapse

Class Method Details

.bitriseObject



36
37
38
39
40
41
42
43
# File 'lib/code_stats/metrics/reporter/ci.rb', line 36

def self.bitrise
  {
    name:             'bitrise',
    build_identifier: ENV['BITRISE_BUILD_NUMBER'],
    branch:           ENV['BITRISE_GIT_BRANCH'],
    repository_name:  ENV['GIT_REPOSITORY_URL'].split('/')[1].gsub('.git','')
  }
end

.circleciObject



18
19
20
21
22
23
24
25
# File 'lib/code_stats/metrics/reporter/ci.rb', line 18

def self.circleci
  {
    name:             'circleci',
    build_identifier: ENV['CIRCLE_BUILD_NUM'],
    branch:           ENV['CIRCLE_BRANCH'],
    repository_name:  ENV['CIRCLE_PROJECT_REPONAME']
  }
end

.data(service) ⇒ Object



5
6
7
# File 'lib/code_stats/metrics/reporter/ci.rb', line 5

def self.data(service)
  respond_to?(service.downcase) ? send(service.downcase) : {}
end

.jenkinsObject



27
28
29
30
31
32
33
34
# File 'lib/code_stats/metrics/reporter/ci.rb', line 27

def self.jenkins
  {
    name:             'jenkins',
    build_identifier: ENV['BUILD_NUMBER'],
    branch:           ENV['ghprbSourceBranch'],
    repository_name:  ENV['JOB_NAME']
  }
end

.travisObject



9
10
11
12
13
14
15
16
# File 'lib/code_stats/metrics/reporter/ci.rb', line 9

def self.travis
  {
    name:             'travis-ci',
    build_identifier: ENV['TRAVIS_JOB_ID'],
    pull_request:     ENV['TRAVIS_PULL_REQUEST'],
    repository_name:  ENV['TRAVIS_REPO_SLUG'].split('/')[1]
  }
end