From ca5d6d9675602b96a36e8e539d877a8d6d5642a4 Mon Sep 17 00:00:00 2001 From: Andrew Waage Date: Thu, 19 May 2016 23:55:16 -0700 Subject: [PATCH] using strings instead of symbols --- lib/github_changelog_generator/fetcher.rb | 2 +- .../generator/generator_fetcher.rb | 20 +++++++++---------- .../octo_fetcher.rb | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/github_changelog_generator/fetcher.rb b/lib/github_changelog_generator/fetcher.rb index e1181bc..0c9e048 100644 --- a/lib/github_changelog_generator/fetcher.rb +++ b/lib/github_changelog_generator/fetcher.rb @@ -165,7 +165,7 @@ Make sure, that you push tags to remote repo via 'git push --tags'" print_in_same_line(" ") end - # Fetch event for all issues and add them to :events + # Fetch event for all issues and add them to events # @param [Array] issues # @return [Void] def fetch_events_async(issues) diff --git a/lib/github_changelog_generator/generator/generator_fetcher.rb b/lib/github_changelog_generator/generator/generator_fetcher.rb index 73fb24f..22c03aa 100644 --- a/lib/github_changelog_generator/generator/generator_fetcher.rb +++ b/lib/github_changelog_generator/generator/generator_fetcher.rb @@ -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. # @param [Hash] 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 - 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) - issue[:events].reverse!.each do |event| - if event[:event].eql? compare_string + issue['events'].reverse!.each do |event| + if event['event'].eql? compare_string set_date_from_event(event, issue) break end @@ -68,16 +68,16 @@ module GitHubChangelogGenerator # @param [Hash] event # @param [Hash] issue def set_date_from_event(event, issue) - if event[:commit_id].nil? - issue[:actual_date] = issue[:closed_at] + if event['commit_id'].nil? + issue['actual_date'] = issue['closed_at'] else begin commit = @fetcher.fetch_commit(event) - issue[:actual_date] = commit[:commit][:author][:date] - # issue[:actual_date] = commit[:author][:date] + issue['actual_date'] = commit['commit']['author']['date'] + # issue['actual_date'] = commit['author']['date'] rescue - puts "Warning: Can't fetch commit #{event[:commit_id]}. It is probably referenced from another repo." - issue[:actual_date] = issue[:closed_at] + puts "Warning: Can't fetch commit #{event['commit_id']}. It is probably referenced from another repo." + issue['actual_date'] = issue['closed_at'] end end end diff --git a/lib/github_changelog_generator/octo_fetcher.rb b/lib/github_changelog_generator/octo_fetcher.rb index 8efd1b6..9f2fe2d 100644 --- a/lib/github_changelog_generator/octo_fetcher.rb +++ b/lib/github_changelog_generator/octo_fetcher.rb @@ -164,7 +164,7 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow pull_requests end - # Fetch event for all issues and add them to :events + # Fetch event for all issues and add them to 'events' # # @param [Array] issues # @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_slice.each do |issue| threads << Thread.new do - issue[:events] = [] + issue['events'] = [] iterate_pages(@client, 'issue_events', issue['number'], {}) do |new_event| - issue[:events].concat(new_event) + issue['events'].concat(new_event) 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}") i += 1 end