buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From as...@apache.org
Subject svn commit: r705727 - in /incubator/buildr/trunk/spec: sandbox.rb spec_helpers.rb
Date Fri, 17 Oct 2008 19:20:40 GMT
Author: assaf
Date: Fri Oct 17 12:20:40 2008
New Revision: 705727

URL: http://svn.apache.org/viewvc?rev=705727&view=rev
Log:
This change necessary to run the full test suite, since autoload doesn't play nicely with
our sandbox.
There should be a better way, in which we're able to test autoload, we'll need to revisit
this.

Modified:
    incubator/buildr/trunk/spec/sandbox.rb
    incubator/buildr/trunk/spec/spec_helpers.rb

Modified: incubator/buildr/trunk/spec/sandbox.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/sandbox.rb?rev=705727&r1=705726&r2=705727&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/sandbox.rb (original)
+++ incubator/buildr/trunk/spec/sandbox.rb Fri Oct 17 12:20:40 2008
@@ -25,8 +25,9 @@
 require 'buildr/groovy'
 
 Java.load # Anything added to the classpath.
-task('buildr:scala:download').invoke
-artifacts(TestFramework.frameworks.map(&:dependencies).flatten, JUnit.ant_taskdef).each
{ |a| file(a).invoke }
+artifacts(TestFramework.frameworks.map(&:dependencies).flatten, JUnit.ant_taskdef).each
do |path|
+  file(path).invoke
+end
 
 ENV['HOME'] = File.expand_path('tmp/home')
 
@@ -43,7 +44,7 @@
     end
     
     # Require an addon without letting its callbacks pollute the Project class.
-    def require_addon addon_require_path
+    def require_addon(addon_require_path)
       project_callbacks_without_addon = Project.class_eval { @callbacks }.dup
       begin
         require addon_require_path
@@ -83,7 +84,7 @@
     Buildr.application.instance_eval { @rakefile = File.expand_path('buildfile') }
 
     @_sandbox[:load_path] = $LOAD_PATH.clone
-    @_sandbox[:loaded_features] = $LOADED_FEATURES.clone
+    #@_sandbox[:loaded_features] = $LOADED_FEATURES.clone
     
     # Later on we'll want to lose all the on_define created during the test.
     @_sandbox[:on_define] = Project.class_eval { (@on_define || []).dup }
@@ -123,8 +124,13 @@
     Layout.default = @_sandbox[:layout].clone
 
     $LOAD_PATH.replace @_sandbox[:load_path]
+<<<<<<< HEAD:spec/sandbox.rb
     $LOADED_FEATURES.replace @_sandbox[:loaded_features]
     FileUtils.rm_rf @temp
+=======
+    #$LOADED_FEATURES.replace @_sandbox[:loaded_features]
+    FileUtils.rm_rf Dir.pwd
+>>>>>>> This change necessary to run the full test suite, since autoload
doesn't play nicely with our sandbox.:spec/sandbox.rb
 
     # Get rid of all artifacts.
     @_sandbox[:artifacts].tap { |artifacts| Artifact.class_eval { @artifacts = artifacts
} }

Modified: incubator/buildr/trunk/spec/spec_helpers.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/spec_helpers.rb?rev=705727&r1=705726&r2=705727&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/spec_helpers.rb (original)
+++ incubator/buildr/trunk/spec/spec_helpers.rb Fri Oct 17 12:20:40 2008
@@ -19,7 +19,17 @@
 unless defined?(SpecHelpers)
 
   require 'rubygems'
-  $LOAD_PATH.unshift File.expand_path('../lib', File.dirname(__FILE__)), File.expand_path('../addon',
File.dirname(__FILE__))
+  # Make sure to load from these paths first, we don't want to load any
+  # code from Gem library.
+  $LOAD_PATH.unshift File.expand_path('../lib', File.dirname(__FILE__)),
+                     File.expand_path('../addon', File.dirname(__FILE__))
+  # Buildr uses autoload extensively, but autoload when running specs creates
+  # a problem -- we sandbox $LOADED_FEATURES, so we endup autoloading the same
+  # module twice. This turns autoload into a require, which is not the right
+  # thing, but will do for now.
+  def autoload(symbol, path)
+    require path
+  end
   require 'buildr'
 
   require File.expand_path('sandbox', File.dirname(__FILE__))



Mime
View raw message