diff --git a/lib/github_changelog_generator/fetcher.rb b/lib/github_changelog_generator/fetcher.rb index f908e1d..eef3e6d 100644 --- a/lib/github_changelog_generator/fetcher.rb +++ b/lib/github_changelog_generator/fetcher.rb @@ -68,25 +68,11 @@ module GitHubChangelogGenerator response = @github.repos.tags @options[:user], @options[:project] page_i = 0 count_pages = response.count_pages - response.each_page do |page| - - if @options[:exclude_tags_filter] - body_new = [] - reg = Regexp.new @options[:exclude_tags_filter] - page.body.each do |tag| - if !(tag.name =~ reg) - body_new << tag - end - end - page.body = body_new - end - page_i += PER_PAGE_NUMBER print_in_same_line("Fetching tags... #{page_i}/#{count_pages * PER_PAGE_NUMBER}") tags.concat(page) end - print_empty_line if tags.count == 0 diff --git a/lib/github_changelog_generator/generator/generator_tags.rb b/lib/github_changelog_generator/generator/generator_tags.rb index 3d01497..cbf8198 100644 --- a/lib/github_changelog_generator/generator/generator_tags.rb +++ b/lib/github_changelog_generator/generator/generator_tags.rb @@ -129,12 +129,12 @@ module GitHubChangelogGenerator end # @param [Array] all_tags all tags - # @return [Array] filtered tags according :exclude_tags option + # @return [Array] filtered tags according :exclude_tags or :exclude_tags_regex option def filter_excluded_tags(all_tags) - if @options[:exclude_tags] - apply_exclude_tags(all_tags) - elsif @options[:exclude_tags_regex] - apply_exclude_tags_regex(all_tags) + if (@options[:exclude_tags].is_a?(Regexp) || @options[:exclude_tags_regex]) + filter_tags_with_regex(all_tags) + elsif @options[:exclude_tags] + filter_exact_tags(all_tags) else all_tags end @@ -142,18 +142,6 @@ module GitHubChangelogGenerator private - def apply_exclude_tags(all_tags) - if @options[:exclude_tags].is_a?(Regexp) - filter_tags_with_regex(all_tags) - else - filter_exact_tags(all_tags) - end - end - - def apply_exclude_tags_regex(all_tags) - filter_tags_with_regex(all_tags) - end - def filter_tags_with_regex(all_tags) warn_if_nonmatching_regex(all_tags) diff --git a/lib/github_changelog_generator/parser.rb b/lib/github_changelog_generator/parser.rb index 034bb82..97e5ed5 100644 --- a/lib/github_changelog_generator/parser.rb +++ b/lib/github_changelog_generator/parser.rb @@ -116,12 +116,12 @@ module GitHubChangelogGenerator opts.on("--between-tags x,y,z", Array, "Change log will be filled only between specified tags") do |list| options[:between_tags] = list end - opts.on("--exclude-tags-filter [REGEX]", "Apply a regular expression on tag names so that they can be excluded, for example: --exclude-tags-filter \".*\+\d{1,}\" ") do |last| - options[:exclude_tags_filter] = last - end opts.on("--exclude-tags x,y,z", Array, "Change log will exclude specified tags") do |list| options[:exclude_tags] = list end + opts.on("--exclude-tags-regex [REGEX]", "Apply a regular expression on tag names so that they can be excluded, for example: --exclude-tags-regex \".*\+\d{1,}\" ") do |last| + options[:exclude_tags_regex] = last + end opts.on("--since-tag x", "Change log will start after specified tag") do |v| options[:since_tag] = v end