Improve the task to generate the release summary

Now it accepts the base release to be compared with.

[ci skip]
This commit is contained in:
Rafael Mendonça França 2018-12-04 13:05:53 -05:00
parent e5172265bf
commit e91bf5966e
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948
1 changed files with 10 additions and 5 deletions

View File

@ -122,15 +122,20 @@ namespace :changelog do
end
end
task :release_summary do
(FRAMEWORKS + ["guides"]).each do |fw|
puts "## #{fw}"
task :release_summary, [:base_release] do |_, args|
release_regexp = args[:base_release] ? Regexp.escape(args[:base_release]) : /\d+\.\d+\.\d+/
FRAMEWORKS.each do |fw|
puts "## #{FRAMEWORK_NAMES[fw]}"
fname = File.join fw, "CHANGELOG.md"
contents = File.readlines fname
contents.shift
changes = []
changes << contents.shift until contents.first =~ /^\*Rails \d+\.\d+\.\d+/
puts changes.reject { |change| change.strip.empty? }.join
until contents.first =~ /^## Rails #{release_regexp}.*$/
changes << contents.shift
end
puts changes.join
puts
end
end