using strings instead of symbols

This commit is contained in:
Andrew Waage 2016-05-19 23:55:16 -07:00 committed by Olle Jonsson
parent 3cb3584bb9
commit ca5d6d9675
3 changed files with 15 additions and 15 deletions

View File

@ -165,7 +165,7 @@ Make sure, that you push tags to remote repo via 'git push --tags'"
print_in_same_line(" ") print_in_same_line(" ")
end end
# Fetch event for all issues and add them to :events # Fetch event for all issues and add them to events
# @param [Array] issues # @param [Array] issues
# @return [Void] # @return [Void]
def fetch_events_async(issues) def fetch_events_async(issues)

View File

@ -49,12 +49,12 @@ 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
end end
@ -68,16 +68,16 @@ module GitHubChangelogGenerator
# @param [Hash] event # @param [Hash] event
# @param [Hash] issue # @param [Hash] issue
def set_date_from_event(event, issue) def set_date_from_event(event, issue)
if event[:commit_id].nil? if event['commit_id'].nil?
issue[:actual_date] = issue[:closed_at] issue['actual_date'] = issue['closed_at']
else else
begin begin
commit = @fetcher.fetch_commit(event) commit = @fetcher.fetch_commit(event)
issue[:actual_date] = commit[:commit][:author][:date] issue['actual_date'] = commit['commit']['author']['date']
# issue[:actual_date] = commit[:author][:date] # issue['actual_date'] = commit['author']['date']
rescue rescue
puts "Warning: Can't fetch commit #{event[:commit_id]}. It is probably referenced from another repo." puts "Warning: Can't fetch commit #{event['commit_id']}. It is probably referenced from another repo."
issue[:actual_date] = issue[:closed_at] issue['actual_date'] = issue['closed_at']
end end
end end
end end

View File

@ -164,7 +164,7 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
pull_requests pull_requests
end end
# Fetch event for all issues and add them to :events # Fetch event for all issues and add them to 'events'
# #
# @param [Array] issues # @param [Array] issues
# @return [Void] # @return [Void]
@ -175,11 +175,11 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
issues.each_slice(MAX_THREAD_NUMBER) do |issues_slice| issues.each_slice(MAX_THREAD_NUMBER) do |issues_slice|
issues_slice.each do |issue| issues_slice.each do |issue|
threads << Thread.new do threads << Thread.new do
issue[:events] = [] issue['events'] = []
iterate_pages(@client, 'issue_events', issue['number'], {}) do |new_event| iterate_pages(@client, 'issue_events', issue['number'], {}) do |new_event|
issue[:events].concat(new_event) issue['events'].concat(new_event)
end end
issue[:events] = issue[:events].map{|h| h.to_hash.stringify_keys_deep! } issue['events'] = issue['events'].map{|h| h.to_hash.stringify_keys_deep! }
print_in_same_line("Fetching events for issues and PR: #{i + 1}/#{issues.count}") print_in_same_line("Fetching events for issues and PR: #{i + 1}/#{issues.count}")
i += 1 i += 1
end end