开发者

possible to load nokogiri in jruby without installing nokogiri-java?

开发者 https://www.devze.com 2022-12-12 22:38 出处:网络
i need a way to run following nokogiri script #parser.rb require \'nokogiri\' def parseit() //... end and call the parseit() while running below main.rb in jruby

i need a way to run following nokogiri script

#parser.rb
require 'nokogiri'

def parseit()
//...
end

and call the parseit() while running below main.rb in jruby

#main.rb
require 'parser'

parseit()

Of course the problem is jruby cannot find 'nokogiri' as I have not installed it aka nokogiri-java via jruby -S gem install nokogiri

The reason is there is some bug I found in nokogiri running under Jruby, so I have only installed nokogiri on Ruby not Jruby. The parser.rb runs perfectly under just Ruby.

开发者_StackOverflow中文版

So my objective is to be able to run parseit() without having to install nokogiri on Jruby!


Nokogiri works just fine under JRuby (1.4.0 has issues, but the 1.4.1 version of the gem has been working perfect for me).

jruby -S gem install nokogiri

and if you have issues with platform detection you can force it:

jruby -S gem install nokogiri --platform=java

You shouldn't have any issues using it with JRuby, if you are then maybe you're stack isn't right.


Nokogiri should work under FFI in JRuby. See http://www.ruby-forum.com/topic/186274


Nokogiri should just work with JRuby via FFI, so it seems to me that the best course of action is just figure out why installing nokogiri in JRuby doesn't work for you.

What kind of problems you see? What JRuby version? What platform?


Here's an example of a situation where it would appear that the Java implementation of Nokogiri is producing different results from the C version, which is causing the loofah gem to fail a bunch of JRuby tests. This is blocking the ability of the Redmine developers from supporting JRuby.

https://github.com/flavorjones/loofah/issues/88#issuecomment-122747924

0

精彩评论

暂无评论...
验证码 换一张
取 消