buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From as...@apache.org
Subject svn commit: r787782 - in /buildr/trunk: ./ addon/buildr/org/apache/buildr/ lib/buildr/ lib/buildr/core/ lib/buildr/java/ lib/buildr/java/org/apache/buildr/ lib/buildr/packaging/ lib/buildr/scala/ lib/buildr/scala/org/apache/buildr/ spec/ spec/core/ spe...
Date Tue, 23 Jun 2009 18:39:21 GMT
Author: assaf
Date: Tue Jun 23 18:39:20 2009
New Revision: 787782

URL: http://svn.apache.org/viewvc?rev=787782&view=rev
Log:
Ruby 1.9.1 compatibility:
- erb_transform works well with binding, not proc

- foo = *args fixed to foo = args.last

- Seems that Struct keys are now strings

- Proper Tempfile handling to get around scoped closure variables

- constants returns symbols instead of strings

- mkpath returns array not a string

- Array.nitems no longer exists, Antwrap requires this patch

- Added cover matcher since include? doesn't work on time range

- What we need is instance_exec, new in 1.9 and back-ported by RSpec 1.2.

- Fixed eclipse specs (1.8 and 1.9 don't lookup constants the same way).

Specs should end with _spec.rb (helps distinguish them from helpers and such).

Commented out groups in Scala tests.

Added:
    buildr/trunk/spec/java/ant_spec.rb
      - copied, changed from r787777, buildr/trunk/spec/java/ant.rb
    buildr/trunk/spec/java/test_coverage_helper.rb
      - copied, changed from r787777, buildr/trunk/spec/java/test_coverage_spec.rb
Removed:
    buildr/trunk/addon/buildr/org/apache/buildr/BuildrNail$Main.class
    buildr/trunk/addon/buildr/org/apache/buildr/BuildrNail.class
    buildr/trunk/addon/buildr/org/apache/buildr/JettyWrapper$1.class
    buildr/trunk/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class
    buildr/trunk/addon/buildr/org/apache/buildr/JettyWrapper.class
    buildr/trunk/spec/java/ant.rb
    buildr/trunk/spec/java/test_coverage_spec.rb
Modified:
    buildr/trunk/buildr.buildfile
    buildr/trunk/lib/buildr/core.rb
    buildr/trunk/lib/buildr/core/compile.rb
    buildr/trunk/lib/buildr/core/filter.rb
    buildr/trunk/lib/buildr/core/project.rb
    buildr/trunk/lib/buildr/core/transports.rb
    buildr/trunk/lib/buildr/core/util.rb
    buildr/trunk/lib/buildr/java/org/apache/buildr/JavaTestFilter.class
    buildr/trunk/lib/buildr/java/packaging.rb
    buildr/trunk/lib/buildr/java/rjb.rb
    buildr/trunk/lib/buildr/packaging/artifact_namespace.rb
    buildr/trunk/lib/buildr/packaging/zip.rb
    buildr/trunk/lib/buildr/packaging/ziptask.rb
    buildr/trunk/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class
    buildr/trunk/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class
    buildr/trunk/lib/buildr/scala/tests.rb
    buildr/trunk/spec/core/common_spec.rb
    buildr/trunk/spec/core/compile_spec.rb
    buildr/trunk/spec/core/test_spec.rb
    buildr/trunk/spec/groovy/compiler_spec.rb
    buildr/trunk/spec/ide/eclipse_spec.rb
    buildr/trunk/spec/java/cobertura_spec.rb
    buildr/trunk/spec/java/emma_spec.rb
    buildr/trunk/spec/java/packaging_spec.rb
    buildr/trunk/spec/packaging/artifact_spec.rb
    buildr/trunk/spec/spec_helpers.rb

Modified: buildr/trunk/buildr.buildfile
URL: http://svn.apache.org/viewvc/buildr/trunk/buildr.buildfile?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/buildr.buildfile (original)
+++ buildr/trunk/buildr.buildfile Tue Jun 23 18:39:20 2009
@@ -16,6 +16,7 @@
 $LOADED_FEATURES << 'jruby' unless RUBY_PLATFORM =~ /java/ # Pretend to have JRuby,
keeps Nailgun happy.
 require 'buildr/jetty'
 require 'buildr/nailgun'
+require 'buildr/scala'
 repositories.remote << 'http://repo1.maven.org/maven2'
 repositories.remote << 'http://scala-tools.org/repo-releases/'
 
@@ -23,10 +24,14 @@
 define 'buildr' do
   compile.using :source=>'1.4', :target=>'1.4', :debug=>false
 
-  define 'java' do  
+  define 'java' do
     compile.using(:javac).from(FileList['lib/buildr/java/**/*.java']).into('lib/buildr/java')
   end
 
+  define 'scala' do
+    compile.using(:scalac).from(FileList['lib/buildr/scala/**/*.scala']).into('lib/buildr/scala')
+  end
+
   desc 'Buildr extra packages (Antlr, Cobertura, Hibernate, Javacc, JDepend, Jetty, OpenJPA,
XmlBeans)'
   define 'extra', :version=>'1.0' do
     compile.using(:javac).from(FileList['addon/buildr/**/*.java']).into('addon/buildr').with(Buildr::Jetty::REQUIRES,
Buildr::Nailgun::ARTIFACT_SPEC)

