iconara / rubydoop

Write Hadoop jobs in JRuby
220 stars 33 forks source link

Why is bundler gem excluded while packaging? #21

Closed paulgoetze closed 10 years ago

paulgoetze commented 10 years ago

I use rubydoop together with the ruby-band gem. ruby-band uses jbuilder which seems to require bundler. The problem that comes up with this, is that I cannot run my Hadoop jobs because bundler is not available.

What is the reason for not considering bundler gem while packaging in the find_gems! method?

iconara commented 10 years ago

Bundler basically does not work from inside a JAR. It assumes lots of things about the environment in which it runs and working around its idiosyncracies is just not worth it. Instead Rubydoop uses Bundler to look up all dependencies, then creates a bootstap file that does the job that Bundler.setup does. Bundler is great at managing dependencies, but once your code is running Bundler should be required, this goes for any application or library.

I had a quick look through jbuilder and couldn't see that it depends on Bundler. The only places where it mentions bundler are in test_helper.rb and the Rakefile, and neither of these should be loaded when it's used as a library.

The ruby-band gem, on the other hand, has a runtime dependency on Bundler. I would consider this a bug in ruby-band.

paulgoetze commented 10 years ago

Thanks, this may be helpful. I think, I will look at ruby-band and see what can be done to solve this problem.

paulgoetze commented 10 years ago

Oops, just realized, that I meant jbundler instead of jbuilder. Therefore you couldn't find any dependencies ;).

iconara commented 10 years ago

That explains it, but I think the answer is more or less the same: applications should not have runtime dependencies on dependency management tools.

Maybe there needs an exclusion rule for jbundler too, and some integration that makes sure that the dependencies it is managing (the JARs) are included in the JAR Rubydoop creates.

If you can get the code that requires jbundler at runtime to stop doing that you can manually include the extra JAR files with the :lib_jars option to Rubydoop::Package.

iconara commented 10 years ago

I'm closing this now, but if you feel like there's something specific we can do in Rubydoop you're welcome to re-open it.

paulgoetze commented 10 years ago

Alright, only in case someone is faced with similar problems: I solved this now by requiring the JARs using lock_jar instead of jbundler. Thus, the bundler dependency has been gone!