Raise Rack version requirement to 2.x
This commit is contained in:
parent
6e3ccf5a83
commit
6aea9f804e
|
@ -12,12 +12,7 @@ rvm:
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
|
||||||
- { rvm: 2.2, env: rack=master }
|
|
||||||
- { rvm: 2.2, env: tilt=master }
|
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- env: rack=master
|
|
||||||
- env: tilt=master
|
|
||||||
- rvm: ruby-head
|
- rvm: ruby-head
|
||||||
- rvm: jruby-head
|
- rvm: jruby-head
|
||||||
- rvm: rbx-2
|
- rvm: rbx-2
|
||||||
|
|
17
Gemfile
17
Gemfile
|
@ -11,22 +11,10 @@ source 'https://rubygems.org' unless ENV['QUICK']
|
||||||
gemspec
|
gemspec
|
||||||
|
|
||||||
gem 'rake'
|
gem 'rake'
|
||||||
|
gem 'rack', github: 'rack/rack'
|
||||||
gem 'rack-test', '>= 0.6.2'
|
gem 'rack-test', '>= 0.6.2'
|
||||||
gem "minitest", "~> 5.0"
|
gem "minitest", "~> 5.0"
|
||||||
|
|
||||||
# Allows stuff like `tilt=1.2.2 bundle install` or `tilt=master ...`.
|
|
||||||
# Used by the CI.
|
|
||||||
repos = {'tilt' => "rtomayko/tilt", 'rack' => "rack/rack"}
|
|
||||||
|
|
||||||
%w[tilt rack].each do |lib|
|
|
||||||
dep = case ENV[lib]
|
|
||||||
when 'stable', nil then nil
|
|
||||||
when /(\d+\.)+\d+/ then "~> " + ENV[lib].sub("#{lib}-", '')
|
|
||||||
else {:github => repos[lib], :branch => dep}
|
|
||||||
end
|
|
||||||
gem lib, dep
|
|
||||||
end
|
|
||||||
|
|
||||||
if RUBY_ENGINE == 'jruby'
|
if RUBY_ENGINE == 'jruby'
|
||||||
gem 'nokogiri', '!= 1.5.0'
|
gem 'nokogiri', '!= 1.5.0'
|
||||||
gem 'jruby-openssl'
|
gem 'jruby-openssl'
|
||||||
|
@ -42,6 +30,9 @@ if RUBY_ENGINE == "ruby"
|
||||||
gem 'rdiscount'
|
gem 'rdiscount'
|
||||||
gem 'RedCloth'
|
gem 'RedCloth'
|
||||||
gem 'puma'
|
gem 'puma'
|
||||||
|
#TODO: remove explicit require once net-http-server does it
|
||||||
|
#(apparently it was shipped w/ stdlib in Rubies < 2.2.2)
|
||||||
|
gem 'gserver'
|
||||||
gem 'net-http-server'
|
gem 'net-http-server'
|
||||||
gem 'yajl-ruby'
|
gem 'yajl-ruby'
|
||||||
gem 'nokogiri'
|
gem 'nokogiri'
|
||||||
|
|
|
@ -150,7 +150,7 @@ module Sinatra
|
||||||
if calculate_content_length?
|
if calculate_content_length?
|
||||||
# if some other code has already set Content-Length, don't muck with it
|
# if some other code has already set Content-Length, don't muck with it
|
||||||
# currently, this would be the static file-handler
|
# currently, this would be the static file-handler
|
||||||
headers["Content-Length"] = body.inject(0) { |l, p| l + Rack::Utils.bytesize(p) }.to_s
|
headers["Content-Length"] = body.inject(0) { |l, p| l + p.bytesize }.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
[status.to_i, headers, result]
|
[status.to_i, headers, result]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require 'rack/showexceptions'
|
require 'rack/show_exceptions'
|
||||||
|
|
||||||
module Sinatra
|
module Sinatra
|
||||||
# Sinatra::ShowExceptions catches all exceptions raised from the app it
|
# Sinatra::ShowExceptions catches all exceptions raised from the app it
|
||||||
|
@ -40,7 +40,7 @@ module Sinatra
|
||||||
500,
|
500,
|
||||||
{
|
{
|
||||||
"Content-Type" => content_type,
|
"Content-Type" => content_type,
|
||||||
"Content-Length" => Rack::Utils.bytesize(body.join).to_s
|
"Content-Length" => body.join.bytesize.to_s
|
||||||
},
|
},
|
||||||
body
|
body
|
||||||
]
|
]
|
||||||
|
|
|
@ -15,7 +15,7 @@ Gem::Specification.new 'sinatra', Sinatra::VERSION do |s|
|
||||||
|
|
||||||
s.required_ruby_version = '>= 2.2.0'
|
s.required_ruby_version = '>= 2.2.0'
|
||||||
|
|
||||||
s.add_dependency 'rack', '>= 1.6'
|
s.add_dependency 'rack', '~> 2.0.0.alpha'
|
||||||
s.add_dependency 'tilt', '~> 2.0'
|
s.add_dependency 'tilt', '~> 2.0'
|
||||||
s.add_dependency 'rack-protection', '~> 1.5'
|
s.add_dependency 'rack-protection', '~> 1.5'
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,12 +3,9 @@ Encoding.default_external = "UTF-8" if defined? Encoding
|
||||||
|
|
||||||
RUBY_ENGINE = 'ruby' unless defined? RUBY_ENGINE
|
RUBY_ENGINE = 'ruby' unless defined? RUBY_ENGINE
|
||||||
|
|
||||||
begin
|
require 'bundler'
|
||||||
require 'rack'
|
require 'bundler/setup'
|
||||||
rescue LoadError
|
require 'rack'
|
||||||
require 'rubygems'
|
|
||||||
require 'rack'
|
|
||||||
end
|
|
||||||
|
|
||||||
testdir = File.dirname(__FILE__)
|
testdir = File.dirname(__FILE__)
|
||||||
$LOAD_PATH.unshift testdir unless $LOAD_PATH.include?(testdir)
|
$LOAD_PATH.unshift testdir unless $LOAD_PATH.include?(testdir)
|
||||||
|
|
Loading…
Reference in New Issue