diff --git a/lib/github_changelog_generator.rb b/lib/github_changelog_generator.rb index 30ff897..ecab437 100755 --- a/lib/github_changelog_generator.rb +++ b/lib/github_changelog_generator.rb @@ -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" diff --git a/lib/github_changelog_generator/fetcher.rb b/lib/github_changelog_generator/fetcher.rb new file mode 100644 index 0000000..89938e9 --- /dev/null +++ b/lib/github_changelog_generator/fetcher.rb @@ -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