Module: Slather::CoverageService::Coveralls

Defined in:
lib/slather/coverage_service/coveralls.rb

Instance Method Summary collapse

Instance Method Details

#buildkite_build_urlObject



95
96
97
# File 'lib/slather/coverage_service/coveralls.rb', line 95

def buildkite_build_url
  "https://buildkite.com/" + ENV['BUILDKITE_PROJECT_SLUG'] + "/builds/" + ENV['BUILDKITE_BUILD_NUMBER'] + "#"
end

#buildkite_git_infoObject



83
84
85
86
87
88
89
90
91
92
93
# File 'lib/slather/coverage_service/coveralls.rb', line 83

def buildkite_git_info
  {
    :head => {
      :id => ENV['BUILDKITE_COMMIT'],
      :author_name => (`git log --format=%an -n 1 HEAD`.chomp || ""),
      :author_email => (`git log --format=%ae -n 1 HEAD`.chomp || ""),
      :message => (`git log --format=%s -n 1 HEAD`.chomp || "")
    },
    :branch => ENV['BUILDKITE_BRANCH']
  }
end

#postObject



170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/slather/coverage_service/coveralls.rb', line 170

def post
  f = File.open('coveralls_json_file', 'w+')
  begin
    f.write(coveralls_coverage_data)
    f.close
    `curl -s --form json_file=@#{f.path} #{coveralls_api_jobs_path}`
  rescue StandardError => e
    FileUtils.rm(f)
    raise e
  end
  FileUtils.rm(f)
end