Modified: buildr/trunk/lib/buildr/core.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core.rb?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core.rb (original)
+++ buildr/trunk/lib/buildr/core.rb Tue Jun 23 18:39:20 2009
@@ -14,6 +14,11 @@
 # the License.
 
 
+# TODO: Antwrap 0.7 requires this monkeypatch, have it fixed.
+class Array #:nodoc:
+  alias :nitems :size
+end
+
 require 'buildr/core/common'
 require 'buildr/core/application'
 require 'buildr/core/project'

Modified: buildr/trunk/lib/buildr/core/compile.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/compile.rb?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/compile.rb (original)
+++ buildr/trunk/lib/buildr/core/compile.rb Tue Jun 23 18:39:20 2009
@@ -244,7 +244,7 @@
     #
     # For example:
     #   compile.from('src/java').into('classes').with('module1.jar')
-    def from(*sources)  
+    def from(*sources)
       @sources |= sources.flatten
       guess_compiler if @compiler.nil? && sources.flatten.any? { |source| File.exist?(source)
}
       self

Modified: buildr/trunk/lib/buildr/core/filter.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/filter.rb?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/filter.rb (original)
+++ buildr/trunk/lib/buildr/core/filter.rb Tue Jun 23 18:39:20 2009
@@ -285,7 +285,7 @@
           @config = configurer.call(*args, &block)
         else
           raise ArgumentError, "Missing hash argument after :#{mapper_type}" unless args.size
== 1 && Hash === args[0]
-          @config = *args
+          @config = args.first
         end
         @mapper_type = mapper_type
       end
@@ -312,10 +312,8 @@
       
       def erb_transform(content, path = nil)
         case config
-        when Binding, Proc
+        when Binding
           bnd = config
-        when Method
-          bnd = config.to_proc
         when Hash
           bnd = OpenStruct.new
           table = config.inject({}) { |h, e| h[e.first.to_sym] = e.last; h }

Modified: buildr/trunk/lib/buildr/core/project.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/project.rb?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/project.rb (original)
+++ buildr/trunk/lib/buildr/core/project.rb Tue Jun 23 18:39:20 2009
@@ -222,7 +222,7 @@
             @on_define.each { |callback| callback[project] }
           end if @on_define
           # Enhance the project using the definition block.
-          project.enhance { project.instance_eval &block } if block
+          project.enhance { project.instance_exec project, &block } if block
 
           # Top-level project? Invoke the project definition. Sub-project? We don't invoke
           # the project definiton yet (allow project calls to establish order of evaluation),

Modified: buildr/trunk/lib/buildr/core/transports.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/transports.rb?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/transports.rb (original)
+++ buildr/trunk/lib/buildr/core/transports.rb Tue Jun 23 18:39:20 2009
@@ -148,11 +148,10 @@
         # worse than not having a file at all, so download to temporary
         # file and then move over.
         modified = File.stat(target).mtime if File.exist?(target)
