iconara / rubydoop

Write Hadoop jobs in JRuby
220 stars 33 forks source link

Package configuration - loading files outside of 'lib' #16

Closed paulgoetze closed 10 years ago

paulgoetze commented 10 years ago

Is it possible to include other Ruby files not lying in the 'lib' directory while packaging? E.g. if I would like to use some custom classes in a job-config, which are defined in a directory at the same level as the 'lib' directory. How to make this possible?

iconara commented 10 years ago

Unfortunately not out of the box. An ugly workaround is to use a Rake task to copy the necessary files into lib, run the packaging, and then remove them. It's also possible to use JRuby's ant integration to add files to the JAR created by Rubydoop's packaging.

It wouldn't be a very hard feature to add though, and a patch would be welcome. If there was an option to Rubydoop::Package that was a hash of the paths to the files to include and the paths where they should end up in the JAR you could add another phase of the JAR packaging more or less like the one that adds extra JAR files: https://github.com/iconara/rubydoop/blob/master/lib/rubydoop/package.rb#L135

I've got another project for building self-contained applications packaged as JAR files called Puck. It has this feature, and I've thought for a while that I should throw out Rubydoop's packaging code and use Puck instead (but the layout of an Hadoop compatible JAR is a bit different so I would have to add a few more features to Puck for it to work, so that's why it hasn't happened yet).

iconara commented 10 years ago

Come to think of it, the :extra_jars option could probably be used to get other things than JAR files into the JAR, if you can live with then ending up in the lib directory inside the JAR.