Slap JRuby so that it can load the .jar file.
This commit is contained in:
parent
6e685378e0
commit
2053018d07
|
@ -12,8 +12,6 @@ public class LibogaService implements BasicLibraryService
|
||||||
{
|
{
|
||||||
public boolean basicLoad(final Ruby runtime) throws IOException
|
public boolean basicLoad(final Ruby runtime) throws IOException
|
||||||
{
|
{
|
||||||
// <jruby> Calling getModule on an instance of RubyModule? Nah fuck
|
|
||||||
// that, that would be too easy.
|
|
||||||
RubyModule xml = (RubyModule) runtime.getModule("Oga")
|
RubyModule xml = (RubyModule) runtime.getModule("Oga")
|
||||||
.getConstant("XML");
|
.getConstant("XML");
|
||||||
|
|
||||||
|
|
15
lib/oga.rb
15
lib/oga.rb
|
@ -1,17 +1,20 @@
|
||||||
require 'set'
|
require 'set'
|
||||||
|
|
||||||
|
# Load these first so that the native extensions don't have to define the
|
||||||
|
# Oga::XML namespace.
|
||||||
require_relative 'oga/xml/lexer'
|
require_relative 'oga/xml/lexer'
|
||||||
require_relative 'oga/xml/parser'
|
require_relative 'oga/xml/parser'
|
||||||
require_relative 'oga/xml/pull_parser'
|
require_relative 'oga/xml/pull_parser'
|
||||||
|
|
||||||
require_relative 'liboga'
|
# JRuby is dumb as a brick and can only load .jar files using require() when
|
||||||
|
# ./lib is in the LOAD_PATH. require_relative, or any other form that uses
|
||||||
# FIXME: it looks like this should not be needed but stuff doesn't load without
|
# absolute paths, does not work.
|
||||||
# it.
|
unless $:.include?(File.expand_path('../', __FILE__))
|
||||||
if RUBY_ENGINE == 'jruby'
|
$:.unshift(File.expand_path('../', __FILE__))
|
||||||
org.liboga.LibogaService.new.basicLoad(JRuby.runtime)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
require 'liboga'
|
||||||
|
|
||||||
require_relative 'oga/xml/node'
|
require_relative 'oga/xml/node'
|
||||||
require_relative 'oga/xml/element'
|
require_relative 'oga/xml/element'
|
||||||
require_relative 'oga/xml/document'
|
require_relative 'oga/xml/document'
|
||||||
|
|
Loading…
Reference in New Issue