Change to use Rainbow instead of colorize
colorize is licensed under GPL-2 which conflicts with the MIT license of github_changelog_generator. This changes all usage of colorize to rainbow which does have a compatible license (MIT)
This commit is contained in:
parent
d23375f5ac
commit
f647dc0d98
|
@ -2,7 +2,7 @@ PATH
|
||||||
remote: .
|
remote: .
|
||||||
specs:
|
specs:
|
||||||
github_changelog_generator (1.13.1)
|
github_changelog_generator (1.13.1)
|
||||||
colorize (>= 0.7)
|
rainbow (>= 2.1)
|
||||||
github_api (>= 0.12)
|
github_api (>= 0.12)
|
||||||
rake (>= 10.0)
|
rake (>= 10.0)
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ GEM
|
||||||
ffi (~> 1.0, >= 1.0.11)
|
ffi (~> 1.0, >= 1.0.11)
|
||||||
codeclimate-test-reporter (0.6.0)
|
codeclimate-test-reporter (0.6.0)
|
||||||
simplecov (>= 0.7.1, < 1.0.0)
|
simplecov (>= 0.7.1, < 1.0.0)
|
||||||
colorize (0.8.1)
|
|
||||||
coveralls (0.8.14)
|
coveralls (0.8.14)
|
||||||
json (>= 1.8, < 3)
|
json (>= 1.8, < 3)
|
||||||
simplecov (~> 0.12.0)
|
simplecov (~> 0.12.0)
|
||||||
|
|
|
@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
||||||
|
|
||||||
spec.add_runtime_dependency "rake", ">= 10.0"
|
spec.add_runtime_dependency "rake", ">= 10.0"
|
||||||
spec.add_runtime_dependency "github_api", ">= 0.12"
|
spec.add_runtime_dependency "github_api", ">= 0.12"
|
||||||
spec.add_runtime_dependency "colorize", ">= 0.7"
|
spec.add_runtime_dependency "rainbow", ">= 2.1"
|
||||||
|
|
||||||
spec.add_development_dependency "overcommit", ">= 0.31"
|
spec.add_development_dependency "overcommit", ">= 0.31"
|
||||||
spec.add_development_dependency "rspec", ">= 3.2"
|
spec.add_development_dependency "rspec", ">= 3.2"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
require "github_api"
|
require "github_api"
|
||||||
require "json"
|
require "json"
|
||||||
require "colorize"
|
require "rainbow/ext/string"
|
||||||
require "benchmark"
|
require "benchmark"
|
||||||
|
|
||||||
require_relative "github_changelog_generator/helper"
|
require_relative "github_changelog_generator/helper"
|
||||||
|
|
|
@ -34,7 +34,7 @@ module GitHubChangelogGenerator
|
||||||
def fetch_github_token
|
def fetch_github_token
|
||||||
env_var = @options[:token] ? @options[:token] : (ENV.fetch CHANGELOG_GITHUB_TOKEN, nil)
|
env_var = @options[:token] ? @options[:token] : (ENV.fetch CHANGELOG_GITHUB_TOKEN, nil)
|
||||||
|
|
||||||
Helper.log.warn NO_TOKEN_PROVIDED.yellow unless env_var
|
Helper.log.warn NO_TOKEN_PROVIDED.color(:yellow) unless env_var
|
||||||
|
|
||||||
env_var
|
env_var
|
||||||
end
|
end
|
||||||
|
@ -53,11 +53,11 @@ module GitHubChangelogGenerator
|
||||||
begin
|
begin
|
||||||
value = yield
|
value = yield
|
||||||
rescue Github::Error::Unauthorized => e
|
rescue Github::Error::Unauthorized => e
|
||||||
Helper.log.error e.response_message.red
|
Helper.log.error e.response_message.color(:red)
|
||||||
abort "Error: wrong GitHub token"
|
abort "Error: wrong GitHub token"
|
||||||
rescue Github::Error::Forbidden => e
|
rescue Github::Error::Forbidden => e
|
||||||
Helper.log.warn e.response_message.red
|
Helper.log.warn e.response_message.color(:red)
|
||||||
Helper.log.warn GH_RATE_LIMIT_EXCEEDED_MSG.yellow
|
Helper.log.warn GH_RATE_LIMIT_EXCEEDED_MSG.color(:yellow)
|
||||||
end
|
end
|
||||||
value
|
value
|
||||||
end
|
end
|
||||||
|
@ -78,7 +78,7 @@ module GitHubChangelogGenerator
|
||||||
|
|
||||||
if tags.count == 0
|
if tags.count == 0
|
||||||
Helper.log.warn "Warning: Can't find any tags in repo.\
|
Helper.log.warn "Warning: Can't find any tags in repo.\
|
||||||
Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
Make sure, that you push tags to remote repo via 'git push --tags'".color(:yellow)
|
||||||
else
|
else
|
||||||
Helper.log.info "Found #{tags.count} tags"
|
Helper.log.info "Found #{tags.count} tags"
|
||||||
end
|
end
|
||||||
|
@ -110,8 +110,8 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
||||||
Helper.log.info "Received issues: #{issues.count}"
|
Helper.log.info "Received issues: #{issues.count}"
|
||||||
|
|
||||||
rescue Github::Error::Forbidden => e
|
rescue Github::Error::Forbidden => e
|
||||||
Helper.log.warn e.error_messages.map { |m| m[:message] }.join(", ").red
|
Helper.log.warn e.error_messages.map { |m| m[:message] }.join(", ").color(:red)
|
||||||
Helper.log.warn GH_RATE_LIMIT_EXCEEDED_MSG.yellow
|
Helper.log.warn GH_RATE_LIMIT_EXCEEDED_MSG.color(:yellow)
|
||||||
end
|
end
|
||||||
|
|
||||||
# separate arrays of issues and pull requests:
|
# separate arrays of issues and pull requests:
|
||||||
|
@ -145,8 +145,8 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
||||||
end
|
end
|
||||||
print_empty_line
|
print_empty_line
|
||||||
rescue Github::Error::Forbidden => e
|
rescue Github::Error::Forbidden => e
|
||||||
Helper.log.warn e.error_messages.map { |m| m[:message] }.join(", ").red
|
Helper.log.warn e.error_messages.map { |m| m[:message] }.join(", ").color(:red)
|
||||||
Helper.log.warn GH_RATE_LIMIT_EXCEEDED_MSG.yellow
|
Helper.log.warn GH_RATE_LIMIT_EXCEEDED_MSG.color(:yellow)
|
||||||
end
|
end
|
||||||
|
|
||||||
Helper.log.info "Fetching merged dates: #{pull_requests.count}"
|
Helper.log.info "Fetching merged dates: #{pull_requests.count}"
|
||||||
|
@ -182,8 +182,8 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
||||||
issue[:events].concat(page)
|
issue[:events].concat(page)
|
||||||
end
|
end
|
||||||
rescue Github::Error::Forbidden => e
|
rescue Github::Error::Forbidden => e
|
||||||
Helper.log.warn e.error_messages.map { |m| m[:message] }.join(", ").red
|
Helper.log.warn e.error_messages.map { |m| m[:message] }.join(", ").color(:red)
|
||||||
Helper.log.warn GH_RATE_LIMIT_EXCEEDED_MSG.yellow
|
Helper.log.warn GH_RATE_LIMIT_EXCEEDED_MSG.color(:yellow)
|
||||||
end
|
end
|
||||||
print_in_same_line("Fetching events for issues and PR: #{i + 1}/#{issues.count}")
|
print_in_same_line("Fetching events for issues and PR: #{i + 1}/#{issues.count}")
|
||||||
i += 1
|
i += 1
|
||||||
|
@ -209,8 +209,8 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
||||||
@options[:project],
|
@options[:project],
|
||||||
tag["commit"]["sha"]
|
tag["commit"]["sha"]
|
||||||
rescue Github::Error::Forbidden => e
|
rescue Github::Error::Forbidden => e
|
||||||
Helper.log.warn e.error_messages.map { |m| m[:message] }.join(", ").red
|
Helper.log.warn e.error_messages.map { |m| m[:message] }.join(", ").color(:red)
|
||||||
Helper.log.warn GH_RATE_LIMIT_EXCEEDED_MSG.yellow
|
Helper.log.warn GH_RATE_LIMIT_EXCEEDED_MSG.color(:yellow)
|
||||||
end
|
end
|
||||||
time_string = commit_data["committer"]["date"]
|
time_string = commit_data["committer"]["date"]
|
||||||
Time.parse(time_string)
|
Time.parse(time_string)
|
||||||
|
|
|
@ -74,7 +74,7 @@ module GitHubChangelogGenerator
|
||||||
commit = @fetcher.fetch_commit(event)
|
commit = @fetcher.fetch_commit(event)
|
||||||
issue[:actual_date] = commit[:author][:date]
|
issue[:actual_date] = commit[:author][:date]
|
||||||
rescue
|
rescue
|
||||||
puts "Warning: Can't fetch commit #{event[:commit_id]}. It is probably referenced from another repo.".yellow
|
puts "Warning: Can't fetch commit #{event[:commit_id]}. It is probably referenced from another repo.".color(:yellow)
|
||||||
issue[:actual_date] = issue[:closed_at]
|
issue[:actual_date] = issue[:closed_at]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -39,10 +39,10 @@ module GitHubChangelogGenerator
|
||||||
index2 = hash[tag2]
|
index2 = hash[tag2]
|
||||||
log += generate_log_between_tags(all_tags[index1], all_tags[index2])
|
log += generate_log_between_tags(all_tags[index1], all_tags[index2])
|
||||||
else
|
else
|
||||||
raise ChangelogGeneratorError, "Can't find tag #{tag2} -> exit".red
|
raise ChangelogGeneratorError, "Can't find tag #{tag2} -> exit".color(:red)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
raise ChangelogGeneratorError, "Can't find tag #{tag1} -> exit".red
|
raise ChangelogGeneratorError, "Can't find tag #{tag1} -> exit".color(:red)
|
||||||
end
|
end
|
||||||
log
|
log
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,7 @@ module GitHubChangelogGenerator
|
||||||
# @param [Hash] tag_name name of the tag
|
# @param [Hash] tag_name name of the tag
|
||||||
# @return [Time] time of specified tag
|
# @return [Time] time of specified tag
|
||||||
def get_time_of_tag(tag_name)
|
def get_time_of_tag(tag_name)
|
||||||
raise ChangelogGeneratorError, "tag_name is nil".red if tag_name.nil?
|
raise ChangelogGeneratorError, "tag_name is nil".color(:red) if tag_name.nil?
|
||||||
|
|
||||||
name_of_tag = tag_name["name"]
|
name_of_tag = tag_name["name"]
|
||||||
time_for_name = @tag_times_hash[name_of_tag]
|
time_for_name = @tag_times_hash[name_of_tag]
|
||||||
|
|
|
@ -15,15 +15,15 @@ module GitHubChangelogGenerator
|
||||||
string = "#{msg}\n"
|
string = "#{msg}\n"
|
||||||
|
|
||||||
if severity == "DEBUG"
|
if severity == "DEBUG"
|
||||||
string = string.magenta
|
string = string.color(:magenta)
|
||||||
elsif severity == "INFO"
|
elsif severity == "INFO"
|
||||||
string = string.white
|
string = string.color(:white)
|
||||||
elsif severity == "WARN"
|
elsif severity == "WARN"
|
||||||
string = string.yellow
|
string = string.color(:yellow)
|
||||||
elsif severity == "ERROR"
|
elsif severity == "ERROR"
|
||||||
string = string.red
|
string = string.color(:red)
|
||||||
elsif severity == "FATAL"
|
elsif severity == "FATAL"
|
||||||
string = string.red.bold
|
string = string.color(:red).bright
|
||||||
end
|
end
|
||||||
|
|
||||||
string
|
string
|
||||||
|
|
Loading…
Reference in New Issue
Block a user