English 中文(简体)
possible to load nokogiri in jruby without installing nokogiri-java?
原标题:

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.

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





相关问题
Ruby parser in Java

The project I m doing is written in Java and parsers source code files. (Java src up to now). Now I d like to enable parsing Ruby code as well. Therefore I am looking for a parser in Java that parses ...

rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

multiple ruby extension modules under one directory

Can sources for discrete ruby extension modules live in the same directory, controlled by the same extconf.rb script? Background: I ve a project with two extension modules, foo.so and bar.so which ...

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

热门标签