1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add tasks to automatize CHANGELOG headers

This commit is contained in:
Rafael Mendonça França 2015-10-30 17:33:31 -02:00
parent 08225104d1
commit d52baa8514

View file

@ -66,13 +66,24 @@ directory "pkg"
end
namespace :changelog do
task :header do
(FRAMEWORKS + ['guides']).each do |fw|
require 'date'
fname = File.join fw, 'CHANGELOG.md'
header = "## Rails #{version} (#{Date.today.strftime('%B %d, %Y')}) ##\n\n* No changes.\n\n\n"
contents = header + File.read(fname)
File.open(fname, 'wb') { |f| f.write contents }
end
end
task :release_date do
(FRAMEWORKS + ['guides']).each do |fw|
require 'date'
replace = '\1(' + Date.today.strftime('%B %d, %Y') + ')'
replace = "## Rails #{version} (#{Date.today.strftime('%B %d, %Y')}) ##\n"
fname = File.join fw, 'CHANGELOG.md'
contents = File.read(fname).sub(/^([^(]*)\(unreleased\)/, replace)
contents = File.read(fname).sub(/^(## Rails .*)\n/, replace)
File.open(fname, 'wb') { |f| f.write contents }
end
end