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
|
||||
{
|
||||
// <jruby> Calling getModule on an instance of RubyModule? Nah fuck
|
||||
// that, that would be too easy.
|
||||
RubyModule xml = (RubyModule) runtime.getModule("Oga")
|
||||
.getConstant("XML");
|
||||
|
||||
|
|
15
lib/oga.rb
15
lib/oga.rb
|
@ -1,17 +1,20 @@
|
|||
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/parser'
|
||||
require_relative 'oga/xml/pull_parser'
|
||||
|
||||
require_relative 'liboga'
|
||||
|
||||
# FIXME: it looks like this should not be needed but stuff doesn't load without
|
||||
# it.
|
||||
if RUBY_ENGINE == 'jruby'
|
||||
org.liboga.LibogaService.new.basicLoad(JRuby.runtime)
|
||||
# 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
|
||||
# absolute paths, does not work.
|
||||
unless $:.include?(File.expand_path('../', __FILE__))
|
||||
$:.unshift(File.expand_path('../', __FILE__))
|
||||
end
|
||||
|
||||
require 'liboga'
|
||||
|
||||
require_relative 'oga/xml/node'
|
||||
require_relative 'oga/xml/element'
|
||||
require_relative 'oga/xml/document'
|
||||
|
|
Loading…
Reference in New Issue