4

我在我的 hello-world-style 应用程序中使用以下 config/warble.rb:

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

现在,当我运行 jruby -S warble 这是错误消息:

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

谁能帮我解决这个问题?该应用程序在直接执行时运行没有问题,所以看起来我已经安装了所有必需的 gem。

环境:

  • JRuby 1.6.1(与 1.5.6 相同)
  • 西纳特拉 1.2.6
  • 莺1.3.0
  • 视窗
  • Ubuntu 10.04.1
4

2 回答 2

2

我找到了一种适用于 ruby​​ 和 jruby 的解决方法。

我没有在 config/warble.rb 中指定 gem,而是安装了 Bundler gem,并在我的应用程序的根文件夹中创建了 Gemfile,其内容如下:

source :rubygems
gem "sinatra"

从 config/warble.rb 文件中删除该文件后,该文件的实际内容如下所示:

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

总结一下:

  • 宝石进入 Gemfile
  • 应用程序文件进入 config/warble.rb 文件
于 2011-05-08T15:02:01.927 回答
2

事实证明,warbler 中存在一个明显的错误,阻止此功能在 jruby 1.6.1 和 ruby​​ 1.8.7 下工作(不知道其他版本,因为我没有测试它)。

在这里查看快速修复:

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

于 2011-05-09T07:12:48.443 回答