Skip to content

Commit c5111f7

Browse files
committed
Add changelog update rake task
1 parent 43e4264 commit c5111f7

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ unless ENV['CI']
1010
gem 'pry'
1111
gem 'spring-commands-rspec'
1212
gem 'launchy'
13+
gem 'github_fast_changelog', require: false
1314
end
1415

1516
group :test do

Rakefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,24 @@ cd -
3939
BASH
4040
end
4141
end
42+
43+
namespace :changelog do
44+
desc "Update changelog"
45+
task :update do
46+
original_file = './CHANGELOG.md'
47+
new_file = original_file + '.new'
48+
backup = original_file + '.old'
49+
changes = `git rev-list #{ENV['PREVIOUS_VERSION']}...master | bundle exec github_fast_changelog AlchemyCMS/alchemy-devise`
50+
File.open(new_file, 'w') do |fo|
51+
fo.puts changes
52+
File.foreach(original_file) do |li|
53+
fo.puts li
54+
end
55+
fo.puts ""
56+
end
57+
File.rename(original_file, backup)
58+
File.rename(new_file, original_file)
59+
File.delete(backup)
60+
end
61+
end
4262
end

0 commit comments

Comments
 (0)