4

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?

Labra
  • 1,412
  • 1
  • 13
  • 33
  • If I execute "rackup -p 4567" it works fine...so my problem is how to develop a war file from sinatra... – Labra Dec 02 '11 at 13:14
  • What version of sinatra? I'm getting the same error (obviously from very different code) and I think it may be related to versions. – David Rhoden Feb 07 '12 at 23:06
  • Has there been any progress with this question? I'm interested in this problem. – FilBot3 Jan 18 '16 at 15:11

1 Answers1

0

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, then rake start to view.

FontX on Github

briangonzalez
  • 1,606
  • 16
  • 21