buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From boisv...@apache.org
Subject svn commit: r1035533 - in /buildr/trunk: CHANGELOG buildr.gemspec lib/buildr/java/bdd.rb lib/buildr/java/test_result.rb
Date Tue, 16 Nov 2010 05:19:37 GMT
Author: boisvert
Date: Tue Nov 16 05:19:36 2010
New Revision: 1035533

URL: http://svn.apache.org/viewvc?rev=1035533&view=rev
Log:
Upgrade to RSpec 2.1.0
Upgrade to JtestR 0.6
This commit breaks JtestR specs (to be resuscitated in due time)

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/buildr.gemspec
    buildr/trunk/lib/buildr/java/bdd.rb
    buildr/trunk/lib/buildr/java/test_result.rb

Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=1035533&r1=1035532&r2=1035533&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Tue Nov 16 05:19:36 2010
@@ -1,10 +1,10 @@
 1.4.4 (Pending)
 * Added:  BUILDR-550 Add support for groovydoc
-* Added:  BUILDR-521: System tray notifications for Linux systems 
+* Added:  BUILDR-521: System tray notifications for Linux systems
           (via libnotify/notify-send)
 * Added:  BUILDR-537 Shell tasks should use JAVA_OPTS by default
 * Added:  BUILDR-538 Shell tasks should support passing :java_args
-* Change: BUILDR-540 Upgrade to rspec 2.0.0
+* Change: BUILDR-540 Upgrade to rspec 2.1.0
 * Fixed:  BUILDR-542 Release task:  SVN tagging fails if parent tag directory
           does not exist yet (Gerolf Seitz)
 * Fixed:  BUILDR-543 POMs are installed and uploaded twice when using artifacts

Modified: buildr/trunk/buildr.gemspec
URL: http://svn.apache.org/viewvc/buildr/trunk/buildr.gemspec?rev=1035533&r1=1035532&r2=1035533&view=diff
==============================================================================
--- buildr/trunk/buildr.gemspec (original)
+++ buildr/trunk/buildr.gemspec Tue Nov 16 05:19:36 2010
@@ -62,7 +62,7 @@ for those one-off tasks, with a language
   spec.add_dependency 'rjb',                  '1.2.5' if spec.platform.to_s == 'ruby'
   spec.add_dependency 'rjb',                  '1.2.5' if spec.platform.to_s == 'x86-mswin32'
   spec.add_dependency 'atoulme-Antwrap',      '0.7.1'
-  spec.add_dependency 'rspec',                '= 2.0.1'
+  spec.add_dependency 'rspec',                '= 2.1.0'
   spec.add_dependency 'xml-simple',           '1.0.12'
   spec.add_dependency 'minitar',              '0.5.3'
   spec.add_dependency 'jruby-openssl',        '>= 0.7' if spec.platform.to_s == 'java'

Modified: buildr/trunk/lib/buildr/java/bdd.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/bdd.rb?rev=1035533&r1=1035532&r2=1035533&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/bdd.rb (original)
+++ buildr/trunk/lib/buildr/java/bdd.rb Tue Nov 16 05:19:36 2010
@@ -107,9 +107,11 @@ module Buildr
       else
         cmd_options = task.options.only(:properties, :java_args)
         cmd_options.update(:classpath => dependencies, :project => task.project)
-        jruby runner.file, tests, cmd_options
+        jruby runner.file, tests, cmd_options rescue nil
       end
 
+      fail "Missing result YAML file: #{runner.result}" unless File.exist? runner.result
+
       result = YAML.load(File.read(runner.result))
       if Exception === result
         raise [result.message, result.backtrace].flatten.join("\n")
@@ -197,7 +199,8 @@ module Buildr
       runner.gems ||= {}
       runner.rspec ||= ['--format', 'progress', '--format', "html:#{runner.html_report}"]
       runner.format.each { |format| runner.rspec << '--format' << format } if
runner.format
-      runner.rspec.push '--format', "Buildr::TestFramework::TestResult::YamlFormatter:#{runner.result}"
+      runner.rspec.push '--format', "Buildr::TestFramework::TestResult::YamlFormatter"
+      runner.rspec.push '-o', runner.result
       runner
     end
 
@@ -240,8 +243,8 @@ module Buildr
 
     def runner_config
       runner = super
