28702026900fbb3584f1299d345769721c8f5ab0
[ruby_koans.git] / rakelib / checks.rake
1 namespace "check" do
2
3   desc "Check that the require files match the about_* files"
4   task :abouts do
5     about_files = Dir['src/about_*.rb'].size
6     about_requires = `grep require src/path_to_enlightenment.rb | wc -l`.to_i
7     puts "Checking path_to_enlightenment completeness"
8     puts "# of about files:    #{about_files}"
9     puts "# of about requires: #{about_requires}"
10     if about_files > about_requires
11       puts "*** There seems to be requires missing in the path to enlightenment"
12     else
13       puts "OK"
14     end
15     puts
16   end
17
18   desc "Check that asserts have __ replacements"
19   task :asserts do
20     puts "Checking for asserts missing the replacement text:"
21     begin
22       sh "egrep -n 'assert( |_)' src/about_* | egrep -v '__|_n_|project|about_assert' | egrep -v ' *#'"
23       puts
24       puts "Examine the above lines for missing __ replacements"
25     rescue RuntimeError => ex
26       puts "OK"
27     end
28     puts
29   end
30 end
31
32 desc "Run some simple consistancy checks"
33 task :check => ["check:abouts", "check:asserts"]