Warble: problem requiring a file

Hi,

I’ve developed an application with JRuby, and would like to package it
with
warbler.
I have this structure of directories

/bin/dashboard.rb -> script to be executed
/lib/ -> all jars are in here, some under sub-directories
/models/ some activerecord models

In the script, running fine when launched from the terminal, I have this
line:

$:.unshift “#{File.dirname(FILE)}/…/models/”

and when I print the value of $: before requiring a model I have this
like
included in the output:
file:/home/…/dashboard.jar!/src/bin/…/models/

but the model file is not found:
LoadError: no such file to load – picture

However, when I put it under the /lib directory, it is found.
But the lib directory is not included in the ouput of puts $: …

I’d like to understand what is going on, so I can require my models. Can
anyone explain it?

Thanks

Raph

On Mon, Jan 13, 2014 at 2:48 PM, Raphael B. [email protected]
wrote:

In the script, running fine when launched from the terminal, I have this

However, when I put it under the /lib directory, it is found.
But the lib directory is not included in the ouput of puts $: …

I’d like to understand what is going on, so I can require my models. Can
anyone explain it?

I had done quite some tests before sending my first mail, but, as is
common, I only found the solution just after sending this mail…
For the code executed by the jar, I need to add a path relative to the
root
of the jar. So adding
$:.unshift(“models”)
does what I need.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs