使用 sinatra、warbler 和 jruby-openssl 创建可执行 jar
我正在尝试使用 sinatra 和 warble 创建一个简单的可执行 war 文件。我有一个简单的 lib/app.rb 文件,其中包含:
require 'rubygems'
require 'sinatra'
class Hiwar < Sinatra::Application
get '/' do
body "Hi!"
end
end
一个 config.ru 文件,其中:
require 'rubygems'
require 'lib/app'
run Hiwar.new
和一个 config/warble.rb 文件,其中:
Warbler::Config.new do |config|
config.dirs = %w(config lib)
config.gems += ["sinatra","rack","rack-protection","tilt","jruby-openssl"]
end
当我执行时:
$ warble executable war
我获得:
warble aborted!
Zip end of central directory signature not found
Tasks: TOP => war:files
(See full trace by running task with --trace)
我已经看到,如果我删除 gem“jruby-openssl”从列表中,它不会抱怨并创建 war 文件,但是当我执行它时,它会引发 500 错误:
undefined method `ssl?' for class `Sinatra::Request'
是否有更简单的方法来使用 sinatra 生成可执行 jar?
I am trying to create a simple executable war file using sinatra and warble. I have a simple lib/app.rb file with:
require 'rubygems'
require 'sinatra'
class Hiwar < Sinatra::Application
get '/' do
body "Hi!"
end
end
a config.ru file with:
require 'rubygems'
require 'lib/app'
run Hiwar.new
and a config/warble.rb file with:
Warbler::Config.new do |config|
config.dirs = %w(config lib)
config.gems += ["sinatra","rack","rack-protection","tilt","jruby-openssl"]
end
When I execute:
$ warble executable war
I obtain:
warble aborted!
Zip end of central directory signature not found
Tasks: TOP => war:files
(See full trace by running task with --trace)
I have seen that if I remove the gem "jruby-openssl" from the list, it does not complain and creates the war file, but when I execute it, it raises a 500 error:
undefined method `ssl?' for class `Sinatra::Request'
Is there a simpler way to generate an executable jar with sinatra?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看Rawr,它允许您使用
jruby-complete 将 Ruby 解释器嵌入到 jar 中。
在过去的三天里,我花了一个名为 FontX 的工作演示,它可以转换
.ttf
各种其他字体格式。运行“rake rawr:jar”进行编译,然后运行rake start
进行查看。Github 上的 FontX
Look at Rawr, which allows you to use
jruby-complete
to embed the Ruby interpreter within a jar.I have spent the last 3 days getting a working demo called FontX which converts
.ttf
to various other font formats. Run 'rake rawr:jar' to compile, thenrake start
to view.FontX on Github