mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
require to require_relative (#2964)
This commit is contained in:
parent
3374827b47
commit
e7ff17d98c
22 changed files with 74 additions and 70 deletions
14
lib/puma.rb
14
lib/puma.rb
|
@ -10,14 +10,16 @@ require 'stringio'
|
|||
|
||||
require 'thread'
|
||||
|
||||
# use require, see https://github.com/puma/puma/pull/2381
|
||||
require 'puma/puma_http11'
|
||||
require 'puma/detect'
|
||||
require 'puma/json_serialization'
|
||||
|
||||
require_relative 'puma/detect'
|
||||
require_relative 'puma/json_serialization'
|
||||
|
||||
module Puma
|
||||
autoload :Const, 'puma/const'
|
||||
autoload :Server, 'puma/server'
|
||||
autoload :Launcher, 'puma/launcher'
|
||||
autoload :Const, "#{__dir__}/puma/const"
|
||||
autoload :Server, "#{__dir__}/puma/server"
|
||||
autoload :Launcher, "#{__dir__}/puma/launcher"
|
||||
|
||||
# at present, MiniSSL::Engine is only defined in extension code (puma_http11),
|
||||
# not in minissl.rb
|
||||
|
@ -26,7 +28,7 @@ module Puma
|
|||
HAS_UNIX_SOCKET = Object.const_defined? :UNIXSocket
|
||||
|
||||
if HAS_SSL
|
||||
require 'puma/minissl'
|
||||
require_relative 'puma/minissl'
|
||||
else
|
||||
module MiniSSL
|
||||
# this class is defined so that it exists when Puma is compiled
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
require 'puma/json_serialization'
|
||||
require_relative '../json_serialization'
|
||||
|
||||
module Puma
|
||||
module App
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
require 'uri'
|
||||
require 'socket'
|
||||
|
||||
require 'puma/const'
|
||||
require 'puma/util'
|
||||
require 'puma/configuration'
|
||||
require_relative 'const'
|
||||
require_relative 'util'
|
||||
require_relative 'configuration'
|
||||
|
||||
module Puma
|
||||
|
||||
if HAS_SSL
|
||||
require 'puma/minissl'
|
||||
require 'puma/minissl/context_builder'
|
||||
require_relative 'minissl'
|
||||
require_relative 'minissl/context_builder'
|
||||
end
|
||||
|
||||
class Binder
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
require 'optparse'
|
||||
require 'uri'
|
||||
|
||||
require 'puma'
|
||||
require 'puma/configuration'
|
||||
require 'puma/launcher'
|
||||
require 'puma/const'
|
||||
require 'puma/log_writer'
|
||||
require_relative '../puma'
|
||||
require_relative 'configuration'
|
||||
require_relative 'launcher'
|
||||
require_relative 'const'
|
||||
require_relative 'log_writer'
|
||||
|
||||
module Puma
|
||||
class << self
|
||||
|
|
|
@ -8,7 +8,7 @@ class IO
|
|||
end
|
||||
end
|
||||
|
||||
require 'puma/detect'
|
||||
require_relative 'detect'
|
||||
require 'tempfile'
|
||||
require 'forwardable'
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'puma/runner'
|
||||
require 'puma/util'
|
||||
require 'puma/plugin'
|
||||
require 'puma/cluster/worker_handle'
|
||||
require 'puma/cluster/worker'
|
||||
require_relative 'runner'
|
||||
require_relative 'util'
|
||||
require_relative 'plugin'
|
||||
require_relative 'cluster/worker_handle'
|
||||
require_relative 'cluster/worker'
|
||||
|
||||
require 'time'
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'puma/rack/builder'
|
||||
require 'puma/plugin'
|
||||
require 'puma/const'
|
||||
require_relative 'rack/builder'
|
||||
require_relative 'plugin'
|
||||
require_relative 'const'
|
||||
# note that dsl is loaded at end of file, requires ConfigDefault constants
|
||||
|
||||
module Puma
|
||||
# A class used for storing "leveled" configuration options.
|
||||
|
@ -285,7 +286,7 @@ module Puma
|
|||
found = options[:app] || load_rackup
|
||||
|
||||
if @options[:log_requests]
|
||||
require 'puma/commonlogger'
|
||||
require_relative 'commonlogger'
|
||||
logger = @options[:logger]
|
||||
found = CommonLogger.new(found, logger)
|
||||
end
|
||||
|
@ -383,4 +384,4 @@ module Puma
|
|||
end
|
||||
end
|
||||
|
||||
require 'puma/dsl'
|
||||
require_relative 'dsl'
|
||||
|
|
|
@ -284,7 +284,7 @@ module Puma
|
|||
|
||||
private
|
||||
def start
|
||||
require 'puma/cli'
|
||||
require_relative 'cli'
|
||||
|
||||
run_args = []
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'puma/const'
|
||||
require 'puma/util'
|
||||
require_relative 'const'
|
||||
require_relative 'util'
|
||||
|
||||
module Puma
|
||||
# The methods that are available for use inside the configuration file.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'puma/const'
|
||||
require_relative 'const'
|
||||
|
||||
module Puma
|
||||
# The implementation of a detailed error logging.
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'puma/log_writer'
|
||||
require 'puma/events'
|
||||
require 'puma/detect'
|
||||
require 'puma/cluster'
|
||||
require 'puma/single'
|
||||
require 'puma/const'
|
||||
require 'puma/binder'
|
||||
require_relative 'log_writer'
|
||||
require_relative 'events'
|
||||
require_relative 'detect'
|
||||
require_relative 'cluster'
|
||||
require_relative 'single'
|
||||
require_relative 'const'
|
||||
require_relative 'binder'
|
||||
|
||||
module Puma
|
||||
# Puma::Launcher is the single entry point for starting a Puma server based on user
|
||||
|
@ -115,7 +115,7 @@ module Puma
|
|||
permission = @options[:state_permission]
|
||||
return unless path
|
||||
|
||||
require 'puma/state_file'
|
||||
require_relative 'state_file'
|
||||
|
||||
sf = StateFile.new
|
||||
sf.pid = Process.pid
|
||||
|
@ -278,7 +278,7 @@ module Puma
|
|||
if Puma.jruby?
|
||||
close_binder_listeners
|
||||
|
||||
require 'puma/jruby_restart'
|
||||
require_relative 'jruby_restart'
|
||||
JRubyRestart.chdir_exec(@restart_dir, restart_args)
|
||||
elsif Puma.windows?
|
||||
close_binder_listeners
|
||||
|
@ -319,7 +319,7 @@ module Puma
|
|||
return unless ENV["NOTIFY_SOCKET"]
|
||||
|
||||
begin
|
||||
require 'puma/systemd'
|
||||
require_relative 'systemd'
|
||||
rescue LoadError
|
||||
log "Systemd integration failed. It looks like you're trying to use systemd notify but don't have sd_notify gem installed"
|
||||
return
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'puma/null_io'
|
||||
require 'puma/error_logger'
|
||||
require_relative 'null_io'
|
||||
require_relative 'error_logger'
|
||||
require 'stringio'
|
||||
require 'io/wait' unless Puma::HAS_NATIVE_IO_WAIT
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ rescue LoadError
|
|||
end
|
||||
|
||||
# need for Puma::MiniSSL::OPENSSL constants used in `HAS_TLS1_3`
|
||||
# use require, see https://github.com/puma/puma/pull/2381
|
||||
require 'puma/puma_http11'
|
||||
|
||||
module Puma
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'puma/plugin'
|
||||
require_relative '../plugin'
|
||||
|
||||
Puma::Plugin.create do
|
||||
def start(launcher)
|
||||
|
|
|
@ -287,7 +287,7 @@ module Puma::Rack
|
|||
private
|
||||
|
||||
def generate_map(default_app, mapping)
|
||||
require 'puma/rack/urlmap'
|
||||
require_relative 'urlmap'
|
||||
|
||||
mapped = default_app ? {'/' => default_app} : {}
|
||||
mapping.each { |r,b| mapped[r] = self.class.new(default_app, &b).to_app }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rack/handler/puma'
|
||||
require_relative '../rack/handler/puma'
|
||||
|
||||
module Rack::Handler
|
||||
def self.default(options = {})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'puma/queue_close' unless ::Queue.instance_methods.include? :close
|
||||
require_relative 'queue_close' unless ::Queue.instance_methods.include? :close
|
||||
|
||||
module Puma
|
||||
class UnsupportedBackend < StandardError; end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'puma/server'
|
||||
require 'puma/const'
|
||||
require_relative 'server'
|
||||
require_relative 'const'
|
||||
|
||||
module Puma
|
||||
# Generic class that is used by `Puma::Cluster` and `Puma::Single` to
|
||||
|
@ -61,7 +61,7 @@ module Puma
|
|||
str = @options[:control_url]
|
||||
return unless str
|
||||
|
||||
require 'puma/app/status'
|
||||
require_relative 'app/status'
|
||||
|
||||
if token = @options[:control_auth_token]
|
||||
token = nil if token.empty? || token == 'none'
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
require 'stringio'
|
||||
|
||||
require 'puma/thread_pool'
|
||||
require 'puma/const'
|
||||
require 'puma/log_writer'
|
||||
require 'puma/events'
|
||||
require 'puma/null_io'
|
||||
require 'puma/reactor'
|
||||
require 'puma/client'
|
||||
require 'puma/binder'
|
||||
require 'puma/util'
|
||||
require 'puma/io_buffer'
|
||||
require 'puma/request'
|
||||
require_relative 'thread_pool'
|
||||
require_relative 'const'
|
||||
require_relative 'log_writer'
|
||||
require_relative 'events'
|
||||
require_relative 'null_io'
|
||||
require_relative 'reactor'
|
||||
require_relative 'client'
|
||||
require_relative 'binder'
|
||||
require_relative 'util'
|
||||
require_relative 'io_buffer'
|
||||
require_relative 'request'
|
||||
|
||||
require 'socket'
|
||||
require 'io/wait' unless Puma::HAS_NATIVE_IO_WAIT
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'puma/runner'
|
||||
require 'puma/detect'
|
||||
require 'puma/plugin'
|
||||
require_relative 'runner'
|
||||
require_relative 'detect'
|
||||
require_relative 'plugin'
|
||||
|
||||
module Puma
|
||||
# This class is instantiated by the `Puma::Launcher` and used
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require 'thread'
|
||||
|
||||
require 'puma/io_buffer'
|
||||
require_relative 'io_buffer'
|
||||
|
||||
module Puma
|
||||
# Internal Docs for A simple thread pool management object.
|
||||
|
|
|
@ -11,10 +11,10 @@ module Rack
|
|||
}
|
||||
|
||||
def self.config(app, options = {})
|
||||
require 'puma'
|
||||
require 'puma/configuration'
|
||||
require 'puma/log_writer'
|
||||
require 'puma/launcher'
|
||||
require_relative '../../puma'
|
||||
require_relative '../../puma/configuration'
|
||||
require_relative '../../puma/log_writer'
|
||||
require_relative '../../puma/launcher'
|
||||
|
||||
default_options = DEFAULT_OPTIONS.dup
|
||||
|
||||
|
|
Loading…
Reference in a new issue