add fetcher class

This commit is contained in:
Petr Korolev 2015-03-26 23:56:47 +02:00
parent e0cf47e027
commit a2cf6810ad
2 changed files with 23 additions and 1 deletions

View File

@ -36,7 +36,7 @@ module GitHubChangelogGenerator
@generator = Generator.new(@options)
@all_tags = get_all_tags
@all_tags = get_filtered_tags
@issues, @pull_requests = fetch_issues_and_pull_requests
if @options[:pulls]
@ -56,6 +56,23 @@ module GitHubChangelogGenerator
@tag_times_hash = {}
end
# Return tags after filtering tags in lists provided by option: --between-tags & --exclude-tags
#
# @return [Array]
def get_filtered_tags
all_tags = get_all_tags
filtered_tags = []
if @options[:between_tags]
@options[:between_tags].each do |tag|
unless all_tags.include? tag
puts "Warning: can't find tag #{tag}, specified with --between-tags option.".yellow
end
end
filtered_tags = all_tags.select { |tag| @options[:between_tags].include? tag }
end
filtered_tags
end
def detect_actual_closed_dates
if @options[:verbose]
print "Fetching closed dates for issues...\r"

View File

@ -0,0 +1,5 @@
module GitHubChangelogGenerator
# A Fetcher responsible for all requests to GitHub and all basic manipulation with related data (such as filtering, validating, e.t.c)
class Fetcher
end
end