Author: boisvert
Date: Tue Sep 21 13:21:09 2010
New Revision: 999399

URL: http://svn.apache.org/viewvc?rev=999399&view=rev
Log:
BUILDR-513 --trace fails with NoMethodError : undefined method `include?' for 
nil:NilClass

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/core/application.rb
    buildr/trunk/spec/core/application_spec.rb

Modified: buildr/trunk/CHANGELOG
URL: 
http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=999399&r1=999398&r2=999399&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Tue Sep 21 13:21:09 2010
@@ -1,5 +1,7 @@
 1.4.3 (Pending)
 * Fixed:  BUILDR-512 Buildr::Util.ruby invokes non existent method (Peter 
Donald)
+* Fixed:  BUILDR-513 --trace fails with NoMethodError : undefined method 
+          `include?' for nil:NilClass
 
 1.4.2 (2010-09-18)
 * Added:  BUILDR-415 Ability to exclude tests from command line

Modified: buildr/trunk/lib/buildr/core/application.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/application.rb?rev=999399&r1=999398&r2=999399&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/application.rb (original)
+++ buildr/trunk/lib/buildr/core/application.rb Tue Sep 21 13:21:09 2010
@@ -346,9 +346,7 @@ module Buildr
         ['--trace', '-t [CATEGORIES]', "Turn on invoke/execute tracing, enable 
full backtrace.",
           lambda { |value|
             options.trace = true
-            if value
-              options.trace_categories = value.split(',').map { |v| 
v.downcase.to_sym }
-            end
+            options.trace_categories = value ? value.split(',').map { |v| 
v.downcase.to_sym } : []
             options.trace_all = options.trace_categories.include? :all
             verbose(true)
           }

Modified: buildr/trunk/spec/core/application_spec.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/spec/core/application_spec.rb?rev=999399&r1=999398&r2=999399&view=diff
==============================================================================
--- buildr/trunk/spec/core/application_spec.rb (original)
+++ buildr/trunk/spec/core/application_spec.rb Tue Sep 21 13:21:09 2010
@@ -96,6 +96,30 @@ describe Buildr::Application do
       ARGV.push('--version')
       test_exit(0) { Buildr.application.send(:handle_options) }.should 
show(/Buildr #{Buildr::VERSION}.*/)
     end
+
+    it 'should enable tracing with --trace' do
+      ARGV.push('--trace')
+      Buildr.application.send(:handle_options)
+      Buildr.application.options.trace.should == true
+    end
+
+    it 'should enable tracing of [:foo, :bar] categories with --trace=foo,bar' 
do
+      ARGV.push('--trace=foo,bar')
+      Buildr.application.send(:handle_options)
+      Buildr.application.options.trace.should == true
+      Buildr.application.options.trace_categories.should == [:foo, :bar]
+      trace?(:foo).should == true
+      trace?(:not).should == false
+    end
+
+    it 'should enable tracing for all categories with --trace=all' do
+      ARGV.push('--trace=all')
+      Buildr.application.send(:handle_options)
+      Buildr.application.options.trace.should == true
+      Buildr.application.options.trace_all.should == true
+      trace?(:foo).should == true
+    end
+
   end
 
   describe 'gems' do


Reply via email to