-      runner.gems.update 'rspec' => '>0'
-      runner.requires.unshift 'spec'
+      runner.gems.update 'rspec' => '=2.1.0'
+      runner.requires.unshift 'rspec'
       runner
     end
 
@@ -258,14 +261,12 @@ module Buildr
         <% else %>
           output = STDOUT
         <% end %>
-        parser = ::Spec::Runner::OptionParser.new(output, output)
+        parser = ::RSpec::Core::Parser.new
         argv = <%= runner.rspec.inspect %> || []
         argv.push *<%= tests.inspect %>
-        parser.order!(argv)
-        $rspec_options = parser.options
 
         Buildr::TestFramework::TestResult::Error.guard('<%= runner.result %>') do
-          ::Spec::Runner::CommandLine.run($rspec_options)
+          ::RSpec::Core::CommandLine.new(argv).run(output, output)
         end
         exit 0 # let buildr figure the result from the yaml file
       }
@@ -296,7 +297,7 @@ module Buildr
 
     include TestFramework::JRubyBased
 
-    VERSION = '0.5'
+    VERSION = '0.6'
 
     # pattern for rspec stories
     STORY_PATTERN    = /_(steps|story)\.rb$/
@@ -368,9 +369,11 @@ module Buildr
 
     def runner_config
       runner = super
-      # JtestR 0.3.1 comes with rspec 1.1.4 (and any other jtestr dependency) included,
+      # JtestR 0.6.0 comes with rspec 1.3.0 (and any other jtestr dependency) included,
       # so the rspec version used depends on the jtestr jar.
       runner.requires.unshift 'jtestr'
+      runner.gems.update 'rspec' => '=1.3.0'
+      runner.requires.unshift 'rspec'
       runner
     end
 

Modified: buildr/trunk/lib/buildr/java/test_result.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/test_result.rb?rev=1035533&r1=1035532&r2=1035533&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/test_result.rb (original)
+++ buildr/trunk/lib/buildr/java/test_result.rb Tue Nov 16 05:19:36 2010
@@ -14,8 +14,10 @@
 # the License.
 
 # necessary to require YAML even if it is mentioned by autoload as it fails on some platforms.
-require 'yaml' 
+require 'yaml'
 require 'fileutils'
+require 'rspec/core/formatters/base_formatter'
+
 module Buildr #:nodoc:
   module TestFramework
 
@@ -52,57 +54,47 @@ module Buildr #:nodoc:
       end
 
       # An Rspec formatter used by buildr
-      class YamlFormatter
+      class YamlFormatter  < ::RSpec::Core::Formatters::BaseFormatter
         attr_reader :result
 
-        attr_accessor :example_group, :options, :where
+        # attr_accessor :example_group, :options, :output
 
-        def initialize(options, where)
-          @options = options
-          @where = where
+        def initialize(output)
+          super(output)
           @result = Hash.new
           @result[:succeeded] = []
           @result[:failed] = []
         end
 
-        %w[ example_started
-            start_dump dump_failure dump_summary dump_pending ].each do |meth|
-          module_eval "def #{meth}(*args); end"
-        end
-
-        def example_group_started(example_group)
-          @example_group = example_group
-        end
-
         def example_passed(example)
+          super(example)
           result.succeeded << example_name(example)
         end
 
-        def example_pending(example, counter)
+        def example_pending(example)
+          super(example)
           result.succeeded << example_name(example)
         end
 
-        def example_failed(example, counter, failure)
+        def example_failed(example)
+          super(example)
           result.failed << example_name(example)
         end
 
         def start(example_count)
+          super(example_count)
           @result = TestResult.new
         end
 
         def close
+          super
           result.succeeded = result.succeeded - result.failed
-          FileUtils.mkdir_p File.dirname(where)
-          File.open(where, 'w') { |f| f.puts YAML.dump(result) }
+          output.puts YAML.dump(result)
         end
 
       private
         def example_name(example)
-          if Spec::Example::ExampleProxy === example
-            example_group.location.gsub(/:\d+$/, '')
-          else
-            example.name.gsub(/(.+)(\..+\(\))/, '\1')
-          end
+          example.file_path
         end
       end # YamlFormatter
 



Mime
View raw message