Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[proposal] make the jruby gem extension more java like #2987

Open
mkristian opened this issue May 25, 2015 · 1 comment
Open

[proposal] make the jruby gem extension more java like #2987

mkristian opened this issue May 25, 2015 · 1 comment

Comments

@mkristian
Copy link
Member

make the jruby gem extension more java like. I just want to follow the way dropwizard "adds" their services to a jar file https://github.com/dropwizard/dropwizard/blob/master/dropwizard-metrics/src/main/resources/META-INF/services/io.dropwizard.metrics.ReporterFactory

  • a jar with jruby extension has a file META-INF/services/org.jruby.Extension
  • the file contains a list of class files which shall be loaded. assuming the loading of the class does activate the JRuby extension

example lib/ruby/shared/json/ext/parser.jar has the file META-INF/services/org.jruby.Extension with content

json.ext.ParserService

adding a jar to the jruby-classloader (via require or via $CLASSPATH << 'my.jar' will just do something along those lines to load the actual extension

for ( url : runtime.getJRubyClassLoader().getResources( "META-INF/services/org.jruby.Extension" ) ) {
  for (line : loadUrl( url ) {
     runtime.getJRubyClassLoader().loadClass( line );
  }
}

whether to keep a list of already loaded extension may or may not be needed.

@kares
Copy link
Member

kares commented Mar 8, 2016

would have been a great feature (with some official docs) - loading by hand might not be for every-one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants