Merge branch 'develop'

This commit is contained in:
Petr Korolev 2015-08-25 15:25:00 +03:00
commit 28e3ed2500
4 changed files with 17 additions and 12 deletions

View File

@ -21,6 +21,8 @@
**Merged pull requests:** **Merged pull requests:**
- This a PR with a lot of comments and events [\#17](https://github.com/skywinder/changelog_test/pull/17) ([skywinder](https://github.com/skywinder))
- PR [\#16](https://github.com/skywinder/changelog_test/pull/16) ([skywinder](https://github.com/skywinder))
- This PR closes 14 from commit [\#15](https://github.com/skywinder/changelog_test/pull/15) ([skywinder](https://github.com/skywinder)) - This PR closes 14 from commit [\#15](https://github.com/skywinder/changelog_test/pull/15) ([skywinder](https://github.com/skywinder))
- This PR to close \#12 from body [\#13](https://github.com/skywinder/changelog_test/pull/13) ([skywinder](https://github.com/skywinder)) - This PR to close \#12 from body [\#13](https://github.com/skywinder/changelog_test/pull/13) ([skywinder](https://github.com/skywinder))

View File

@ -163,10 +163,13 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
issues_slice.each do |issue| issues_slice.each do |issue|
threads << Thread.new do threads << Thread.new do
begin begin
obj = @github.issues.events.list user: @options[:user], response = @github.issues.events.list user: @options[:user],
repo: @options[:project], repo: @options[:project],
issue_number: issue["number"] issue_number: issue["number"]
issue[:events] = obj.body issue[:events] = []
response.each_page do |page|
issue[:events].concat(page)
end
rescue rescue
Helper.log.warn GH_RATE_LIMIT_EXCEEDED_MSG.yellow Helper.log.warn GH_RATE_LIMIT_EXCEEDED_MSG.yellow
end end

View File

@ -48,11 +48,11 @@ module GitHubChangelogGenerator
# Fill :actual_date parameter of specified issue by closed date of the commit, if it was closed by commit. # Fill :actual_date parameter of specified issue by closed date of the commit, if it was closed by commit.
# @param [Hash] issue # @param [Hash] issue
def find_closed_date_by_commit(issue) def find_closed_date_by_commit(issue)
unless issue["events"].nil? unless issue[:events].nil?
# if it's PR -> then find "merged event", in case of usual issue -> fond closed date # if it's PR -> then find "merged event", in case of usual issue -> fond closed date
compare_string = issue[:merged_at].nil? ? "closed" : "merged" compare_string = issue[:merged_at].nil? ? "closed" : "merged"
# reverse! - to find latest closed event. (event goes in date order) # reverse! - to find latest closed event. (event goes in date order)
issue["events"].reverse!.each do |event| issue[:events].reverse!.each do |event|
if event[:event].eql? compare_string if event[:event].eql? compare_string
set_date_from_event(event, issue) set_date_from_event(event, issue)
break break

View File

@ -63,21 +63,21 @@ module GitHubChangelogGenerator
end end
# Method filter issues, that belong only specified tag range # Method filter issues, that belong only specified tag range
# @param [Array] array of issues to filter # @param [Array] issues issues to filter
# @param [Symbol] hash_key key of date value default is :actual_date # @param [Symbol] hash_key key of date value default is :actual_date
# @param [String] older_tag all issues before this tag date will be excluded. May be nil, if it's first tag # @param [String] older_tag all issues before this tag date will be excluded. May be nil, if it's first tag
# @param [String] newer_tag all issue after this tag will be excluded. May be nil for unreleased section # @param [String] newer_tag all issue after this tag will be excluded. May be nil for unreleased section
# @return [Array] filtered issues # @return [Array] filtered issues
def delete_by_time(array, hash_key = :actual_date, older_tag = nil, newer_tag = nil) def delete_by_time(issues, hash_key = :actual_date, older_tag = nil, newer_tag = nil)
# in case if not tags specified - return unchanged array # in case if not tags specified - return unchanged array
return array if older_tag.nil? && newer_tag.nil? return issues if older_tag.nil? && newer_tag.nil?
newer_tag_time = newer_tag && get_time_of_tag(newer_tag) newer_tag_time = newer_tag && get_time_of_tag(newer_tag)
older_tag_time = older_tag && get_time_of_tag(older_tag) older_tag_time = older_tag && get_time_of_tag(older_tag)
array.select do |req| issues.select do |issue|
if req[hash_key] if issue[hash_key]
time = Time.parse(req[hash_key]).utc time = Time.parse(issue[hash_key]).utc
tag_in_range_old = tag_newer_old_tag?(older_tag_time, time) tag_in_range_old = tag_newer_old_tag?(older_tag_time, time)