Moved checks into a separate rake file.
authorJim Weirich <jim.weirich@gmail.com>
Mon, 27 Sep 2010 17:38:22 +0000 (13:38 -0400)
committerJim Weirich <jim.weirich@gmail.com>
Mon, 27 Sep 2010 17:38:22 +0000 (13:38 -0400)
rakelib/checks.rake [new file with mode: 0644]

diff --git a/rakelib/checks.rake b/rakelib/checks.rake
new file mode 100644 (file)
index 0000000..9ef6199
--- /dev/null
@@ -0,0 +1,31 @@
+namespace "check" do
+
+  desc "Check that the require files match the about_* files"
+  task :abouts do
+    about_files = Dir['src/about_*.rb'].size
+    about_requires = `grep require src/path_to_enlightenment.rb | wc -l`.to_i
+    puts "Checking path_to_enlightenment completeness"
+    puts "# of about files:    #{about_files}"
+    puts "# of about requires: #{about_requires}"
+    if about_files > about_requires
+      puts "*** There seems to be requires missing in the path to enlightenment"
+    else
+      puts "OK"
+    end
+    puts
+  end
+
+  task :asserts do
+    puts "Checking for asserts missing the replacement text:"
+    begin
+      sh "egrep -n 'assert( |_)' src/about_* | egrep -v '__|_n_|project|about_assert' | egrep -v ' *#'"
+      puts
+      puts "Examine the above lines for missing __ replacements"
+    rescue RuntimeError => ex
+      puts "OK"
+    end
+    puts
+  end
+end
+
+task :check => ["check:abouts", "check:asserts"]