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.开发者_StackOverflow社区1
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
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
精彩评论