Drop Hashie dependency
This commit is contained in:
parent
3df84403c4
commit
6d45d90a5f
|
@ -40,21 +40,22 @@ module GitHubChangelogGenerator
|
|||
end.reverse!
|
||||
end
|
||||
|
||||
# Try to find tag date in local hash.
|
||||
# Otherwise fFetch tag time and put it to local hash file.
|
||||
# @param [Hash] tag_name name of the tag
|
||||
# Returns date for given GitHub Tag hash
|
||||
#
|
||||
# Memoize the date by tag name.
|
||||
#
|
||||
# @param [Hash] tag_hash
|
||||
#
|
||||
# @return [Time] time of specified tag
|
||||
def get_time_of_tag(tag_name)
|
||||
raise ChangelogGeneratorError, "tag_name is nil" if tag_name.nil?
|
||||
|
||||
name_of_tag = tag_name["name"]
|
||||
time_for_name = @tag_times_hash[name_of_tag]
|
||||
if !time_for_name.nil?
|
||||
time_for_name
|
||||
else
|
||||
time_string = @fetcher.fetch_date_of_tag tag_name
|
||||
name_of_tag = tag_hash.fetch("name")
|
||||
time_for_tag_name = @tag_times_hash[name_of_tag]
|
||||
return time_for_tag_name if time_for_tag_name
|
||||
|
||||
@fetcher.fetch_date_of_tag(tag_hash).tap do |time_string|
|
||||
@tag_times_hash[name_of_tag] = time_string
|
||||
time_string
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -147,11 +148,11 @@ module GitHubChangelogGenerator
|
|||
# @return [Array] filtered tags according :between_tags option
|
||||
def filter_between_tags(all_tags)
|
||||
filtered_tags = all_tags
|
||||
tag_names = filtered_tags.map{ |ft| ft['name'] }
|
||||
tag_names = filtered_tags.map { |ft| ft['name'] }
|
||||
|
||||
if @options[:between_tags]
|
||||
@options[:between_tags].each do |tag|
|
||||
unless tag_names.include? tag
|
||||
unless tag_names.include?(tag)
|
||||
Helper.log.warn "Warning: can't find tag #{tag}, specified with --between-tags option."
|
||||
end
|
||||
end
|
||||
|
@ -207,7 +208,7 @@ module GitHubChangelogGenerator
|
|||
end
|
||||
|
||||
def warn_if_tag_not_found(all_tags, tag)
|
||||
unless all_tags.map { |t| t["name"] }.include? tag
|
||||
unless all_tags.map { |t| t["name"] }.include?(tag)
|
||||
Helper.log.warn "Warning: can't find tag #{tag}, specified with --exclude-tags option."
|
||||
end
|
||||
end
|
||||
|
|
|
@ -200,7 +200,8 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
|||
|
||||
# Fetch tag time from repo
|
||||
#
|
||||
# @param [Hash] tag
|
||||
# @param [Hash] tag GitHub data item about a Tag
|
||||
#
|
||||
# @return [Time] time of specified tag
|
||||
def fetch_date_of_tag(tag)
|
||||
commit_data = check_github_response { @client.commit(user_project, tag["commit"]["sha"]) }
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
describe GitHubChangelogGenerator::Generator do
|
||||
def tag_with_name(tag)
|
||||
{}.tap { |mash_tag| mash_tag["name"] = tag }
|
||||
{
|
||||
'name' => tag
|
||||
}
|
||||
end
|
||||
|
||||
def tags_from_strings(tags_strings)
|
||||
|
|
Loading…
Reference in New Issue
Block a user