加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

让Sinatra与JRuby和Warbler合作

发布时间:2020-12-17 02:29:15 所属栏目:百科 来源:网络整理
导读:我在我的hello-world风格的应用程序中使用以下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 = trueend
我在我的hello-world风格的应用程序中使用以下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相同)
> Sinatra 1.2.6
> Warbler 1.3.0
> Windows XP
> Ubuntu 10.04.1

解决方法

我找到了一个适用于ruby和jruby的解决方法.

我没有在config / warble.rb中指定gems,而是安装了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文件

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读