Clean up user and project from all api calls

This commit is contained in:
Steve Gilvarry 2015-11-20 22:17:10 +11:00
parent fc1fb2eb9a
commit 29fd202ed0

View File

@ -92,9 +92,7 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
issues = [] issues = []
begin begin
response = @github.issues.list user: @options[:user], response = @github.issues.list state: "closed",
repo: @options[:project],
state: "closed",
filter: "all", filter: "all",
labels: nil labels: nil
page_i = 0 page_i = 0
@ -124,11 +122,10 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
pull_requests = [] pull_requests = []
begin begin
if @options[:release_branch].nil? if @options[:release_branch].nil?
response = @github.pull_requests.list @options[:user], response = @github.pull_requests.list state: "closed"
@options[:project],
state: "closed"
else else
response = @github.pull_requests.list @options[:user], @options[:project], state: "closed", base: @options[:release_branch] response = @github.pull_requests.list state: "closed",
base: @options[:release_branch]
end end
page_i = 0 page_i = 0
count_pages = response.count_pages count_pages = response.count_pages
@ -169,9 +166,7 @@ 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
response = @github.issues.events.list user: @options[:user], response = @github.issues.events.list issue_number: issue["number"]
repo: @options[:project],
issue_number: issue["number"]
issue[:events] = [] issue[:events] = []
response.each_page do |page| response.each_page do |page|
issue[:events].concat(page) issue[:events].concat(page)
@ -199,9 +194,7 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
# @return [Time] time of specified tag # @return [Time] time of specified tag
def fetch_date_of_tag(tag) def fetch_date_of_tag(tag)
begin begin
commit_data = @github.git_data.commits.get @options[:user], commit_data = @github.git_data.commits.get tag["commit"]["sha"]
@options[:project],
tag["commit"]["sha"]
rescue rescue
Helper.log.warn GH_RATE_LIMIT_EXCEEDED_MSG.yellow Helper.log.warn GH_RATE_LIMIT_EXCEEDED_MSG.yellow
end end
@ -212,7 +205,7 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
# Fetch commit for specified event # Fetch commit for specified event
# @return [Hash] # @return [Hash]
def fetch_commit(event) def fetch_commit(event)
@github.git_data.commits.get @options[:user], @options[:project], event[:commit_id] @github.git_data.commits.get event[:commit_id]
end end
end end
end end