« Return to Thread: Proposal for managing gem dependencies in a Java + JRuby application
Exactly. I'm thinking of something like:Nick Sieger-2 wrote:> Package [name]-[version].gem files in the Java application classpath.
> Either at application startup or on demand (by modifying Kernel::gem) find
> the desired gem if it is not already installed by scanning the root of the
> classpath, ala Spring's PathMatchingResourcePatternResolver
> (http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/core/io/support/PathMatchingResourcePatternResolver.html).
> Extract and install the gem into an application-specific GEM_HOME using
> Gem::Installer.
> Done.
This alone seems like it could be worthwhile, you simply will need to
patch Kernel::gem to do the extraction and the gem install (see
src/jruby/commands.rb and src/jruby/extract).
Agreed. This would be valuable for applications that are primarily Java using JRuby where the build and packaging is happening in Java using Maven. The .gem files need some way to get on the classpath and for Java applications this would work well. Accompanying Maven tools could fetch .gem files from RubyForge and package/install/deploy them as jars for use in this kind of application.Nick Sieger-2 wrote:> This enables packaging and deploying gems as jars (the .gem file in the root
> of a jar) and managing these dependencies with Maven, including transitive
> dependencies among gems.
Well, not sure about Maven for managing gems, Rubygems seems to do
that just fine. As long as your solution doesn't require Maven, it
should be fine. (You of course are welcome to use whatever tools you
want for yourself.)
Is there a hard way to register a seekable stream given a Java InputStream?Nick Sieger-2 wrote:> I ran into trouble figuring out how to use the
> InputStream from the classloader as an IO object in Ruby. I tried creating
> an org.jruby.RubyIO object from the InputStream but get an error when
> calling Gem::Format.from_io with the created object:
>
> /lib/ruby/site_ruby/1.8/rubygems/package.rb:411:in `new': Illegal seek
> (Errno::ESPIPE)
Looks like Rubygems wants to be able to seek through the package, but
when creating RubyIO from an InputStream, it makes the resulting IO
unseekable since we don't know whether the underlying stream supports
it.
Unfortunately we don't make it easy to register a seekable stream. A
patch to RubyIO might be necessary in order to support this.
Feel free to open a JIRA (http://jira.codehaus.org/browse/JRUBY) and
attach patches there.
« Return to Thread: Proposal for managing gem dependencies in a Java + JRuby application
| Free embeddable forum powered by Nabble | Forum Help |