change internal logic
This commit is contained in:
parent
67fbb04b31
commit
a415010e86
|
@ -10,7 +10,7 @@ module GitHubChangelogGenerator
|
||||||
end
|
end
|
||||||
|
|
||||||
class Generator
|
class Generator
|
||||||
attr_accessor :options, :all_tags, :github
|
attr_accessor :options, :filtered_tags, :github
|
||||||
|
|
||||||
# A Generator responsible for all logic, related with change log generation from ready-to-parse issues
|
# A Generator responsible for all logic, related with change log generation from ready-to-parse issues
|
||||||
#
|
#
|
||||||
|
|
|
@ -17,8 +17,8 @@ module GitHubChangelogGenerator
|
||||||
# Async fetching tags:
|
# Async fetching tags:
|
||||||
threads = []
|
threads = []
|
||||||
i = 0
|
i = 0
|
||||||
all = @all_tags.count
|
all = @filtered_tags.count
|
||||||
@all_tags.each do |tag|
|
@filtered_tags.each do |tag|
|
||||||
print " \r"
|
print " \r"
|
||||||
threads << Thread.new do
|
threads << Thread.new do
|
||||||
@fetcher.get_time_of_tag(tag)
|
@fetcher.get_time_of_tag(tag)
|
||||||
|
|
|
@ -131,7 +131,7 @@ module GitHubChangelogGenerator
|
||||||
(1...all_tags.size).each do |index|
|
(1...all_tags.size).each do |index|
|
||||||
log += generate_log_between_tags(all_tags[index], all_tags[index - 1])
|
log += generate_log_between_tags(all_tags[index], all_tags[index - 1])
|
||||||
end
|
end
|
||||||
if @all_tags.count != 0
|
if @filtered_tags.count != 0
|
||||||
log += generate_log_between_tags(nil, all_tags.last)
|
log += generate_log_between_tags(nil, all_tags.last)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ module GitHubChangelogGenerator
|
||||||
false
|
false
|
||||||
else
|
else
|
||||||
# check, that this milestone in tag list:
|
# check, that this milestone in tag list:
|
||||||
milestone_is_tag = @all_tags.find do |tag|
|
milestone_is_tag = @filtered_tags.find do |tag|
|
||||||
tag.name == issue.milestone.title
|
tag.name == issue.milestone.title
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ module GitHubChangelogGenerator
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
# check, that this milestone in tag list:
|
# check, that this milestone in tag list:
|
||||||
@all_tags.find { |tag| tag.name == issue.milestone.title }.nil?
|
@filtered_tags.find { |tag| tag.name == issue.milestone.title }.nil?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,15 +2,15 @@ module GitHubChangelogGenerator
|
||||||
class Generator
|
class Generator
|
||||||
# fetch, filter tags, fetch dates and sort them in time order
|
# fetch, filter tags, fetch dates and sort them in time order
|
||||||
def fetch_and_filter_tags
|
def fetch_and_filter_tags
|
||||||
@all_tags = get_filtered_tags(@fetcher.get_all_tags)
|
@filtered_tags = get_filtered_tags(@fetcher.get_all_tags)
|
||||||
fetch_tags_dates
|
fetch_tags_dates
|
||||||
sort_tags_by_date
|
sort_tags_by_date(@filtered_tags)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Sort all tags by date
|
# Sort all tags by date
|
||||||
def sort_tags_by_date
|
def sort_tags_by_date(tags)
|
||||||
puts "Sorting tags..." if @options[:verbose]
|
puts "Sorting tags..." if @options[:verbose]
|
||||||
@all_tags.sort_by! { |x| @fetcher.get_time_of_tag(x) }.reverse!
|
tags.sort_by! { |x| @fetcher.get_time_of_tag(x) }.reverse!
|
||||||
end
|
end
|
||||||
|
|
||||||
# Detect link, name and time for specified tag.
|
# Detect link, name and time for specified tag.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user