Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: test install build deploy

deploy:
$(eval VERSION := $(shell cat lib/codecov.rb | grep 'VERSION = ' | cut -d\' -f2))
$(eval VERSION := $(shell cat lib/codecov/version.rb | grep 'VERSION = ' | cut -d\' -f2))
git tag v$(VERSION) -m ""
git push origin v$(VERSION)
gem build codecov.gemspec
Expand Down
4 changes: 3 additions & 1 deletion codecov.gemspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require_relative 'lib/codecov/version'

Gem::Specification.new do |s|
s.name = 'codecov'
s.authors = ['Steve Peak', 'Tom Hu']
Expand All @@ -11,7 +13,7 @@ Gem::Specification.new do |s|
s.license = 'MIT'
s.platform = Gem::Platform::RUBY
s.required_ruby_version = '~> 2.4'
s.version = '0.2.13'
s.version = ::Codecov::VERSION

s.add_dependency 'simplecov', '~> 0.18.0'

Expand Down
10 changes: 5 additions & 5 deletions lib/codecov.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
require 'simplecov'
require 'zlib'

class SimpleCov::Formatter::Codecov
VERSION = '0.2.13'
require_relative 'codecov/version'

class SimpleCov::Formatter::Codecov
### CIs
RECOGNIZED_CIS = [
APPVEYOR = 'Appveyor CI',
Expand Down Expand Up @@ -41,7 +41,7 @@ def display_header
'| | / _ \ / _\`|/ _ \/ __/ _ \ \ / /',
'| |___| (_) | (_| | __/ (_| (_) \ V /',
' \_____\___/ \__,_|\___|\___\___/ \_/',
" Ruby-#{VERSION}",
" Ruby-#{::Codecov::VERSION}",
''
].join("\n")
end
Expand Down Expand Up @@ -100,7 +100,7 @@ def build_params(ci)
params = {
'token' => ENV['CODECOV_TOKEN'],
'flags' => ENV['CODECOV_FLAG'] || ENV['CODECOV_FLAGS'],
'package' => "ruby-#{VERSION}"
'package' => "ruby-#{::Codecov::VERSION}"
}

case ci
Expand Down Expand Up @@ -336,7 +336,7 @@ def retry_request(req, https)
def create_report(report)
result = {
'meta' => {
'version' => 'codecov-ruby/v' + VERSION
'version' => 'codecov-ruby/v' + ::Codecov::VERSION
}
}
result.update(result_to_codecov(report))
Expand Down
5 changes: 5 additions & 0 deletions lib/codecov/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

module Codecov
VERSION = '0.2.13'
end
2 changes: 1 addition & 1 deletion test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
SimpleCov.start do
add_filter '/test/'
end
require 'codecov'
require_relative '../lib/codecov'
SimpleCov.formatter = SimpleCov::Formatter::Codecov if ENV['CI'] == 'true'

require 'minitest/autorun'
Expand Down
6 changes: 3 additions & 3 deletions test/test_codecov.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require 'helper'
require_relative 'helper'

class TestCodecov < Minitest::Test
CI = SimpleCov::Formatter::Codecov.new.detect_ci
Expand Down Expand Up @@ -47,7 +47,7 @@ def url

def test_defined
assert defined?(SimpleCov::Formatter::Codecov)
assert defined?(SimpleCov::Formatter::Codecov::VERSION)
assert defined?(::Codecov::VERSION)
end

def stub_file(filename, coverage)
Expand Down Expand Up @@ -96,7 +96,7 @@ def success_stubs
def assert_successful_upload(data)
assert_equal(data['result']['uploaded'], true)
assert_equal(data['result']['message'], 'Coverage reports upload successfully')
assert_equal(data['meta']['version'], 'codecov-ruby/v' + SimpleCov::Formatter::Codecov::VERSION)
assert_equal(data['meta']['version'], 'codecov-ruby/v' + ::Codecov::VERSION)
assert_equal(data['coverage'].to_json, {
'lib/something.rb' => [nil, 1, 0, 0, nil, 1, nil],
'lib/somefile.rb' => [nil, 1, nil, 1, 1, 1, 0, 0, nil, 1, nil]
Expand Down