2011-12-07 13:59:39 -05:00
|
|
|
require 'java'
|
|
|
|
|
2009-09-24 20:06:31 -04:00
|
|
|
module Rhino
|
2011-12-07 13:59:39 -05:00
|
|
|
|
2012-08-02 05:49:28 -04:00
|
|
|
# allow for rhino.jar overrides for "experimental" jrubyists
|
|
|
|
# fallback to rhino/jar_path provided therubyrhino_jar gem :
|
2012-12-03 11:21:23 -05:00
|
|
|
require 'rhino/jar_path' unless const_defined?(:JAR_PATH)
|
|
|
|
load JAR_PATH
|
2012-05-18 16:00:32 -04:00
|
|
|
|
2011-12-07 13:59:39 -05:00
|
|
|
# This module contains all the native Rhino objects implemented in Java
|
|
|
|
# e.g. Rhino::JS::NativeObject # => org.mozilla.javascript.NativeObject
|
|
|
|
module JS
|
2011-12-14 05:49:35 -05:00
|
|
|
include_package "org.mozilla.javascript"
|
2011-12-07 13:59:39 -05:00
|
|
|
module Regexp
|
2011-12-14 05:49:35 -05:00
|
|
|
include_package "org.mozilla.javascript.regexp"
|
2011-12-07 13:59:39 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-08-02 07:11:22 -04:00
|
|
|
@@implementation_version = nil
|
|
|
|
# Helper to resolve what version of Rhino's .jar we're really using.
|
|
|
|
def self.implementation_version
|
|
|
|
@@implementation_version ||= begin
|
|
|
|
urls = JS::Kit.java_class.to_java.getClassLoader.
|
|
|
|
getResources('META-INF/MANIFEST.MF').to_a
|
|
|
|
rhino_jar_urls = urls.select { |url| url.toString.index(JAR_PATH) }
|
|
|
|
if rhino_jar_urls.empty?
|
|
|
|
raise "could not find #{JAR_PATH} manifest among: #{urls.map(&:toString).join(', ')}"
|
|
|
|
elsif rhino_jar_urls.size > 1
|
|
|
|
raise "could not find #{JAR_PATH} manifest among: #{urls.map(&:toString).join(', ')}"
|
|
|
|
end
|
|
|
|
manifest = java.util.jar.Manifest.new rhino_jar_urls.first.openStream
|
|
|
|
manifest.getMainAttributes.getValue 'Implementation-Version'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-12-07 13:59:39 -05:00
|
|
|
end
|
|
|
|
|
2012-04-18 01:45:41 -04:00
|
|
|
require 'rhino/version'
|
2011-12-09 01:52:47 -05:00
|
|
|
require 'rhino/wormhole'
|
|
|
|
Rhino.extend Rhino::To
|
|
|
|
|
2011-12-07 13:59:39 -05:00
|
|
|
require 'rhino/object'
|
|
|
|
require 'rhino/context'
|
2011-12-09 05:28:27 -05:00
|
|
|
require 'rhino/error'
|
2011-12-09 01:52:47 -05:00
|
|
|
require 'rhino/rhino_ext'
|
2011-12-12 16:17:42 -05:00
|
|
|
require 'rhino/ruby'
|
2012-01-06 12:29:22 -05:00
|
|
|
require 'rhino/ruby/access'
|
2011-12-09 01:52:47 -05:00
|
|
|
require 'rhino/deprecations'
|