From 045c2961d654411c104476f838dfcb715391057f Mon Sep 17 00:00:00 2001 From: Thomas Hu Date: Sun, 23 Aug 2020 10:10:44 -0400 Subject: [PATCH] Remove colorize depedency --- .gitignore | 1 + CHANGELOG.md | 3 +++ codecov.gemspec | 3 +-- lib/codecov.rb | 23 +++++++++++++++++++++-- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index c7eaf0c..dcb8ab9 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ /spec/reports/ /test/tmp/ /test/version_tmp/ +/test/reports/ /tmp/ ## Specific to RubyMotion: diff --git a/CHANGELOG.md b/CHANGELOG.md index 5534c8c..1ca24c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### `0.2.8` +- Remove `colorize` dependency + ### `0.2.7` - Fix for enterprise users unable to upload using the v4 uploader diff --git a/codecov.gemspec b/codecov.gemspec index cef0d31..7e23f2a 100644 --- a/codecov.gemspec +++ b/codecov.gemspec @@ -13,9 +13,8 @@ Gem::Specification.new do |s| s.required_ruby_version = '>=2.4' s.summary = 'hosted code coverage ruby/rails reporter' s.test_files = ['test/test_codecov.rb'] - s.version = '0.2.7' + s.version = '0.2.8' - s.add_dependency 'colorize' s.add_dependency 'json' s.add_dependency 'simplecov' diff --git a/lib/codecov.rb b/lib/codecov.rb index a6b93e8..41bfe6d 100644 --- a/lib/codecov.rb +++ b/lib/codecov.rb @@ -4,11 +4,10 @@ require 'json' require 'net/http' require 'simplecov' -require 'colorize' require 'zlib' class SimpleCov::Formatter::Codecov - VERSION = '0.2.7' + VERSION = '0.2.8' ### CIs RECOGNIZED_CIS = [ @@ -587,3 +586,23 @@ def net_blockers(switch) true end end + +# https://stackoverflow.com/a/11482430/5769383 +class String + # colorization + def colorize(color_code) + "\e[#{color_code}m#{self}\e[0m" + end + + def black + colorize(30) + end + + def red + colorize(31) + end + + def green + colorize(32) + end +end