implement generationg for last 2 tags
This commit is contained in:
parent
90dc5b50ac
commit
b6bc41335c
|
@ -49,20 +49,32 @@ class ChangelogGenerator
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def compund_changelog_for_last_tag
|
def compund_changelog
|
||||||
if @options[:verbose]
|
if @options[:verbose]
|
||||||
puts 'Generating changelog:'
|
puts 'Generating changelog:'
|
||||||
end
|
end
|
||||||
log = ''
|
log = ''
|
||||||
prev_tag = self.all_tags[1]
|
|
||||||
last_tag = self.all_tags[0]
|
|
||||||
|
|
||||||
log += self.generate_log_between_tags(prev_tag, last_tag)
|
if @options[:last]
|
||||||
|
prev_tag = self.all_tags[1]
|
||||||
|
last_tag = self.all_tags[0]
|
||||||
|
|
||||||
|
log += self.generate_log_between_tags(prev_tag, last_tag)
|
||||||
|
elsif @options[:tag1] && @options[:tag2]
|
||||||
|
log += self.generate_log_between_tags(@options[:tag1], @options[:tag2])
|
||||||
|
else
|
||||||
|
log += self.generate_log_for_all_tags
|
||||||
|
end
|
||||||
|
|
||||||
puts log
|
puts log
|
||||||
File.open('output.txt', 'w') { |file| file.write(log) }
|
File.open('output.txt', 'w') { |file| file.write(log) }
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def generate_log_for_all_tags
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
def is_megred(number)
|
def is_megred(number)
|
||||||
@github.pull_requests.merged? $github_user, $github_repo_name, number
|
@github.pull_requests.merged? $github_user, $github_repo_name, number
|
||||||
end
|
end
|
||||||
|
@ -140,9 +152,13 @@ class ChangelogGenerator
|
||||||
end
|
end
|
||||||
|
|
||||||
github_git_data_commits_get = @github.git_data.commits.get $github_user, $github_repo_name, prev_tag['commit']['sha']
|
github_git_data_commits_get = @github.git_data.commits.get $github_user, $github_repo_name, prev_tag['commit']['sha']
|
||||||
time_string = github_git_data_commits_get['committer']['date']
|
if github_git_data_commits_get
|
||||||
Time.parse(time_string)
|
time_string = github_git_data_commits_get['committer']['date']
|
||||||
|
Time.parse(time_string)
|
||||||
|
else
|
||||||
|
puts "Can't find tag #{prev_tag['name']} -> exit"
|
||||||
|
exit
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -151,8 +167,6 @@ if __FILE__ == $0
|
||||||
|
|
||||||
log_generator = ChangelogGenerator.new
|
log_generator = ChangelogGenerator.new
|
||||||
|
|
||||||
prev_tag = log_generator.all_tags[0]
|
log_generator.compund_changelog
|
||||||
last_tag = log_generator.all_tags[2]
|
|
||||||
puts log_generator.generate_log_between_tags(prev_tag, last_tag)
|
|
||||||
# log_generator.generate_log_between_tags(tags[1], tags[2])
|
# log_generator.generate_log_between_tags(tags[1], tags[2])
|
||||||
end
|
end
|
|
@ -18,6 +18,10 @@ class Parser
|
||||||
opts.on('-v', '--[no-]verbose', 'Run verbosely') do |v|
|
opts.on('-v', '--[no-]verbose', 'Run verbosely') do |v|
|
||||||
@options[:verbose] = v
|
@options[:verbose] = v
|
||||||
end
|
end
|
||||||
|
|
||||||
|
opts.on('-l', '--last-changes', 'generate log between last 2 tags') do |last|
|
||||||
|
@options[:last] = last
|
||||||
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
parser.parse!
|
parser.parse!
|
||||||
|
|
Loading…
Reference in New Issue
Block a user