Skip to content

Java platform gems in Rails

October 10, 2009

I’ve recently ecountered a problem with freezing java platform gems in a Rails application I’m working on. The problem was, that the Rails::GemDependency class would assume that a gem’s version is the last part of it’s directory name:

      directory_name_parts = File.basename(directory_name).split('-')
      name    = directory_name_parts[0..-2].join('-')
      version = directory_name_parts.last
      result = self.new(name, :version => version)

For java platform gems, directory names often look like e.g. RedCloth-2.2.2-universal-java. In this case we would end up with the version variable to be set to ‘java’, and the attempt to create a new object would result in an error. Since I really needed those JRuby compatible gems, I’ve prepared a small patch and filed a ticket in the Rails project. Both can be found here: https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/3356. I hope this helps somebody with unpacking the java platform gems into the Rails’ vendor directory.

Advertisement
2 Comments leave one →
  1. October 10, 2009 3:59 pm

    Knowing Rails’ tickets handling you’ll have to wait some time.

  2. Łukasz permalink
    October 10, 2009 4:28 pm

    Yep. I guess there are ways to get attention (writing to Rails mailing lists). For the time being we’re using the patch as is. The standard procedure requires three +1 votes in the ticket. Then the ticket is marked as reviewed and can be included into Rails. Time will tell, what are they going to do with the patch :-) .

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.