From 9720c96b8c6df0c48672b7974151ac44d9e3edb4 Mon Sep 17 00:00:00 2001 From: David da Silva Contin Date: Thu, 11 Jun 2015 11:08:24 +0200 Subject: [PATCH 1/3] fix guidlines typo in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9747349..54cd0c3 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,7 @@ So, if you got error like this: It's time to create this token or wait for 1 hour before GitHub reset the counter for your IP. ##Features and advantages of this project -- Generate canonical, neat change log file, followed by [basic change log guidlines](http://keepachangelog.com/) :gem: +- Generate canonical, neat change log file, followed by [basic change log guidelines](http://keepachangelog.com/) :gem: - Possible to generate **Unreleased** changes (closed issues that have not released yet) :dizzy: - **GitHub Enterprise support** via command line options! :factory: - Flexible format **customisation**: From dac3be9f7df9744d5f2dfb767b92c5ab9e636381 Mon Sep 17 00:00:00 2001 From: Petr Korolev Date: Wed, 10 Jun 2015 10:14:55 +0300 Subject: [PATCH 2/3] update test, between tags. --- .../generator/generator_tags.rb | 2 +- spec/unit/generator/generator_tags_spec.rb | 31 +++++++++++++------ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/lib/github_changelog_generator/generator/generator_tags.rb b/lib/github_changelog_generator/generator/generator_tags.rb index 6e4cc7d..4032a3d 100644 --- a/lib/github_changelog_generator/generator/generator_tags.rb +++ b/lib/github_changelog_generator/generator/generator_tags.rb @@ -49,7 +49,7 @@ module GitHubChangelogGenerator 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 } + filtered_tags = all_tags.select { |tag| @options[:between_tags].include? tag.name } end filtered_tags end diff --git a/spec/unit/generator/generator_tags_spec.rb b/spec/unit/generator/generator_tags_spec.rb index f3ffca7..6c4d40e 100644 --- a/spec/unit/generator/generator_tags_spec.rb +++ b/spec/unit/generator/generator_tags_spec.rb @@ -6,20 +6,20 @@ describe GitHubChangelogGenerator::Generator do end subject do - @generator.get_filtered_tags(%w(1 2 3)) + @generator.get_filtered_tags(tags_mash_from_strings(%w(1 2 3))) end it { is_expected.to be_a(Array) } - it { is_expected.to match_array(%w(1 2 3)) } + it { is_expected.to match_array(tags_mash_from_strings(%w(1 2 3))) } end context "when between_tags same as input array" do before do @generator = GitHubChangelogGenerator::Generator.new(between_tags: %w(1 2 3)) end subject do - @generator.get_filtered_tags(%w(1 2 3)) + @generator.get_filtered_tags(tags_mash_from_strings(%w(1 2 3))) end it { is_expected.to be_a(Array) } - it { is_expected.to match_array(%w(1 2 3)) } + it { is_expected.to match_array(tags_mash_from_strings(%w(1 2 3))) } end context "when between_tags filled with correct values" do @@ -27,10 +27,10 @@ describe GitHubChangelogGenerator::Generator do @generator = GitHubChangelogGenerator::Generator.new(between_tags: %w(1 2)) end subject do - @generator.get_filtered_tags(%w(1 2 3)) + @generator.get_filtered_tags(tags_mash_from_strings(%w(1 2 3))) end it { is_expected.to be_a(Array) } - it { is_expected.to match_array(%w(1 2)) } + it { is_expected.to match_array(tags_mash_from_strings(%w(1 2))) } end context "when between_tags filled with invalid values" do @@ -39,15 +39,28 @@ describe GitHubChangelogGenerator::Generator do end subject do - @generator.get_filtered_tags(%w(1 2 3)) + @generator.get_filtered_tags(tags_mash_from_strings(%w(1 2 3))) end it { is_expected.to be_a(Array) } - it { is_expected.to match_array(%w(1)) } + it { is_expected.to match_array(tags_mash_from_strings(%w(1))) } end end + def tags_mash_from_strings(tags_strings) + mash_array = [] + tags_strings.each do |tag| + mash_tag = Hashie::Mash.new + mash_tag.name = tag + mash_array << mash_tag + end + mash_array + end + describe "#get_filtered_tags" do - subject { generator.get_filtered_tags(%w(1 2 3 4 5)) } + subject do + tags_mash = tags_mash_from_strings(%w(1 2 3 4 5)) + generator.get_filtered_tags(tags_mash) + end # before { generator.get_filtered_tags(%w(1 2 3 4 5)) } context "with excluded and between tags" do From 6fdcc0c61d23bb3cc1cf200f5de365d613bd5181 Mon Sep 17 00:00:00 2001 From: Petr Korolev Date: Wed, 10 Jun 2015 13:23:46 +0300 Subject: [PATCH 3/3] fix #245 --- .../generator/generator_tags.rb | 10 +++++----- spec/unit/generator/generator_tags_spec.rb | 10 ++++------ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/github_changelog_generator/generator/generator_tags.rb b/lib/github_changelog_generator/generator/generator_tags.rb index 4032a3d..6873c10 100644 --- a/lib/github_changelog_generator/generator/generator_tags.rb +++ b/lib/github_changelog_generator/generator/generator_tags.rb @@ -45,8 +45,8 @@ module GitHubChangelogGenerator filtered_tags = all_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 + unless all_tags.map(&:name).include? tag + Helper.log.warn "Warning: can't find tag #{tag}, specified with --between-tags option." end end filtered_tags = all_tags.select { |tag| @options[:between_tags].include? tag.name } @@ -58,11 +58,11 @@ module GitHubChangelogGenerator filtered_tags = all_tags if @options[:exclude_tags] @options[:exclude_tags].each do |tag| - unless all_tags.include? tag - puts "Warning: can't find tag #{tag}, specified with --between-tags option.".yellow + unless all_tags.map(&:name).include? tag + Helper.log.warn "Warning: can't find tag #{tag}, specified with --exclude-tags option." end end - filtered_tags = all_tags.reject { |tag| @options[:exclude_tags].include? tag } + filtered_tags = all_tags.reject { |tag| @options[:exclude_tags].include? tag.name } end filtered_tags end diff --git a/spec/unit/generator/generator_tags_spec.rb b/spec/unit/generator/generator_tags_spec.rb index 6c4d40e..bc28290 100644 --- a/spec/unit/generator/generator_tags_spec.rb +++ b/spec/unit/generator/generator_tags_spec.rb @@ -58,25 +58,23 @@ describe GitHubChangelogGenerator::Generator do describe "#get_filtered_tags" do subject do - tags_mash = tags_mash_from_strings(%w(1 2 3 4 5)) - generator.get_filtered_tags(tags_mash) + generator.get_filtered_tags(tags_mash_from_strings(%w(1 2 3 4 5))) end - # before { generator.get_filtered_tags(%w(1 2 3 4 5)) } context "with excluded and between tags" do let(:generator) { GitHubChangelogGenerator::Generator.new(between_tags: %w(1 2 3), exclude_tags: %w(2)) } it { is_expected.to be_a Array } - it { is_expected.to match_array(%w(1 3)) } + it { is_expected.to match_array(tags_mash_from_strings(%w(1 3))) } end end describe "#filter_excluded_tags" do - subject { generator.filter_excluded_tags(%w(1 2 3)) } + subject { generator.filter_excluded_tags(tags_mash_from_strings(%w(1 2 3))) } context "with valid excluded tags" do let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags: %w(3)) } it { is_expected.to be_a Array } - it { is_expected.to match_array(%w(1 2)) } + it { is_expected.to match_array(tags_mash_from_strings(%w(1 2))) } end end end