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 2011/06/21 20:44:53 UTC

svn commit: r1138130 - in /buildr/trunk/spec: ide/idea_spec.rb packaging/artifact_spec.rb sandbox.rb

Author: boisvert
Date: Tue Jun 21 18:44:52 2011
New Revision: 1138130

URL: http://svn.apache.org/viewvc?rev=1138130&view=rev
Log:
By default, the sandbox remote repository is user's own local M2 repository
since we don't want to remotely download artifacts into the sandbox over and over.

Modified:
    buildr/trunk/spec/ide/idea_spec.rb
    buildr/trunk/spec/packaging/artifact_spec.rb
    buildr/trunk/spec/sandbox.rb

Modified: buildr/trunk/spec/ide/idea_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/ide/idea_spec.rb?rev=1138130&r1=1138129&r2=1138130&view=diff
==============================================================================
--- buildr/trunk/spec/ide/idea_spec.rb (original)
+++ buildr/trunk/spec/ide/idea_spec.rb Tue Jun 21 18:44:52 2011
@@ -179,6 +179,9 @@ describe Buildr::IntellijIdea do
 
       describe "with local_repository_env_override set to nil" do
         before do
+          Buildr.repositories.instance_eval do
+            @local = @remote = @release_to = nil
+          end
           artifact('group:id:jar:1.0') { |t| write t.to_s }
           @foo = define "foo" do
             iml.local_repository_env_override = nil

Modified: buildr/trunk/spec/packaging/artifact_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/packaging/artifact_spec.rb?rev=1138130&r1=1138129&r2=1138130&view=diff
==============================================================================
--- buildr/trunk/spec/packaging/artifact_spec.rb (original)
+++ buildr/trunk/spec/packaging/artifact_spec.rb Tue Jun 21 18:44:52 2011
@@ -18,6 +18,9 @@ require 'fileutils'
 
 describe Artifact do
   before do
+    Buildr.repositories.instance_eval do
+      @local = @remote = @release_to = nil
+    end
     @spec = { :group=>'com.example', :id=>'library', :type=>:jar, :version=>'2.0' }
     @artifact = artifact(@spec)
     @classified = artifact(@spec.merge(:classifier=>'all'))
@@ -145,6 +148,12 @@ end
 
 
 describe Repositories, 'local' do
+  before do
+    Buildr.repositories.instance_eval do
+      @local = @remote = @release_to = nil
+    end
+  end
+
   it 'should default to .m2 path' do
     # For convenience, sandbox actually sets the local repository to a temp directory
     repositories.local = nil
@@ -203,6 +212,10 @@ end
 
 describe Repositories, 'remote' do
   before do
+    Buildr.repositories.instance_eval do
+      @local = @remote = @release_to = nil
+    end
+
     @repos = [ 'http://www.ibiblio.org/maven2', 'http://repo1.maven.org/maven2' ]
   end
 
@@ -879,6 +892,12 @@ end
 
 
 describe Rake::Task, ' artifacts' do
+  before do
+    Buildr.repositories.instance_eval do
+      @local = @remote = @release_to = nil
+    end
+  end
+
   it 'should download all specified artifacts' do
     artifact 'group:id:jar:1.0'
     repositories.remote = 'http://example.com'
@@ -903,6 +922,9 @@ end
 describe Rake::Task, ' artifacts:sources' do
 
   before do
+    Buildr.repositories.instance_eval do
+      @local = @remote = @release_to = nil
+    end
     task('artifacts:sources').clear
     repositories.remote = 'http://example.com'
   end
@@ -939,6 +961,9 @@ end
 describe Rake::Task, ' artifacts:javadoc' do
 
   before do
+    Buildr.repositories.instance_eval do
+      @local = @remote = @release_to = nil
+    end
     task('artifacts:javadoc').clear
     repositories.remote = 'http://example.com'
   end

Modified: buildr/trunk/spec/sandbox.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/sandbox.rb?rev=1138130&r1=1138129&r2=1138130&view=diff
==============================================================================
--- buildr/trunk/spec/sandbox.rb (original)
+++ buildr/trunk/spec/sandbox.rb Tue Jun 21 18:44:52 2011
@@ -21,8 +21,6 @@ Buildr.application.instance_eval { @rake
 repositories.remote << 'http://repo1.maven.org/maven2'
 repositories.remote << 'http://scala-tools.org/repo-releases'
 
-ENV["SCALA_HOME"] = nil
-
 # Force Scala version for specs; don't want to rely on SCALA_HOME
 module Buildr::Scala
   SCALA_VERSION_FOR_SPECS = ENV["SCALA_VERSION"] || "2.8.1"
@@ -138,16 +136,18 @@ module Sandbox
     # of some essential artifacts (e.g. JUnit artifacts required by build task), so we create
     # these first (see above) and keep them across test cases.
     @_sandbox[:artifacts] = Artifact.class_eval { @artifacts }.clone
-    Buildr.repositories.local = File.expand_path('repository')
+    @_sandbox[:local_repository] = Buildr.repositories.local
     ENV['HOME'] = File.expand_path('home')
     ENV['BUILDR_ENV'] = 'development'
 
     @_sandbox[:env_keys] = ENV.keys
     ['DEBUG', 'TEST', 'HTTP_PROXY', 'HTTPS_PROXY', 'USER'].each { |k| ENV.delete(k) ; ENV.delete(k.downcase) }
 
-    # Remove testing local repository, and reset all repository settings.
+    # By default, remote repository is user's own local M2 repository
+    # since we don't want to remotely download artifacts into the sandbox over and over
     Buildr.repositories.instance_eval do
-      @local = @remote = @release_to = nil
+      @remote = ["file://" + @local]
+      @local = @release_to = nil
     end
     Buildr.options.proxy.http = nil
 
@@ -180,6 +180,8 @@ module Sandbox
     # Get rid of all artifacts.
     @_sandbox[:artifacts].tap { |artifacts| Artifact.class_eval { @artifacts = artifacts } }
 
+    Buildr.repositories.local = @_sandbox[:local_repository]
+
     # Restore options.
     Buildr.options.test = nil
     (ENV.keys - @_sandbox[:env_keys]).each { |key| ENV.delete key }