forked from rubocop/rubocop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchangelog.rake
35 lines (29 loc) · 916 Bytes
/
changelog.rake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# frozen_string_literal: true
autoload :Changelog, "#{__dir__}/changelog"
namespace :changelog do
%i[new fix change].each do |type|
desc "Create a Changelog entry (#{type})"
task type, [:id] do |_task, args|
ref_type = :pull if args[:id]
path = Changelog::Entry.new(type: type, ref_id: args[:id], ref_type: ref_type).write
cmd = "git add #{path}"
system cmd
puts "Entry '#{path}' created and added to git index"
end
end
desc 'Merge entries and delete them'
task :merge do
raise 'No entries!' unless Changelog.pending?
Changelog.new.merge!.and_delete!
cmd = "git commit -a -m 'Update Changelog'"
puts cmd
system cmd
end
desc 'Check for no pending changelog entries'
task :check_clean do
next unless Changelog.pending?
puts '*** Pending changelog entries!'
puts 'Do `bundle exec rake changelog:merge`'
exit(1)
end
end