1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

Sinatra::Contrib dependency updates. Fixes #1207

* Remove backports
* Work around Object#try and String#underscore
This commit is contained in:
Mike Pastore 2016-11-25 13:40:16 -06:00
parent 4750d08755
commit 64173303ee
9 changed files with 22 additions and 31 deletions

View file

@ -1,6 +1,5 @@
require 'sinatra/base' require 'sinatra/base'
require 'sinatra/engine_tracking' require 'sinatra/engine_tracking'
require 'backports'
module Sinatra module Sinatra
# #
@ -106,12 +105,12 @@ module Sinatra
dummy = DUMMIES.fetch(current_engine) dummy = DUMMIES.fetch(current_engine)
options = { :layout => false, :locals => {:args => args, :block => block }} options = { :layout => false, :locals => {:args => args, :block => block }}
buffer.try :clear buffer.clear if buffer.respond_to?(:clear)
result = render(current_engine, dummy, options, &block) result = render(current_engine, dummy, options, &block)
end end
result.strip.empty? && @capture ? @capture : result result.strip.empty? && @capture ? @capture : result
ensure ensure
buffer.try :replace, old_buffer buffer.replace(old_buffer) if buffer.respond_to?(:replace)
end end
def capture_later(&block) def capture_later(&block)

View file

@ -7,32 +7,32 @@ module Sinatra
# or breaks if external dependencies are missing. Will extend # or breaks if external dependencies are missing. Will extend
# Sinatra::Application by default. # Sinatra::Application by default.
module Common module Common
register :ConfigFile register :ConfigFile, 'sinatra/config_file'
register :MultiRoute register :MultiRoute, 'sinatra/multi_route'
register :Namespace register :Namespace, 'sinatra/namespace'
register :RespondWith register :RespondWith, 'sinatra/respond_with'
helpers :Capture helpers :Capture, 'sinatra/capture'
helpers :ContentFor helpers :ContentFor, 'sinatra/content_for'
helpers :Cookies helpers :Cookies, 'sinatra/cookies'
helpers :EngineTracking helpers :EngineTracking, 'sinatra/engine_tracking'
helpers :JSON helpers :JSON, 'sinatra/json'
helpers :LinkHeader helpers :LinkHeader, 'sinatra/link_header'
helpers :Streaming helpers :Streaming, 'sinatra/streaming'
helpers :RequiredParams helpers :RequiredParams, 'sinatra/required_params'
end end
## ##
# Other extensions you don't want to be loaded unless needed. # Other extensions you don't want to be loaded unless needed.
module Custom module Custom
# register :Compass # register :Compass, 'sinatra/compass'
register :Reloader register :Reloader, 'sinatra/reloader'
end end
## ##
# Stuff that aren't Sinatra extensions, technically. # Stuff that aren't Sinatra extensions, technically.
autoload :Extension autoload :Extension, 'sinatra/extension'
autoload :TestHelpers autoload :TestHelpers, 'sinatra/test_helpers'
end end
register Sinatra::Contrib::Common register Sinatra::Contrib::Common

View file

@ -1,6 +1,5 @@
require 'sinatra/base' require 'sinatra/base'
require 'sinatra/contrib/version' require 'sinatra/contrib/version'
require 'backports'
module Sinatra module Sinatra
module Contrib module Contrib
@ -9,16 +8,15 @@ module Sinatra
@extensions ||= {:helpers => [], :register => []} @extensions ||= {:helpers => [], :register => []}
end end
def register(name, path = nil) def register(name, path)
autoload name, path, :register autoload name, path, :register
end end
def helpers(name, path = nil) def helpers(name, path)
autoload name, path, :helpers autoload name, path, :helpers
end end
def autoload(name, path = nil, method = nil) def autoload(name, path, method = nil)
path ||= "sinatra/#{name.to_s.underscore}"
extensions[method] << name if method extensions[method] << name if method
Sinatra.autoload(name, path) Sinatra.autoload(name, path)
end end

View file

@ -1,5 +1,4 @@
require 'sinatra/base' require 'sinatra/base'
require 'backports'
module Sinatra module Sinatra
# = Sinatra::Cookies # = Sinatra::Cookies

View file

@ -1,5 +1,4 @@
require 'sinatra/base' require 'sinatra/base'
require 'backports/basic_object' unless defined? BasicObject
module Sinatra module Sinatra

View file

@ -1,4 +1,3 @@
require 'backports'
require 'sinatra/base' require 'sinatra/base'
require 'mustermann' require 'mustermann'

View file

@ -1,5 +1,4 @@
require 'sinatra/base' require 'sinatra/base'
require 'backports'
module Sinatra module Sinatra

View file

@ -23,8 +23,7 @@ Gem::Specification.new do |s|
s.add_dependency "sinatra", version s.add_dependency "sinatra", version
s.add_dependency "mustermann", "~> 1.0" s.add_dependency "mustermann", "~> 1.0"
s.add_dependency "backports", ">= 2.0" s.add_dependency "tilt", ">= 1.3", "< 3"
s.add_dependency "tilt", ">= 1.3", "< 3"
s.add_dependency "rack-protection", version s.add_dependency "rack-protection", version
s.add_dependency "multi_json" s.add_dependency "multi_json"

View file

@ -1,4 +1,3 @@
require 'backports'
require 'spec_helper' require 'spec_helper'
describe Sinatra::Streaming do describe Sinatra::Streaming do