You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by "Rhett Sutphin (JIRA)" <ji...@apache.org> on 2009/02/18 02:47:01 UTC
[jira] Commented: (BUILDR-256) Automatically installing gems aborts
rspec test runner
[ https://issues.apache.org/jira/browse/BUILDR-256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12674426#action_12674426 ]
Rhett Sutphin commented on BUILDR-256:
--------------------------------------
The following monkey-patch fixes this problem. It also autoinstalls the gems without ri or rdoc so that they install much faster and it provides information about why buildr decided the gem needed to be installed with --trace.
I'll try to provide this as a more formal patch when I have a chance.
require 'buildr/java/bdd'
module Buildr::TestFramework::JRubyBased
protected
def jruby_gem
%{
require 'jruby'
def JRuby.gem(name, version = '>0', *args)
require 'rbconfig'
jruby_home = Config::CONFIG['prefix']
expected_version = '#{TestFramework::JRubyBased.version}'
unless JRUBY_VERSION >= expected_version
fail "Expected JRuby version \#{expected_version} installed at \#{jruby_home} but got \#{JRUBY_VERSION}"
end
require 'rubygems'
begin
Kernel.gem name, version
rescue LoadError, Gem::LoadError => e
#{'puts "Gem #{name} (#{version}) not found. Installing. (Message: #{e.message}.)"' if Buildr.application.options.trace}
require 'rubygems/gem_runner'
Gem.manage_gems
args = ['install', name, '--version', version, '--no-ri', '--no-rdoc'] + args
begin
Gem::GemRunner.new.run(args)
rescue Gem::SystemExitException=>e
if e.exit_code == 0
#{'puts "Successfully installed. #{e.message}"' if Buildr.application.options.trace}
else
puts "Install of \#{name} (\#{version}) failed. \#{e.message}"
raise e
end
end
Kernel.gem name, version
end
end
}
end
end
> Automatically installing gems aborts rspec test runner
> ------------------------------------------------------
>
> Key: BUILDR-256
> URL: https://issues.apache.org/jira/browse/BUILDR-256
> Project: Buildr
> Issue Type: Bug
> Affects Versions: 1.3.3
> Environment: RubyGems 1.2.0
> Reporter: Rhett Sutphin
> Priority: Minor
>
> The automatic jruby gem installer code (the template for which is created by the jruby_gem method in TestFramework::JRubyBased) uses Gem::GemRunner to automatically install gems. GemRunner (at least in RubyGems 1.2.0) always throws Gem::SystemExitException when it completes. This aborts the runner and returns control to buildr. Buildr then fails with an exception because result.yaml doesn't exist.
> Workaround: each run will successfully install one of the gems, so you can run the test several times to install all the gems. Alternatively, you can manually install the necessary gems using jruby -S gem install.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.