From 675601880d5c899ec3994ff58c1e269769c393b9 Mon Sep 17 00:00:00 2001 From: Petr Korolev Date: Fri, 7 Nov 2014 11:45:01 +0200 Subject: [PATCH] Add changelog generation for last tag --- lib/github_changelog_generator.rb | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/github_changelog_generator.rb b/lib/github_changelog_generator.rb index 6aa2a56..759ede0 100755 --- a/lib/github_changelog_generator.rb +++ b/lib/github_changelog_generator.rb @@ -102,6 +102,8 @@ class ChangelogGenerator log += self.generate_log_between_tags(self.all_tags[index-1], self.all_tags[index]) end + log += self.generate_log_before_tag(self.all_tags.last) + log end @@ -159,16 +161,31 @@ class ChangelogGenerator pull_requests.delete_if { |req| t = Time.parse(req[:closed_at]).utc - true_classor_false_class = t > since_tag_time - classor_false_class = t < till_tag_time + tag_is_later_since = t > since_tag_time + tag_is_before_till = t < till_tag_time - in_range = (true_classor_false_class) && (classor_false_class) + in_range = (tag_is_later_since) && (tag_is_before_till) !in_range } self.create_log(pull_requests, till_tag_name, till_tag_time) end + def generate_log_before_tag(tag) + tag_time = self.get_time_of_tag(tag) + tag_name = tag['name'] + + pull_requests = Array.new(@pull_requests) + + pull_requests.delete_if { |req| + t = Time.parse(req[:closed_at]).utc + t > tag_time + } + + self.create_log(pull_requests, tag_name, tag_time) + + end + def create_log(pull_requests, tag_name, tag_time) trimmed_tag = tag_name.tr('v', '')