dekellum/rjack

Add rjack-rome-modules gem

Closed this issue · 9 comments

I have a JRuby project that currently uses JBundler to get my Maven dependencies, namely rome and rome-modules but since coming across your gem packages I'd love to ditch all that in favor of just another couple of lines in my Gemfile.

Only blocker is that you don't have the rome-modules jar available which I need to provide iTunes tag support (amongst others).

Would you be able to put together another gem for rome-modules or take a pull request if I throw a package together myself?

Is rome-modules being released at the same time, by the same developers/project? The status of this is a little unclear looking at maven central: I see a rome:rome-modules:0.3.2 was released at the same time as rome 1.0. Is that the one you need?

Depending on what makes the most sense, I would indeed accept a pull request to either extend the existing rjack-rome gem to just include rome-modules directly, or for a new rjack-rome-modules gem.

Yes, rome-modules 0.3.2 is the one I need.

As far as I know it's a subproject under rome so it would only be updated if a new feature was required in the modules project or there was a breaking change in rome itself.

I'd recommend breaking out the module support into a separate rjack-rome-modules gem, how does that sound?

In cases where a single project releases multiple jar's in lockstep, we've packaged them as a single gem unless there are size or associated dependency concerns. modules.jar appears small enough. Examples of this would include rjack-httpclient-4, rjack-slf4j, etc. A middle option would be to include rome-modules in rjack-rome but only load it if a user does a:

require 'rjack-rome/modules'

Given that rome development is slow (if not stopped) and that it seems likely there will be a new rome-modules release with a new rome, I would prefer a combined gem for simplicity. Of course, if there was a rome-modules patch release in advance of a rome 1.1, an updated rjack-rome can still be released.

OK, packaging both together makes sense given the size of the modules.jar I'd be happy to work on a pull request that takes that approach.

I dislike having to add additional requires into my code (I expect bundler to have done that for me) so I'd take the route that the modules.jar is always loaded along with the main rome.jar. If they're bundled together, this is what I'd be expecting to happen. Agreed?

That is fine with me as long as there isn't some automatic effect from loading the modules.jar that would be undesirable for existing users. It looks like a user needs to additionally set Java system properties to get rome to use the various extension modules? While it would be consistent for rjack to offer some config helper code for that, it should be off by default I would think.

Mmm I'm using the iTunes portion of the modules.jar in JRuby and don't need to do anything else other than require the jar, no messing around with system props. You have a link to where you saw that?

I just saw a random rometools jira talking about modules and rome.properties, but now I realize that the properties files are actually baked in to the jars themselves. This implies that simply loading modules will change rome's behaviour, and thus I am much more inclined to want an opt-in require for modules.

I tend to view bundler as handling gem activation instead of require (after all, gems need to be able to work without bundler) but I think I recall seeing bundler support for overriding the default require to use in the gemspec config?

Still don't think that simply requiring the jar modifies rome's behavior.

The difference is that when you have acquired a SyndFeed instance, you can invoke getModule with a constant from the modules jar (com.sun.syndication.feed.module.itunes.ITunes::URI). This then returns a set of objects that you can interrogate to access the extended RSS features. There's an example of its usage here.

If you make the same method call without the modules jar required you simply get null back.

Your right, you can override the default require in bundler. For example it needs the override for ActiveRecord atm gem "activerecord", :require => "active_record". It's there to fix the situation where a gems main file isn't the same name as the gem, not to activate additional features. It would be cleaner to simply add a require in the code if you wanted modules added in this case.

Still personally don't like having to add that line (as I said before, if I add a gem I expect my activation to be done for me. In my mind that's any requires that need performing as well) so I'd either split the gem out or always require everything in my gem package.

I've suddenly got the additional requirement on my project to include other jars so I'm forced to stick to the JBundler solution I have at the moment. I'm closing the issue, will serve as reference for others in the future looking for the modules.jar.