server.rb - Recent version of `rack` doesn't work. 2.2 does work.
I got this error when trying to run the server.
$ ruby server.rb ~/countries-raster.mbtiles
Starting local server
Traceback (most recent call last):
3: from server.rb:22:in `<main>'
2: from server.rb:118:in `<class:MapServer>'
1: from /usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb:85:in `require'
/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb:85:in `require': cannot load such file -- rack/handler (LoadError)
I'm not a Ruby guy so I got help with this on Stack Overflow: https://stackoverflow.com/a/75100160/475877
Solutions:
gem 'rack', '~> 2.2'fixes it - at least the server runs, no comment yet on how well it works- Install
rackupinstead of holding backrackto 2.2 - I see a subsequent error instead (uninitialized constant Rackup::Handler::WEBrick (NameError)
I'll leave it you to decide which route to take; perhaps you'd prefer the latter, including fixing the subsequent error, so that rack is up to date.
There's also the side suggestion of using Gemfile/bundle. Perhaps you'd want to consider that as well as you address the rest of this.
Changing the "require" to
require 'rackup'
and the call to
Rackup::Handler::WEBrick.run(app)
also works (in that it doesn't crash), but I can't test it further here until https://github.com/systemed/tilemaker/issues/391 is resolved .
@SomeoneElseOSM to avoid warnings and possibly issues with older versions (which currently this library relies on based on this issue). I would propose:
if Rack::VERSION > '3.0'
require 'rackup'
require 'rack/handler'
end
@orblivion Latest change make it only support rack v3 now: #460