add documentation
This commit is contained in:
parent
ff6115247e
commit
67fbb04b31
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
module GitHubChangelogGenerator
|
module GitHubChangelogGenerator
|
||||||
# A Fetcher responsible for all requests to GitHub and all basic manipulation with related data
|
# A Fetcher responsible for all requests to GitHub and all basic manipulation with related data
|
||||||
# (such as filtering, validating, e.t.c)
|
# (such as filtering, validating, e.t.c)
|
||||||
|
@ -45,13 +44,11 @@ module GitHubChangelogGenerator
|
||||||
def get_all_tags
|
def get_all_tags
|
||||||
print "Fetching tags...\r" if @options[:verbose]
|
print "Fetching tags...\r" if @options[:verbose]
|
||||||
|
|
||||||
tags = []
|
check_github_response { github_fetch_tags }
|
||||||
|
|
||||||
check_github_response { github_fetch_tags(tags) }
|
|
||||||
|
|
||||||
tags
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# This is wrapper with rescue block
|
||||||
|
# @return [Object] returns exactly the same, what you put in the block, but wrap it with begin-rescue block
|
||||||
def check_github_response
|
def check_github_response
|
||||||
begin
|
begin
|
||||||
value = yield
|
value = yield
|
||||||
|
@ -65,7 +62,10 @@ module GitHubChangelogGenerator
|
||||||
value
|
value
|
||||||
end
|
end
|
||||||
|
|
||||||
def github_fetch_tags(tags)
|
# Fill input array with tags
|
||||||
|
# @return [Array] array of tags in repo
|
||||||
|
def github_fetch_tags
|
||||||
|
tags = []
|
||||||
response = @github.repos.tags @options[:user], @options[:project]
|
response = @github.repos.tags @options[:user], @options[:project]
|
||||||
page_i = 0
|
page_i = 0
|
||||||
count_pages = response.count_pages
|
count_pages = response.count_pages
|
||||||
|
@ -82,6 +82,7 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
||||||
else
|
else
|
||||||
Helper.log.info "Found #{tags.count} tags"
|
Helper.log.info "Found #{tags.count} tags"
|
||||||
end
|
end
|
||||||
|
tags
|
||||||
end
|
end
|
||||||
|
|
||||||
# This method fetch all closed issues and separate them to pull requests and pure issues
|
# This method fetch all closed issues and separate them to pull requests and pure issues
|
||||||
|
@ -141,10 +142,13 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
||||||
pull_requests
|
pull_requests
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Print specified line on the same string
|
||||||
|
# @param [String] log_string
|
||||||
def print_in_same_line(log_string)
|
def print_in_same_line(log_string)
|
||||||
print log_string + "\r"
|
print log_string + "\r"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Print long line with spaces on same line to clear prev message
|
||||||
def print_empty_line
|
def print_empty_line
|
||||||
print_in_same_line(" ")
|
print_in_same_line(" ")
|
||||||
end
|
end
|
||||||
|
@ -203,7 +207,7 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
||||||
@tag_times_hash[tag_name["name"]] = Time.parse(time_string)
|
@tag_times_hash[tag_name["name"]] = Time.parse(time_string)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Fetch commit for specifed 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 @options[:user], @options[:project], event[:commit_id]
|
||||||
|
|
|
@ -52,7 +52,7 @@ describe GitHubChangelogGenerator::Fetcher do
|
||||||
@fetcher = GitHubChangelogGenerator::Fetcher.new(options)
|
@fetcher = GitHubChangelogGenerator::Fetcher.new(options)
|
||||||
end
|
end
|
||||||
it "should raise Unauthorized error" do
|
it "should raise Unauthorized error" do
|
||||||
expect { @fetcher.github_fetch_tags [] }.to raise_error Github::Error::Unauthorized
|
expect { @fetcher.github_fetch_tags }.to raise_error Github::Error::Unauthorized
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user