From 9889b08360abf22f6dc71b3748e4b0387b3122f6 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 25 May 2009 23:04:27 -0700 Subject: [PATCH] Switch to autoload to defer requires This should prevent Rack from being required too early on so "-I" being passed through the unicorn command-line can modify $LOAD_PATH for Rack --- lib/unicorn.rb | 13 +++++++------ lib/unicorn/const.rb | 3 --- test/test_helper.rb | 2 ++ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/unicorn.rb b/lib/unicorn.rb index da413991..cb36fc8f 100644 --- a/lib/unicorn.rb +++ b/lib/unicorn.rb @@ -1,16 +1,17 @@ require 'fcntl' - require 'unicorn/socket_helper' -require 'unicorn/const' -require 'unicorn/http_request' -require 'unicorn/http_response' -require 'unicorn/configurator' -require 'unicorn/util' +autoload :Rack, 'rack' # Unicorn module containing all of the classes (include C extensions) for running # a Unicorn web server. It contains a minimalist HTTP server with just enough # functionality to service web application requests fast as possible. module Unicorn + autoload :Const, 'unicorn/const' + autoload :HttpRequest, 'unicorn/http_request' + autoload :HttpResponse, 'unicorn/http_response' + autoload :Configurator, 'unicorn/configurator' + autoload :Util, 'unicorn/util' + class << self def run(app, options = {}) HttpServer.new(app, options).start.join diff --git a/lib/unicorn/const.rb b/lib/unicorn/const.rb index 52d1775c..91f0d82c 100644 --- a/lib/unicorn/const.rb +++ b/lib/unicorn/const.rb @@ -1,6 +1,3 @@ - -require 'rack/utils' - module Unicorn # Frequently used constants when constructing requests or responses. Many times diff --git a/test/test_helper.rb b/test/test_helper.rb index 55aa70c8..787adbff 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -25,7 +25,9 @@ require 'stringio' require 'pathname' require 'tempfile' require 'fileutils' +require 'logger' require 'unicorn' +require 'unicorn/http11' if ENV['DEBUG'] require 'ruby-debug' -- 2.11.4.GIT