-        temp = nil
-        Tempfile.open File.basename(target) do |temp|
-          temp.binmode
-          read({:progress=>verbose}.merge(options || {}).merge(:modified=>modified))
{ |chunk| temp.write chunk }
-        end
+        temp = Tempfile.new(File.basename(target))
+        temp.binmode
+        read({:progress=>verbose}.merge(options || {}).merge(:modified=>modified))
{ |chunk| temp.write chunk }
+        temp.close
         mkpath File.dirname(target)
         mv temp.path, target
       when File
@@ -537,20 +536,18 @@
 
     def write_internal(options, &block) #:nodoc:
       raise ArgumentError, 'Either you\'re attempting to write a file to another host (which
we don\'t support), or you used two slashes by mistake, where you should have file:///<path>.'
if host
-      temp = nil
-      Tempfile.open File.basename(path) do |temp|
-        temp.binmode
-        with_progress_bar options[:progress] && options[:size], path.split('/'),
options[:size] || 0 do |progress|
-          while chunk = yield(RW_CHUNK_SIZE)
-            temp.write chunk
-            progress << chunk
-          end
+      temp = Tempfile.new(File.basename(path))
+      temp.binmode
+      with_progress_bar options[:progress] && options[:size], path.split('/'), options[:size]
|| 0 do |progress|
+        while chunk = yield(RW_CHUNK_SIZE)
+          temp.write chunk
+          progress << chunk
         end
       end
-      real_path.tap do |path|
-        mkpath File.dirname(path)
-        mv temp.path, path
-      end
+      temp.close
+      mkpath File.dirname(real_path)
+      mv temp.path, real_path
+      real_path
     end
 
     @@schemes['FILE'] = FILE

Modified: buildr/trunk/lib/buildr/core/util.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/util.rb?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/util.rb (original)
+++ buildr/trunk/lib/buildr/core/util.rb Tue Jun 23 18:39:20 2009
@@ -159,24 +159,54 @@
 end
 
 
-if RUBY_VERSION < '1.9.0'
-  module Kernel #:nodoc:
-    # Borrowed from Ruby 1.9.
+class Object #:nodoc:
+  unless defined? instance_exec # 1.9
+    module InstanceExecMethods #:nodoc:
+    end
+    include InstanceExecMethods
+
+    # Evaluate the block with the given arguments within the context of
+    # this object, so self is set to the method receiver.
+    #
+    # From Mauricio's http://eigenclass.org/hiki/bounded+space+instance_exec
+    def instance_exec(*args, &block)
+      begin
+        old_critical, Thread.critical = Thread.critical, true
+        n = 0
+        n += 1 while respond_to?(method_name = "__instance_exec#{n}")
+        InstanceExecMethods.module_eval { define_method(method_name, &block) }
+      ensure
+        Thread.critical = old_critical
+      end
+
+      begin
+        send(method_name, *args)
+      ensure
+        InstanceExecMethods.module_eval { remove_method(method_name) } rescue nil
+      end
+    end
+  end
+end
+
+module Kernel #:nodoc:
+  unless defined? tap # 1.9
     def tap
       yield self if block_given?
       self
-    end unless method_defined?('tap')
+    end
   end
+end
 
-
-  class Symbol #:nodoc:
+class Symbol #:nodoc:
+  unless defined? to_proc # 1.9
     # Borrowed from Ruby 1.9.
     def to_proc
       Proc.new{|*args| args.shift.__send__(self, *args)}
-    end unless method_defined?('to_proc')
+    end
   end
+end
 
-  # Also borrowed from Ruby 1.9.
+unless defined? BasicObject # 1.9
   class BasicObject #:nodoc:
     (instance_methods - ['__send__', '__id__', '==', 'send', 'send!', 'respond_to?', 'equal?',
'object_id']).
       each do |method|

Modified: buildr/trunk/lib/buildr/java/org/apache/buildr/JavaTestFilter.class
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/org/apache/buildr/JavaTestFilter.class?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
Files buildr/trunk/lib/buildr/java/org/apache/buildr/JavaTestFilter.class (original) and buildr/trunk/lib/buildr/java/org/apache/buildr/JavaTestFilter.class
Tue Jun 23 18:39:20 2009 differ

