Sort tag by date, not by name

This commit is contained in:
Petr Korolev 2014-11-17 17:43:37 +02:00
parent 269ab4e790
commit 0ab44f79f7

View File

@ -100,6 +100,19 @@ class ChangelogGenerator
def generate_log_for_all_tags def generate_log_for_all_tags
log = '' log = ''
@all_tags.each {|tag| self.get_time_of_tag(tag)}
if @options[:verbose]
puts "Sorting tags.."
end
@all_tags.sort_by! {|x| self.get_time_of_tag(x)}.reverse!
if @options[:verbose]
puts "Generating log.."
end
for index in 1 ... self.all_tags.size for index in 1 ... self.all_tags.size
log += self.generate_log_between_tags(self.all_tags[index], self.all_tags[index-1]) log += self.generate_log_between_tags(self.all_tags[index], self.all_tags[index-1])
end end
@ -307,7 +320,7 @@ class ChangelogGenerator
end end
if @options[:verbose] if @options[:verbose]
puts "Get time for tag #{prev_tag['name']}" puts "Getting time for tag #{prev_tag['name']}"
end end
github_git_data_commits_get = @github.git_data.commits.get @options[:user], @options[:project], prev_tag['commit']['sha'] github_git_data_commits_get = @github.git_data.commits.get @options[:user], @options[:project], prev_tag['commit']['sha']