Warbler JAR with Rails models

I’ve been experimenting with creating an executable jar that runs a Ruby
script that depends on Rails models. I created an empty Rails app to
play with at GitHub - slumos/warbler-testapp: Attempt to build a jar with warbler that can execute a script in a Rails environment. The challenge is
to execute bin/testapp, which loads the Rails environment.

To start, I had to do some hacking to override Rails detection in
config/warble.rb:

Override the Rails detection

Warbler.framework_detection = false
Warbler::Traits.module_eval do
def auto_detect_traits
[Warbler::Traits::Bundler, Warbler::Traits::Jar,
Warbler::Traits::NoGemspec]
end
end

This seemed almost to work, but then after successfully loading a dozen
gems, it blows up with a LoadError for bundle/index. I successfully
eliminated the dependency on Bundler by setting

ENV[‘BUNDLE_GEMFILE’] = ‘’

in bin/testapp. But now I have no idea what to do with this:

Errno::ENOENT: No such file or directory -
/private/tmp/jar/jar:file:/private/tmp/jar/testapp.jar!/gems/activesupport-3.2.12/lib/active_support/locale/en.yml
mtime at org/jruby/RubyFile.java:890
updated_at at
jar:file:/private/tmp/jar/testapp.jar!/gems/activesupport-3.2.12/lib/active_support/file_update_checker.rb:100
map at org/jruby/RubyArray.java:2361
updated_at at
jar:file:/private/tmp/jar/testapp.jar!/gems/activesupport-3.2.12/lib/active_support/file_update_checker.rb:100
execute at
jar:file:/private/tmp/jar/testapp.jar!/gems/activesupport-3.2.12/lib/active_support/file_update_checker.rb:77
initialize_i18n at
jar:file:/private/tmp/jar/testapp.jar!/gems/activesupport-3.2.12/lib/active_support/i18n_railtie.rb:67
Railtie at
jar:file:/private/tmp/jar/testapp.jar!/gems/activesupport-3.2.12/lib/active_support/i18n_railtie.rb:34
call at org/jruby/RubyProc.java:249 execute_hook at
jar:file:/private/tmp/jar/testapp.jar!/gems/activesupport-3.2.12/lib/active_support/lazy_load_hooks.rb:34
run_load_hooks at
jar:file:/private/tmp/jar/testapp.jar!/gems/activesupport-3.2.12/lib/active_support/lazy_load_hooks.rb:43
each at org/jruby/RubyArray.java:1613
run_load_hooks at
jar:file:/private/tmp/jar/testapp.jar!/gems/activesupport-3.2.12/lib/active_support/lazy_load_hooks.rb:42
Finisher at
jar:file:/private/tmp/jar/testapp.jar!/gems/railties-3.2.12/lib/rails/application/finisher.rb:59
instance_exec at org/jruby/RubyBasicObject.java:1720
run at
jar:file:/private/tmp/jar/testapp.jar!/gems/railties-3.2.12/lib/rails/initializable.rb:30
run_initializers at
jar:file:/private/tmp/jar/testapp.jar!/gems/railties-3.2.12/lib/rails/initializable.rb:55
each at org/jruby/RubyArray.java:1613
run_initializers at
jar:file:/private/tmp/jar/testapp.jar!/gems/railties-3.2.12/lib/rails/initializable.rb:54
initialize! at
jar:file:/private/tmp/jar/testapp.jar!/gems/railties-3.2.12/lib/rails/application.rb:136
send at org/jruby/RubyBasicObject.java:1659
send at org/jruby/RubyKernel.java:2086
method_missing at
jar:file:/private/tmp/jar/testapp.jar!/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30
(root) at
file:/private/tmp/jar/testapp.jar!/testapp/config/environment.rb:5
require at org/jruby/RubyKernel.java:1027
(root) at
jar:file:/var/folders/fj/5jjtp7hd7673q5_h4cl02r580009tv/T/jruby7518566963929780211extract/jruby-stdlib-1.7.2.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:1
require at
jar:file:/var/folders/fj/5jjtp7hd7673q5_h4cl02r580009tv/T/jruby7518566963929780211extract/jruby-stdlib-1.7.2.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:36
load at org/jruby/RubyKernel.java:1046
(root) at
file:/private/tmp/jar/testapp.jar!/testapp/bin/testapp:7
require at org/jruby/RubyKernel.java:1027
(root) at
file:/private/tmp/jar/testapp.jar!/META-INF/main.rb:1
(root) at
file:/private/tmp/jar/testapp.jar!/META-INF/main.rb:1

My Java-fu is not super-strong. Is this business of gems attempting to
open files in relative to their own location simply incompatible with
running from a jar? Or is it an incompatibility between warbler and
certain rubygems versions like my googling suggests? I started with and
want to use jruby-1.7.2, but also have tried multiple versions back to
jruby-1.6.3 and rubygems-1.5.1 with identical results.

Can anyone suggest a way forward?

Thanks in advance.

Steven