You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by bo...@apache.org on 2010/11/16 06:19:32 UTC

svn commit: r1035532 - /buildr/trunk/lib/buildr.rb

Author: boisvert
Date: Tue Nov 16 05:19:32 2010
New Revision: 1035532

URL: http://svn.apache.org/viewvc?rev=1035532&view=rev
Log:
No need to hardcode RSpec in namespacing code

Modified:
    buildr/trunk/lib/buildr.rb

Modified: buildr/trunk/lib/buildr.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr.rb?rev=1035532&r1=1035531&r2=1035532&view=diff
==============================================================================
--- buildr/trunk/lib/buildr.rb (original)
+++ buildr/trunk/lib/buildr.rb Tue Nov 16 05:19:32 2010
@@ -27,11 +27,18 @@ require 'buildr/run'
 # Methods defined in Buildr are both instance methods (e.g. when included in Project)
 # and class methods when invoked like Buildr.artifacts().
 module Buildr ; extend self ; end
+
 # The Buildfile object (self) has access to all the Buildr methods and constants.
 class << self ; include Buildr ; end
+
+# All modules defined under Buildr::* can be referenced without Buildr:: prefix
+# unless a conflict exists (e.g.  Buildr::RSpec vs ::RSpec)
 class Object #:nodoc:
   Buildr.constants.each do |name|
     const = Buildr.const_get(name)
-    const_set name, const if const.is_a?(Module) && name.to_s != "RSpec"
+    if const.is_a?(Module)
+      const_set name, const unless const_defined?(name)
+    end
   end
 end
+