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

Merge pull request #1208 from mwpastore/contrib-deps

Sinatra::Contrib dependency updates. Fixes #1207
This commit is contained in:
namusyaka 2018-03-18 23:01:57 +09:00 committed by GitHub
commit 045a05b8df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 22 additions and 31 deletions

View file

@ -1,6 +1,5 @@
require 'sinatra/base'
require 'sinatra/engine_tracking'
require 'backports'
module Sinatra
#
@ -106,12 +105,12 @@ module Sinatra
dummy = DUMMIES.fetch(current_engine)
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)
end
result.strip.empty? && @capture ? @capture : result
ensure
buffer.try :replace, old_buffer
buffer.replace(old_buffer) if buffer.respond_to?(:replace)
end
def capture_later(&block)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -23,8 +23,7 @@ Gem::Specification.new do |s|
s.add_dependency "sinatra", version
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 "multi_json"

View file

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