Sorry, I’ll add the subject line now.
- Keith
Sorry, I’ll add the subject line now.
Have you looked into bundler http://bundler.io/?
This gem allows you to create a gemfile that lists all the dependent
gems.
“bundle install” will install all the required gems
You can also download and store these gems within the project locally
with
the “bundle package” command, in turn you can install those gems with
the
“bundle install --local” command.
Hi Keith,
I wrote an packaging extension for buildr which helps you bundle up a
collection of gems in a JAR in a way that JRuby can use them:
Even if you don’t want to use the packager itself, the README describes
some
snags you might run into.
Rhett
From: Keith B. [email protected]
Reply-To: [email protected]
Date: Monday, July 15, 2013 3:46 PM
To: [email protected]
Subject: [jruby-user] Packaging Gems in a Jar File
Sorry, I’ll add the subject line now.
On Mon, Jul 15, 2013 at 4:45 PM, Keith B. [email protected]
Nice work Rhett! I also have done similar work in RedStorm
GitHub - colinsurprenant/redstorm: JRuby on Storm to package gems into a
jar, but it is not a standalone process. My strategy was to use
Bundler for dependency resolution and copy the bundled gems into the
jar. I will take a look at your strategy and see if we can
iterate/improve with this.
Colin
On Mon, Jul 15, 2013 at 4:55 PM, Rhett S. [email protected]
wrote:
Rhett
- Keith
Second best would be to ship the script itself, plus another file containing
of where the script is installed, and using that.Thanks for any help.
- Keith
–
@colinsurprenant
Hi Colin,
I think using bundler as part of the process is a great idea. I would
have
used it when I first wrote buildr-gemjar (in 2011), except I had a
requirement to be able to use locally-packaged .gem files. Bundler has
never directly supported this, but there is apparently a workaround you
can use now1.
Anyway, I wrote up a bunch of notes about how I’d rework buildr-gemjar
to
use bundler2, but I haven’t had a chance to implement any of them yet.
Rhett
Guys -
Thanks for all your input. It didn’t occur to me to use warbler,
because
for some reason I thought it was specific to Rails.
We’re aware of Bundler, and have been using it ourselves. This use case
is
different though, as it involves distributing software to a Java shop
with
little to no Ruby expertise, so they were hoping to reduce the entire
distribution to a single jar file.
However, I suspect that that might not be viable, because any gems we
package in the jar file will be built on a particular system. Although
JRuby gems are in general written in JRuby, they can contain references
to
native code, right? Or even contain native code?
Thanks again,
Keith
On Mon, 15 Jul 2013, Keith B. wrote:
yokolet's notelets: Gems in a Jar with RedBridge, but
it looks like it requires some coding, and I’m wondering if there’s a yet
easier way to do it.What’s the best way to do this these days? If necessary, he may just fall
back to creating a custom gem home somewhere, maybe in a gems subdirectory
of where the script is installed, and using that.
Is using warbler not an option? I’ve been using warbler to create
stand-alone
jars for a while now and it works great.
I’m struggling to find the time to write up a good blog post on what
I’ve been
working on, but providing self-contained runnable jars has simplified a
lot
for my team
I‘ve been using warbler successfully for many years to build self executing jar files from Rails apps.
But for current jRuby versions it became more and more difficult and volatile to keep warbler working.
Switched to Jarbler now which bundles a Ruby app with its Gem deps into a self executing jar file.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs