You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by eh...@apache.org on 2007/01/30 07:05:22 UTC

svn commit: r501317 - /lucene/solr/trunk/client/ruby/solrb/Rakefile

Author: ehatcher
Date: Mon Jan 29 22:05:21 2007
New Revision: 501317

URL: http://svn.apache.org/viewvc?view=rev&rev=501317
Log:
Cosmetic cleanup of Rakefile, adding descriptions for all publicly desirable tasks

Modified:
    lucene/solr/trunk/client/ruby/solrb/Rakefile

Modified: lucene/solr/trunk/client/ruby/solrb/Rakefile
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/ruby/solrb/Rakefile?view=diff&rev=501317&r1=501316&r2=501317
==============================================================================
--- lucene/solr/trunk/client/ruby/solrb/Rakefile (original)
+++ lucene/solr/trunk/client/ruby/solrb/Rakefile Mon Jan 29 22:05:21 2007
@@ -62,7 +62,7 @@
   pkg.need_tar = true
 end
 
-# Generate rdoc documentation
+desc "Generate rdoc documentation"
 Rake::RDocTask.new('doc') do |rd|
   rd.rdoc_files.include("lib/**/*.rb")
   rd.rdoc_files.include('README', 'CHANGES.txt', 'LICENSE.txt')
@@ -70,32 +70,13 @@
   rd.rdoc_dir = 'doc'
 end
 
-# Run unit tests
+desc "Run unit tests"
 Rake::TestTask.new(:test_units) do |t|
   t.pattern = 'test/unit/*_test.rb'
   t.verbose = true
   t.ruby_opts = ['-r solr', '-r test/unit', '-Itest/unit']
 end
 
-def egrep(pattern)
-  Dir['**/*.rb'].each do |fn|
-    count = 0
-    open(fn) do |f|
-      while line = f.gets
-	count += 1
-	if line =~ pattern
-	  puts "#{fn}:#{count}:#{line}"
-	end
-      end
-    end
-  end
-end
-
-desc "Look for TODO/FIXME/TBD tags in the code"
-task :todo do
-  egrep /#.*(FIXME|TODO|TBD)/
-end
-
 # NOTE: test_functionals does not work standalone currently.  It needs the TestSolrServer wrapper in the :test task
 Rake::TestTask.new(:test_functionals) do |t|
   t.pattern = 'test/functional/*_test.rb'
@@ -103,10 +84,8 @@
   t.ruby_opts = ['-r solr', '-r test/unit', '-Itest/functional']
 end
 
-task :test do
-  # unit tests don't require a solr server
-  Rake::Task[:test_units].invoke
-
+desc "Run unit and functional tests"
+task :test => [:test_units] do
   rm_rf "test/data"  # remove functional test temp data directory
   
   # wrap functional tests with a test-specific Solr server
@@ -117,17 +96,39 @@
   raise "test failures" if got_error
 end
 
+# TODO: consider replacing system() to rcov with the included
+#       Rake task: http://eigenclass.org/hiki.rb?cmd=view&p=rcov+FAQ&key=rake
 namespace :test do
   desc 'Measures test coverage'
   # borrowed from here: http://clarkware.com/cgi/blosxom/2007/01/05#RcovRakeTask
   task :coverage do
     rm_rf "coverage"
     rm_rf "coverage.data"
-    TestSolrServer.wrap do
+    TestSolrServer.wrap(:quiet => ENV['SOLR_CONSOLE'] ? false : true) do
       system("rcov --aggregate coverage.data --text-summary -Ilib:test/functional test/functional/*_test.rb")
     end
     system("rcov --aggregate coverage.data --text-summary -Ilib:test/unit test/unit/*_test.rb")
     system("open coverage/index.html") if PLATFORM['darwin']
   end
+end
+
 
+def egrep(pattern)
+  Dir['**/*.rb'].each do |fn|
+    count = 0
+    open(fn) do |f|
+      while line = f.gets
+	count += 1
+	if line =~ pattern
+	  puts "#{fn}:#{count}:#{line}"
+	end
+      end
+    end
+  end
 end
+
+desc "Report TODO/FIXME/TBD tags in the code"
+task :todo do
+  egrep /#.*(FIXME|TODO|TBD)/
+end
+