4

I'm using the following config/warble.rb in my hello-world-style application:

Warbler::Config.new do |config|
  config.dirs = %w(app config tmp gems views)
  config.includes = FileList["hello.rb"]
  config.gems = ["sinatra"]
  config.gem_dependencies = true
end

Now when I run jruby -S warble this is the error message:

warble aborted!
uninitialized constant Warbler::Jar::Pathname
org/jruby/RubyModule.java:2526:in `const_missing'

Can anyone help me out with it? The application runs without problems when executed directly so it looks like I have all the required gems installed.

Environment:

  • JRuby 1.6.1 (same with 1.5.6)
  • Sinatra 1.2.6
  • Warbler 1.3.0
  • Windows XP
  • Ubuntu 10.04.1
Matthias Hryniszak
  • 3,099
  • 3
  • 36
  • 51

2 Answers2

2

I've found a workaround for this that works with both ruby and jruby.

Instead of specifying the gems inside config/warble.rb I've installed the Bundler gem and created Gemfile in the root folder of my application with the following content:

source :rubygems
gem "sinatra"

With that removed from the config/warble.rb file the actual content of this file looks like this:

Warbler::Config.new do |config|
  config.includes = FileList["hello.rb"]
end

To summarize:

  • gems go into the Gemfile
  • application files go into the config/warble.rb file
Matthias Hryniszak
  • 3,099
  • 3
  • 36
  • 51
2

As it turns out there's an obvious bug in warbler preventing this functionality to work under jruby 1.6.1 and ruby 1.8.7 (don't know about other versions because I didn't test it).

Take a look here for a quick fix:

https://github.com/padcom/warbler/commit/b4b24e17dee5bb98525203c82519a8901874ef81

Matthias Hryniszak
  • 3,099
  • 3
  • 36
  • 51