add ability to disable milestones filtering

This commit is contained in:
Petr Korolev 2014-12-22 15:41:20 +02:00
parent 5304e4faf8
commit 657ce0e838
3 changed files with 39 additions and 36 deletions

View File

@ -12,24 +12,20 @@
- *Fixed bug:* Docs lacking or basic behavior not as advertised [\#30](https://github.com/skywinder/Github-Changelog-Generator/issues/30)
- *Fixed bug:* Crash when try generate log for rails [\#35](https://github.com/skywinder/Github-Changelog-Generator/issues/35)
## [1.2.3] (https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.3)
#### 16/12/14
- *Fixed bug:* Encapsulate \[ \> \* \_ \ \] signs in issues names [\#34](https://github.com/skywinder/Github-Changelog-Generator/issues/34)
## [1.2.2] (https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.2)
#### 10/12/14
- *Merged pull-request:* Add a Bitdeli Badge to README [\#36](https://github.com/skywinder/Github-Changelog-Generator/pull/36) ([bitdeli-chef](https://github.com/bitdeli-chef))
- *Fixed bug:* Encapsulate \[ \> \* \_ \ \] signs in issues names [\#34](https://github.com/skywinder/Github-Changelog-Generator/issues/34)
## [1.2.1] (https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.1)
#### 22/11/14
- *Merged pull-request:* Issues for last tag not in list [\#29](https://github.com/skywinder/Github-Changelog-Generator/pull/29) ([skywinder](https://github.com/skywinder))
- *Merged pull-request:* Disable default --filter-pull-requests option. [\#28](https://github.com/skywinder/Github-Changelog-Generator/pull/28) ([skywinder](https://github.com/skywinder))
- *Fixed bug:* Script fills changelog only for first 30 tags. [\#20](https://github.com/skywinder/Github-Changelog-Generator/issues/20)
## [1.2.0] (https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.0)
#### 19/11/14
- *Merged pull-request:* Add filter for pull-requests labels. \(option --filter-pull-requests\) [\#27](https://github.com/skywinder/Github-Changelog-Generator/pull/27) ([skywinder](https://github.com/skywinder))
@ -46,6 +42,8 @@
- *Implemented enhancement:* Implement ability to retrieve GitHub token from ENV variable \(to not put it to script directly\) [\#19](https://github.com/skywinder/Github-Changelog-Generator/issues/19)
- *Fixed bug:* Script fills changelog only for first 30 tags. [\#20](https://github.com/skywinder/Github-Changelog-Generator/issues/20)
## [1.1.2] (https://github.com/skywinder/Github-Changelog-Generator/tree/1.1.2)
#### 12/11/14
- *Merged pull-request:* Fix bug with dot signs in project name [\#18](https://github.com/skywinder/Github-Changelog-Generator/pull/18) ([skywinder](https://github.com/skywinder))

View File

@ -244,13 +244,14 @@ module GitHubChangelogGenerator
end
if @options[:filter_issues_by_milestone]
#delete excess irrelevant issues (according milestones)
filtered_issues.select!{ |issue|
filtered_issues.select! { |issue|
if issue.milestone.nil?
true
else
#check, that this milestone in tag list:
milestone_is_tag = @all_tags.find{|tag|
milestone_is_tag = @all_tags.find { |tag|
tag.name == issue.milestone.title
}
milestone_is_tag.nil?
@ -259,12 +260,12 @@ module GitHubChangelogGenerator
}
#add missed issues (according milestones)
issues_to_add = @issues.select{|issue|
issues_to_add = @issues.select { |issue|
if issue.milestone.nil?
false
else
#check, that this milestone in tag list:
milestone_is_tag = @all_tags.find{|tag|
milestone_is_tag = @all_tags.find { |tag|
tag.name == issue.milestone.title
}
@ -277,6 +278,7 @@ module GitHubChangelogGenerator
}
filtered_issues |= issues_to_add
end
self.create_log(filtered_pull_requests, filtered_issues, newer_tag_name, newer_tag_time)

View File

@ -6,7 +6,7 @@ require_relative 'version'
module GitHubChangelogGenerator
class Parser
def self.parse_options
options = {:tag1 => nil, :tag2 => nil, :format => '%d/%m/%y', :output => 'CHANGELOG.md', :labels => %w(bug enhancement), :pulls => true, :issues => true, :verbose => true, :add_issues_wo_labels => true, :merge_prefix => '*Merged pull-request:* ', :author => true, :pull_request_labels => nil}
options = {:tag1 => nil, :tag2 => nil, :format => '%d/%m/%y', :output => 'CHANGELOG.md', :labels => %w(bug enhancement), :pulls => true, :issues => true, :verbose => true, :add_issues_wo_labels => true, :merge_prefix => '*Merged pull-request:* ', :author => true, :pull_request_labels => nil, :filter_issues_by_milestone => true}
parser = OptionParser.new { |opts|
opts.banner = 'Usage: changelog_generator [options]'
@ -37,6 +37,9 @@ module GitHubChangelogGenerator
opts.on('--[no-]pull-requests', 'Include pull-requests to changelog. Default is true') do |v|
options[:pulls] = v
end
opts.on('--[no-]filter-issues-by-milestone', 'Use milestone to detect when issue was resolved. Default is true') do |last|
options[:filter_issues_by_milestone] = last
end
opts.on('--[no-]author', 'Add author of pull-request in the end. Default is true') do |author|
options[:last] = author
end