messaliberty

about hulor and us

Posts Tagged ‘jar’

[JRuby on Rails on GAE/J] how-to put rubygems into a jar file to get around file limitations

December 2nd, 2009 post by ice

GAE (Google App Engine) has a limit number to the number files you can upload.
To get around this limit, we need to compress rubygems into jar files.

There may not be easy way to load rubygems in jar files with JRuby.
But with JRuby on GAE/J, it’s easy to load.

  • JRuby on Rails on GAE/J, can load rubygems in RAILS_ROOT/vendor/gems, just do require “gem-name”.
  • But rubygems often contain a lot of files and that can eat into the quota pretty quickly.
  • JRuby on GAE/J, can load rubygems from jar files.
  • Therefore it makes sense to put rubygems into jar files, and I am going to show you how step by step.

Steps:

  • install rubygems into a specific temporary directory (not into the system dir)
    • use -i option to install rugygems into a temporary directory.
    • use –no-rdoc and –no-ri options, to skip to install rdoc and ri, to reduce jar file size.
  • compress rubygems by jar command in the temporary directory.
  • add require “installed-gem.jar” line in RAILS_ROOT/config/environment.rb

(more…)