Modified: buildr/trunk/lib/buildr/java/packaging.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/packaging.rb?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/packaging.rb (original)
+++ buildr/trunk/lib/buildr/java/packaging.rb Tue Jun 23 18:39:20 2009
@@ -39,7 +39,7 @@
             sections = str.split(SECTION_SEPARATOR).reject { |s| s.strip.empty? }
             new sections.map { |section|
               lines = section.split(LINE_SEPARATOR).inject([]) { |merged, line|
-                if line[0] == 32
+                if line[/^ /] == ' '
                   merged.last << line[1..-1]
                 else
                   merged << line
@@ -302,7 +302,7 @@
           @wsdls = []
           prepare do
             path('META-INF').include @wsdls
-            path('META-INF').include @services_xml, :as=>['services.xml'] if @services_xml
+            path('META-INF').include @services_xml, :as=>'services.xml' if @services_xml
             path('lib').include Buildr.artifacts(@libs) unless @libs.nil? || @libs.empty?
           end
         end

Modified: buildr/trunk/lib/buildr/java/rjb.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/rjb.rb?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/rjb.rb (original)
+++ buildr/trunk/lib/buildr/java/rjb.rb Tue Jun 23 18:39:20 2009
@@ -134,7 +134,7 @@
 
     def __package__(name) #:nodoc:
       const = name.split('.').map { |part| part.gsub(/^./) { |char| char.upcase } }.join
-      return const_get(const) if constants.include?(const)
+      return const_get(const) if constants.include?(const) || constants.include?(const.to_sym)
       package = Module.new
       package.extend Package
       package.instance_variable_set :@name, name

Modified: buildr/trunk/lib/buildr/packaging/artifact_namespace.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/packaging/artifact_namespace.rb?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/packaging/artifact_namespace.rb (original)
+++ buildr/trunk/lib/buildr/packaging/artifact_namespace.rb Tue Jun 23 18:39:20 2009
@@ -736,7 +736,7 @@
 
     # Like Hash#fetch
     def fetch(name, default = nil, &block)
-      block ||= lambda { raise IndexError.new("No artifact found by name #{name.inspect}
in namespace #{self}") }
+      block ||= proc { raise IndexError.new("No artifact found by name #{name.inspect} in
namespace #{self}") }
       real_name = name.to_s[/^[\w\-\.]+$/] ? name : ArtifactRequirement.unversioned_spec(name)
       get(real_name.to_sym) || default || block.call(name)
     end

Modified: buildr/trunk/lib/buildr/packaging/zip.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/packaging/zip.rb?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/packaging/zip.rb (original)
+++ buildr/trunk/lib/buildr/packaging/zip.rb Tue Jun 23 18:39:20 2009
@@ -14,7 +14,16 @@
 # the License.
 
 
-$LOADED_FEATURES.unshift 'ftools' if RUBY_VERSION >= '1.9.0' # Required to properly load
RubyZip under Ruby 1.9
+if RUBY_VERSION >= '1.9.0' # Required to properly load RubyZip under Ruby 1.9
+  $LOADED_FEATURES.unshift 'ftools'
+  require 'fileutils'
+  def File.move(source, dest)
+    FileUtils.move source, dest
+  end
+  def File.rm_rf(path)
+    FileUtils.rm_rf path
+  end
+end
 require 'zip/zip'
 require 'zip/zipfilesystem'
 

Modified: buildr/trunk/lib/buildr/packaging/ziptask.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/packaging/ziptask.rb?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/packaging/ziptask.rb (original)
+++ buildr/trunk/lib/buildr/packaging/ziptask.rb Tue Jun 23 18:39:20 2009
@@ -122,7 +122,8 @@
 
     # Initialize with hash argument of the form target=>zip_file.
     def initialize(args)
-      @target, arg_names, @zip_file = Buildr.application.resolve_args([args])
+      @target, arg_names, zip_file = Buildr.application.resolve_args([args])
+      @zip_file = zip_file.first
       @paths = {}
     end
 

Modified: buildr/trunk/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner%24.class?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
Files buildr/trunk/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class (original)
and buildr/trunk/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class Tue Jun 23
18:39:20 2009 differ

Modified: buildr/trunk/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
Files buildr/trunk/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class (original)
and buildr/trunk/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class Tue Jun 23
18:39:20 2009 differ

Modified: buildr/trunk/lib/buildr/scala/tests.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/scala/tests.rb?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/scala/tests.rb (original)
+++ buildr/trunk/lib/buildr/scala/tests.rb Tue Jun 23 18:39:20 2009
@@ -109,8 +109,9 @@
             ant.suite    :classname=>suite
             ant.reporter :type=>'stdout', :config=>reporter_options
             ant.reporter :type=>'file', :filename=> reportFile, :config=>reporter_options
-            ant.includes group_includes.join(" ") if group_includes
-            ant.excludes group_excludes.join(" ") if group_excludes
+            # TODO: This should be name=>value pairs!
+            #ant.includes group_includes.join(" ") if group_includes
+            #ant.excludes group_excludes.join(" ") if group_excludes
             (options[:properties] || []).each { |name, value| ant.property :name=>name,
:value=>value }
           end
         end

Modified: buildr/trunk/spec/core/common_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/core/common_spec.rb?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/spec/core/common_spec.rb (original)
+++ buildr/trunk/spec/core/common_spec.rb Tue Jun 23 18:39:20 2009
@@ -32,7 +32,7 @@
   end
 
   it 'should return members when requested' do
-    @struct.members.sort.should eql(@hash.keys.map(&:to_s).sort)
+    @struct.members.map(&:to_s).sort.should eql(@hash.keys.map(&:to_s).sort)
   end
 
   it 'should return valued when requested' do

Modified: buildr/trunk/spec/core/compile_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/core/compile_spec.rb?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/spec/core/compile_spec.rb (original)
+++ buildr/trunk/spec/core/compile_spec.rb Tue Jun 23 18:39:20 2009
@@ -293,7 +293,8 @@
   end
 
   it 'should run all source files as prerequisites' do
-    file(mkpath('src')).should_receive :invoke_prerequisites
+    mkpath 'src'
+    file('src').should_receive :invoke_prerequisites
     compile_task.from('src').invoke
   end
 

Modified: buildr/trunk/spec/core/test_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/core/test_spec.rb?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/spec/core/test_spec.rb (original)
+++ buildr/trunk/spec/core/test_spec.rb Tue Jun 23 18:39:20 2009
@@ -333,10 +333,10 @@
   it 'should execute teardown task' do
     lambda { test_task.invoke }.should run_task('foo:test:teardown')
   end
-  
+
   it 'should update the last successful run timestamp' do
     before = Time.now ; test_task.invoke ; after = Time.now
-    (before-1..after+1).should include(test_task.timestamp)
+    (before-1..after+1).should cover(test_task.timestamp)
   end
 end
 

Modified: buildr/trunk/spec/groovy/compiler_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/groovy/compiler_spec.rb?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/spec/groovy/compiler_spec.rb (original)
+++ buildr/trunk/spec/groovy/compiler_spec.rb Tue Jun 23 18:39:20 2009
@@ -151,6 +151,7 @@
         return compile
       end
     end
+    project('foo').compile
   end
   
   it 'should set warning option to false by default' do 

Modified: buildr/trunk/spec/ide/eclipse_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/ide/eclipse_spec.rb?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/spec/ide/eclipse_spec.rb (original)
+++ buildr/trunk/spec/ide/eclipse_spec.rb Tue Jun 23 18:39:20 2009
@@ -17,6 +17,16 @@
 require File.join(File.dirname(__FILE__), '../spec_helpers')
 
 
+JAVA_CONTAINER  = 'org.eclipse.jdt.launching.JRE_CONTAINER'
+SCALA_CONTAINER = 'ch.epfl.lamp.sdt.launching.SCALA_CONTAINER'
+
+SCALA_NATURE = 'ch.epfl.lamp.sdt.core.scalanature'
+JAVA_NATURE  = 'org.eclipse.jdt.core.javanature'
+
+SCALA_BUILDER = 'ch.epfl.lamp.sdt.core.scalabuilder'
+JAVA_BUILDER  = 'org.eclipse.jdt.core.javabuilder'
+
+
 module EclipseHelper
   def classpath_xml_elements
     task('eclipse').invoke
@@ -52,6 +62,7 @@
     task('eclipse').invoke
     REXML::Document.new(File.open('.project')).root.elements
   end
+
 end
 
 
@@ -60,15 +71,6 @@
   
   describe "eclipse's .project file" do
 
-    JAVA_CONTAINER  = 'org.eclipse.jdt.launching.JRE_CONTAINER'
-    SCALA_CONTAINER = 'ch.epfl.lamp.sdt.launching.SCALA_CONTAINER'
-
-    SCALA_NATURE = 'ch.epfl.lamp.sdt.core.scalanature'
-    JAVA_NATURE  = 'org.eclipse.jdt.core.javanature'
-    
-    SCALA_BUILDER = 'ch.epfl.lamp.sdt.core.scalabuilder'
-    JAVA_BUILDER  = 'org.eclipse.jdt.core.javabuilder'
-
     def project_natures
       project_xml_elements.collect("natures/nature") { |n| n.text }
     end

Copied: buildr/trunk/spec/java/ant_spec.rb (from r787777, buildr/trunk/spec/java/ant.rb)
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/ant_spec.rb?p2=buildr/trunk/spec/java/ant_spec.rb&p1=buildr/trunk/spec/java/ant.rb&r1=787777&r2=787782&rev=787782&view=diff
==============================================================================
    (empty)

Modified: buildr/trunk/spec/java/cobertura_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/cobertura_spec.rb?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/spec/java/cobertura_spec.rb (original)
+++ buildr/trunk/spec/java/cobertura_spec.rb Tue Jun 23 18:39:20 2009
@@ -14,7 +14,7 @@
 # the License.
 
 
-require File.join(File.dirname(__FILE__), 'test_coverage_spec')
+require File.join(File.dirname(__FILE__), 'test_coverage_helper')
 Sandbox.require_optional_extension 'buildr/java/cobertura'
 artifacts(Buildr::Cobertura::dependencies).map(&:invoke)
 

Modified: buildr/trunk/spec/java/emma_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/emma_spec.rb?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/spec/java/emma_spec.rb (original)
+++ buildr/trunk/spec/java/emma_spec.rb Tue Jun 23 18:39:20 2009
@@ -14,7 +14,7 @@
 # the License.
 
 
-require File.join(File.dirname(__FILE__), 'test_coverage_spec')
+require File.join(File.dirname(__FILE__), 'test_coverage_helper')
 Sandbox.require_optional_extension 'buildr/java/emma'
 artifacts(Buildr::Emma::dependencies).map(&:invoke)
 

Modified: buildr/trunk/spec/java/packaging_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/packaging_spec.rb?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/spec/java/packaging_spec.rb (original)
+++ buildr/trunk/spec/java/packaging_spec.rb Tue Jun 23 18:39:20 2009
@@ -341,7 +341,7 @@
     package.invoke
     assumed = Array(@meta_inf_ignore)
     Zip::ZipFile.open(package.to_s) do |zip|
-      entries = zip.entries.map(&:to_s).select { |f| File.dirname(f) == 'META-INF' }.map
{ |f| File.basename(f) }
+      entries = zip.entries.map(&:name).select { |f| File.dirname(f) == 'META-INF' }.map
{ |f| File.basename(f) }
       assumed.each { |f| entries.should include(f) }
       yield entries - assumed if block_given?
     end
@@ -659,7 +659,7 @@
         tmp.write ear.file.read(package)
       end
       manifest = Buildr::Packaging::Java::Manifest.from_zip('tmp.zip')
-      yield manifest.main['Class-Path'].to_s.split(' ')
+      yield manifest.main['Class-Path'].split(' ')
     end
   end
 
@@ -911,7 +911,7 @@
       package(:ear) << { :jar=>package(:jar) } << { :jar=>package(:jar,
:id=>'bar') }
     end
     inspect_application_xml do |xml|
-      jars = xml.get_elements('/application/jar').map(&:texts).map(&:to_s)
+      jars = xml.get_elements('/application/jar').map(&:texts).map(&:join)
       jars.should include('jar/foo-1.0.jar', 'jar/bar-1.0.jar')
     end
   end

Copied: buildr/trunk/spec/java/test_coverage_helper.rb (from r787777, buildr/trunk/spec/java/test_coverage_spec.rb)
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/test_coverage_helper.rb?p2=buildr/trunk/spec/java/test_coverage_helper.rb&p1=buildr/trunk/spec/java/test_coverage_spec.rb&r1=787777&r2=787782&rev=787782&view=diff
==============================================================================
--- buildr/trunk/spec/java/test_coverage_spec.rb (original)
+++ buildr/trunk/spec/java/test_coverage_helper.rb Tue Jun 23 18:39:20 2009
@@ -166,8 +166,9 @@
           'public class Foo { /* This comment is a TOKEN to check that test coverage reports
include the source code */ }'
         define('foo')
         task("foo:#{toolname}:html").invoke
-        htlm_report_contents = Dir[File.join(test_coverage_config.report_dir, '**/*.html')].map{|path|File.open(path).read}.join
-        htlm_report_contents.should =~ /TOKEN/
+        html_report_contents = Dir[File.join(test_coverage_config.report_dir, '**/*.html')].map{|path|File.open(path).read}.join
+        html_report_contents.force_encoding('ascii-8bit') if RUBY_VERSION >= '1.9'
+        html_report_contents.should =~ /TOKEN/
       end
     end
   end
@@ -203,8 +204,9 @@
           write 'bar/src/main/java/Bar.java',
             'public class Bar { /* This comment is a TOKEN to check that test coverage reports
include the source code */ }'
           task("#{toolname}:html").invoke
-          htlm_report_contents = Dir[File.join(@tool_module.report_to(:html), '**/*.html')].map{|path|File.open(path).read}.join
-          htlm_report_contents.should =~ /TOKEN/
+          html_report_contents = Dir[File.join(@tool_module.report_to(:html), '**/*.html')].map{|path|File.read(path)}.join
+          html_report_contents.force_encoding('ascii-8bit') if RUBY_VERSION >= '1.9'
+          html_report_contents.should =~ /TOKEN/
         end
         
         it 'should handle gracefully a project with no source' do

Modified: buildr/trunk/spec/packaging/artifact_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/packaging/artifact_spec.rb?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/spec/packaging/artifact_spec.rb (original)
+++ buildr/trunk/spec/packaging/artifact_spec.rb Tue Jun 23 18:39:20 2009
@@ -231,7 +231,7 @@
   it 'should deal well with repositories URL that lack the last slash' do
     repositories.remote = 'http://example.com/base'
     uri = nil
-    URI.should_receive(:download).twice.and_return { |uri, target, options| }
+    URI.should_receive(:download).twice.and_return { |_uri, args| uri = _uri }
     artifact('group:id:jar:1.0').invoke
     uri.to_s.should eql('http://example.com/base/group/id/1.0/id-1.0.pom')
   end
@@ -239,7 +239,7 @@
   it 'should deal well with repositories URL that have the last slash' do
     repositories.remote = 'http://example.com/base/'
     uri = nil
-    URI.should_receive(:download).twice.and_return { |uri, target, options| }
+    URI.should_receive(:download).twice.and_return { |_uri, args| p args ; uri = _uri }
     artifact('group:id:jar:1.0').invoke
     uri.to_s.should eql('http://example.com/base/group/id/1.0/id-1.0.pom')
   end

Modified: buildr/trunk/spec/spec_helpers.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/spec_helpers.rb?rev=787782&r1=787781&r2=787782&view=diff
==============================================================================
--- buildr/trunk/spec/spec_helpers.rb (original)
+++ buildr/trunk/spec/spec_helpers.rb Tue Jun 23 18:39:20 2009
@@ -253,7 +253,16 @@
       AbsolutePathMatcher.new(path)
     end
 
+    
+    # Value covered by range. For example:
+    #   (1..5).should cover(3)
+    def cover(value)
+      simple_matcher :cover do |given|
+        value >= given.min && value <= given.max 
+      end
+    end
 
+  
     def suppress_stdout
       stdout = $stdout
       $stdout = StringIO.new



Mime
View raw message