Add changelog generation for last tag

This commit is contained in:
Petr Korolev 2014-11-07 11:45:01 +02:00
parent 20095c571d
commit 675601880d

View File

@ -102,6 +102,8 @@ class ChangelogGenerator
log += self.generate_log_between_tags(self.all_tags[index-1], self.all_tags[index]) log += self.generate_log_between_tags(self.all_tags[index-1], self.all_tags[index])
end end
log += self.generate_log_before_tag(self.all_tags.last)
log log
end end
@ -159,16 +161,31 @@ class ChangelogGenerator
pull_requests.delete_if { |req| pull_requests.delete_if { |req|
t = Time.parse(req[:closed_at]).utc t = Time.parse(req[:closed_at]).utc
true_classor_false_class = t > since_tag_time tag_is_later_since = t > since_tag_time
classor_false_class = t < till_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 !in_range
} }
self.create_log(pull_requests, till_tag_name, till_tag_time) self.create_log(pull_requests, till_tag_name, till_tag_time)
end 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) def create_log(pull_requests, tag_name, tag_time)
trimmed_tag = tag_name.tr('v', '') trimmed_tag = tag_name.tr('v', '')