diff --git a/Rakefile b/Rakefile index 84e1868c9..df51b9a69 100644 --- a/Rakefile +++ b/Rakefile @@ -15,7 +15,7 @@ begin rescue LoadError end -task :default => [:clobber, :compile, 'README.md', :test] +task :default => [:clobber, :compile, 'README.md', :check_readme, :test] file 'README.md' => ['lib/debug/session.rb', 'lib/debug/config.rb', 'exe/rdbg', 'misc/README.md.erb'] do @@ -25,6 +25,20 @@ file 'README.md' => ['lib/debug/session.rb', 'lib/debug/config.rb', puts 'README.md is updated.' end +task :check_readme do + require_relative 'lib/debug/session' + require 'erb' + current_readme = File.read("README.md") + generated_readme = ERB.new(File.read('misc/README.md.erb')).result + + if current_readme != generated_readme + fail <<~MSG + The content of README.md doesn't match its template and/or source. + Please apply the changes to info source (e.g. command comments) or the template and run 'rake README.md' to update README.md. + MSG + end +end + task :test_protocol do ENV['RUBY_DEBUG_PROTOCOL_TEST'] = '1' end