Skip to content

Commit d33fa20

Browse files
committed
Add a task to check if README is really up-to-date
1 parent 63a252b commit d33fa20

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Rakefile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ begin
1515
rescue LoadError
1616
end
1717

18-
task :default => [:clobber, :compile, 'README.md', :test]
18+
task :default => [:clobber, :compile, 'README.md', :check_readme, :test]
1919

2020
file 'README.md' => ['lib/debug/session.rb', 'lib/debug/config.rb',
2121
'exe/rdbg', 'misc/README.md.erb'] do
@@ -25,6 +25,20 @@ file 'README.md' => ['lib/debug/session.rb', 'lib/debug/config.rb',
2525
puts 'README.md is updated.'
2626
end
2727

28+
task :check_readme do
29+
require_relative 'lib/debug/session'
30+
require 'erb'
31+
current_readme = File.read("README.md")
32+
generated_readme = ERB.new(File.read('misc/README.md.erb')).result
33+
34+
if current_readme != generated_readme
35+
fail <<~MSG
36+
The content of README.md doesn't match its template and/or source.
37+
Please apply the changes to info source (e.g. command comments) or the template and run 'rake README.md' to update README.md
38+
MSG
39+
end
40+
end
41+
2842
task :test_protocol do
2943
ENV['RUBY_DEBUG_PROTOCOL_TEST'] = '1'
3044
end

0 commit comments

Comments
 (0)