Rack, Camping and missing require

View: New views
3 Messages — Rating Filter:   Alert me  

Rack, Camping and missing require

by 0x002A@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey list,

I'm trying to get jruby-rack and camping running together. My test application lives in lib/demo.rb (named Demo). Setting the rackup script to "run Rack::Adapter::Camping.new(Demo)" raises an exception that Demo cannot be found. I suppose the file isn't "require"d anywhere.

How to I configure warbler/jruby-rack to require my app file?

TIA
robert

Re: Rack, Camping and missing require

by Nick Sieger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Jul 22, 2008 at 2:41 AM, robber <0x002a@...> wrote:
> Hey list,
>
> I'm trying to get jruby-rack and camping running together. My test
> application lives in lib/demo.rb (named Demo). Setting the rackup script to
> "run Rack::Adapter::Camping.new(Demo)" raises an exception that Demo cannot
> be found. I suppose the file isn't "require"d anywhere.
>
> How to I configure warbler/jruby-rack to require my app file?

Hi Robert, I think you're headed in the right direction, the problem
right now is that "lib" isn't put on the load path. JRuby-Rack 0.9
unfortunately won't help you, but I fixed an issue in the trunk
version that should be out soon that will allow you to assume that
WEB-INF is the current directory while you're loading, so you could do
something like:

require './lib/demo'
run Rack::Adapter::Camping.new(Demo)

inside your rackup parameter. Can you download
http://caldersphere.net/jruby-rack/jruby-rack-0.9.1-SNAPSHOT.jar and
try it?

/Nick

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Rack, Camping and missing require

by 0x002A@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Jul 22, 2008 at 8:45 PM, Nick Sieger <nicksieger@...> wrote:
On Tue, Jul 22, 2008 at 2:41 AM, robber <0x002a@...> wrote:
> Hey list,
>
> I'm trying to get jruby-rack and camping running together. My test
> application lives in lib/demo.rb (named Demo). Setting the rackup script to
> "run Rack::Adapter::Camping.new(Demo)" raises an exception that Demo cannot
> be found. I suppose the file isn't "require"d anywhere.
>
> How to I configure warbler/jruby-rack to require my app file?

Hi Robert, I think you're headed in the right direction, the problem
right now is that "lib" isn't put on the load path. JRuby-Rack 0.9
unfortunately won't help you, but I fixed an issue in the trunk
version that should be out soon that will allow you to assume that
WEB-INF is the current directory while you're loading, so you could do
something like:

require './lib/demo'
run Rack::Adapter::Camping.new(Demo)

inside your rackup parameter. Can you download
http://caldersphere.net/jruby-rack/jruby-rack-0.9.1-SNAPSHOT.jar and
try it?

Actually it turns out that the require works in 0.9. I just wasn't aware of being able to use require in the rackup script. This should definatly be on the wiki page.

I haven't tested using the camping gem with the trunk version (no time yet), copying the gems to lib worked however. Also there seems to be a glitch handling rack's enviroment. See JRUBY-2859.

Right now everything seems to work using the patched camping adapter. I'll investigate further after showing off camping on tomcat during my presentation tomorrow :-D
LightInTheBox - Buy quality products at wholesale price