Skip to content

Add changelog generation for last tag #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 7, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions lib/github_changelog_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ def generate_log_for_all_tags
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

Expand Down Expand Up @@ -159,16 +161,31 @@ def generate_log_between_tags(since_tag, till_tag)

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', '')
Expand Down