为JRuby安装hpricot [英] Installing hpricot for JRuby

查看:272
本文介绍了为JRuby安装hpricot的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想看看黄瓜的Jruby在Rails。

I'm trying to look at cucumber for Jruby on Rails. One of the pre-requesites is webrat which has as pre-requisite hpricot.

我用hpricot安装了这个gem:

I've installed the gem with hpricot using:

gem install hpricot --source http://code.whytheluckystiff.net --version 0.6.1 --platform java

gem install hpricot --source http://code.whytheluckystiff.net --version 0.6.1 --platform java

这将安装hpricot的java版本。我将hpricot_scan.jar添加到CLASSPATH,但是当我运行时:

This installs the java version of hpricot. I add the hpricot_scan.jar to the CLASSPATH but when I run:

cucumber features -n

我得到以下输出:

HpricotScanService.java:931:in `hpricot_scan': java.lang.NoSuchMethodError:
org.jruby.runtime.builtin.IRubyObject.getInstanceVariable(Ljava/lang/String;)Lorg/jruby/runtime/builtin/IRubyObject;
from HpricotScanService.java:1324:in `__hpricot_scan'
from null:-1:in `call'
from InvocationCallback.java:67:in `execute'
from FullFunctionCallbackMethod.java:69:in `call'
from DynamicMethod.java:243:in `call'
from CachingCallSite.java:283:in `cacheAndCall'
from CachingCallSite.java:121:in `callBlock'

等。

如果我编译HpricotScanService.java文件并将生成的.class文件添加到类路径,我会得到:

If I compile the HpricotScanService.java file and add the resulting .class file to the classpath, I get:

Then I should see "Run"
private method `scan' called for Hpricot:Module (NoMethodError)
features/step_definitions/webrat_steps.rb:94:in `/^I should see "([^\"]*)"$/'
features/manage_activity.feature:9:in `Then I should see "Run"'


b $ b

如果我尝试安装hpricot的更高版本,那么我会得到:

If I try to install later versions of the hpricot, then I get:

ERROR: Failed to build gem native extension.
C:/Program Files/Ruby/jruby-1.2.0/bin/../bin/jruby.bat extconf.rb install hpricot --platform java
C:/Program Files/Ruby/jruby-1.2.0/bin/../lib/ruby/1.8/mkmf.rb:7: JRuby does not support native extensions. Check wiki.jruby.org for alternatives. (Not
ImplementedError)
from C:/Program Files/Ruby/jruby-1.2.0/bin/../lib/ruby/1.8/mkmf.rb:1:in `require'
from extconf.rb:1

任何人都有任何线索

使用Windows XP,JRuby 1.2.0

Using Windows XP, JRuby 1.2.0

推荐答案

FYI,1.4版的JRuby现在支持0.7版本的HPricot。

FYI, version 1.4 of JRuby now supports version 0.7 of HPricot.

http://jruby.org/2009/11/02/jruby-1-4-0.html

这篇关于为JRuby安装hpricot的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