diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-10-30 17:33:31 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-10-30 18:03:18 -0200 |
commit | d52baa851480ca79d60333187cd0dab9338b7c5f (patch) | |
tree | 766daa986eb3b58e47b6c28bed45b5b3cfd3a97f | |
parent | 08225104d15a7755289f71d74e9a0d04171a59c7 (diff) | |
download | rails-d52baa851480ca79d60333187cd0dab9338b7c5f.tar.gz rails-d52baa851480ca79d60333187cd0dab9338b7c5f.tar.bz2 rails-d52baa851480ca79d60333187cd0dab9338b7c5f.zip |
Add tasks to automatize CHANGELOG headers
-rw-r--r-- | tasks/release.rb | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tasks/release.rb b/tasks/release.rb index 2c7e927679..4711974b63 100644 --- a/tasks/release.rb +++ b/tasks/release.rb @@ -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 |