Merge branch 'hotfix/update-changelog' into develop
This commit is contained in:
commit
0dddc4a44c
12
CHANGELOG.md
12
CHANGELOG.md
|
@ -1,5 +1,17 @@
|
||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## [1.12.0](https://github.com/skywinder/github-changelog-generator/tree/1.12.0) (2016-04-01)
|
||||||
|
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.11.8...1.12.0)
|
||||||
|
|
||||||
|
**Closed issues:**
|
||||||
|
|
||||||
|
- .github\_changelog\_generator config file is not consistent with the internal options hash [\#312](https://github.com/skywinder/github-changelog-generator/issues/312)
|
||||||
|
- Feature request: YAML front matter [\#276](https://github.com/skywinder/github-changelog-generator/issues/276)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Added tag exclusion with a filter \(string or regex\) [\#320](https://github.com/skywinder/github-changelog-generator/pull/320) ([soundstep](https://github.com/soundstep))
|
||||||
|
|
||||||
## [1.11.8](https://github.com/skywinder/github-changelog-generator/tree/1.11.8) (2016-03-22)
|
## [1.11.8](https://github.com/skywinder/github-changelog-generator/tree/1.11.8) (2016-03-22)
|
||||||
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.11.7...1.11.8)
|
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.11.7...1.11.8)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
PATH
|
PATH
|
||||||
remote: .
|
remote: .
|
||||||
specs:
|
specs:
|
||||||
github_changelog_generator (1.11.8)
|
github_changelog_generator (1.12.0)
|
||||||
bundler (>= 1.7)
|
bundler (>= 1.7)
|
||||||
colorize (~> 0.7)
|
colorize (~> 0.7)
|
||||||
github_api (~> 0.12)
|
github_api (~> 0.12)
|
||||||
|
|
|
@ -129,26 +129,34 @@ module GitHubChangelogGenerator
|
||||||
end
|
end
|
||||||
|
|
||||||
# @param [Array] all_tags all tags
|
# @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)
|
def filter_excluded_tags(all_tags)
|
||||||
return all_tags unless @options[:exclude_tags]
|
if @options[:exclude_tags]
|
||||||
|
|
||||||
apply_exclude_tags(all_tags)
|
apply_exclude_tags(all_tags)
|
||||||
|
elsif @options[:exclude_tags_regex]
|
||||||
|
apply_exclude_tags_regex(all_tags)
|
||||||
|
else
|
||||||
|
all_tags
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def apply_exclude_tags(all_tags)
|
def apply_exclude_tags(all_tags)
|
||||||
if @options[:exclude_tags].is_a?(Regexp)
|
if @options[:exclude_tags].is_a?(Regexp)
|
||||||
filter_tags_with_regex(all_tags)
|
filter_tags_with_regex(all_tags, @options[:exclude_tags])
|
||||||
else
|
else
|
||||||
filter_exact_tags(all_tags)
|
filter_exact_tags(all_tags)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def filter_tags_with_regex(all_tags)
|
def apply_exclude_tags_regex(all_tags)
|
||||||
|
filter_tags_with_regex(all_tags, Regexp.new(@options[:exclude_tags_regex]))
|
||||||
|
end
|
||||||
|
|
||||||
|
def filter_tags_with_regex(all_tags, regex)
|
||||||
warn_if_nonmatching_regex(all_tags)
|
warn_if_nonmatching_regex(all_tags)
|
||||||
all_tags.reject { |tag| @options[:exclude_tags] =~ tag.name }
|
all_tags.reject { |tag| regex =~ tag.name }
|
||||||
end
|
end
|
||||||
|
|
||||||
def filter_exact_tags(all_tags)
|
def filter_exact_tags(all_tags)
|
||||||
|
|
|
@ -122,6 +122,9 @@ module GitHubChangelogGenerator
|
||||||
opts.on("--exclude-tags x,y,z", Array, "Change log will exclude specified tags") do |list|
|
opts.on("--exclude-tags x,y,z", Array, "Change log will exclude specified tags") do |list|
|
||||||
options[:exclude_tags] = list
|
options[:exclude_tags] = list
|
||||||
end
|
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|
|
opts.on("--since-tag x", "Change log will start after specified tag") do |v|
|
||||||
options[:since_tag] = v
|
options[:since_tag] = v
|
||||||
end
|
end
|
||||||
|
|
|
@ -76,31 +76,47 @@ describe GitHubChangelogGenerator::Generator do
|
||||||
describe "#filter_excluded_tags" do
|
describe "#filter_excluded_tags" do
|
||||||
subject { generator.filter_excluded_tags(tags_mash_from_strings(%w(1 2 3))) }
|
subject { generator.filter_excluded_tags(tags_mash_from_strings(%w(1 2 3))) }
|
||||||
|
|
||||||
context "with valid excluded tags" do
|
context "with matching string" do
|
||||||
let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags: %w(3)) }
|
let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags: %w(3)) }
|
||||||
it { is_expected.to be_a Array }
|
it { is_expected.to be_a Array }
|
||||||
it { is_expected.to match_array(tags_mash_from_strings(%w(1 2))) }
|
it { is_expected.to match_array(tags_mash_from_strings(%w(1 2))) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with invalid excluded tags" do
|
context "with non-matching string" do
|
||||||
let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags: %w(invalid tags)) }
|
let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags: %w(invalid tags)) }
|
||||||
it { is_expected.to be_a Array }
|
it { is_expected.to be_a Array }
|
||||||
it { is_expected.to match_array(tags_mash_from_strings(%w(1 2 3))) }
|
it { is_expected.to match_array(tags_mash_from_strings(%w(1 2 3))) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with regex exclude_tags" do
|
context "with matching regex" do
|
||||||
let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags: /[23]/) }
|
let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags: /[23]/) }
|
||||||
it { is_expected.to be_a Array }
|
it { is_expected.to be_a Array }
|
||||||
it { is_expected.to match_array(tags_mash_from_strings(%w(1))) }
|
it { is_expected.to match_array(tags_mash_from_strings(%w(1))) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with non-matching regex in exclude_tags" do
|
context "with non-matching regex" do
|
||||||
let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags: /[abc]/) }
|
let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags: /[abc]/) }
|
||||||
it { is_expected.to be_a Array }
|
it { is_expected.to be_a Array }
|
||||||
it { is_expected.to match_array(tags_mash_from_strings(%w(1 2 3))) }
|
it { is_expected.to match_array(tags_mash_from_strings(%w(1 2 3))) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#filter_excluded_tags_regex" do
|
||||||
|
subject { generator.filter_excluded_tags(tags_mash_from_strings(%w(1 2 3))) }
|
||||||
|
|
||||||
|
context "with matching regex" do
|
||||||
|
let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags_regex: '[23]') }
|
||||||
|
it { is_expected.to be_a Array }
|
||||||
|
it { is_expected.to match_array(tags_mash_from_strings(%w(1))) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with non-matching regex" do
|
||||||
|
let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags_regex: '[45]') }
|
||||||
|
it { is_expected.to be_a Array }
|
||||||
|
it { is_expected.to match_array(tags_mash_from_strings(%w(1 2 3))) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "#filter_since_tag" do
|
describe "#filter_since_tag" do
|
||||||
context "with filled array" do
|
context "with filled array" do
|
||||||
subject { generator.filter_since_tag(tags_mash_from_strings(%w(1 2 3))) }
|
subject { generator.filter_since_tag(tags_mash_from_strings(%w(1 2 3))) }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user