Skip to content

Commit

Permalink
Use absolute paths with autoload and require to not depend on load path.
Browse files Browse the repository at this point in the history
  • Loading branch information
macournoyer committed Feb 25, 2010
1 parent 269f7db commit b06880f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
48 changes: 24 additions & 24 deletions lib/thin.rb
Expand Up @@ -3,44 +3,44 @@
require 'stringio'
require 'time'
require 'forwardable'

require 'openssl'
require 'eventmachine'

require 'thin/version'
require 'thin/statuses'
require 'rack'

module Thin
autoload :Command, 'thin/command'
autoload :Connection, 'thin/connection'
autoload :Daemonizable, 'thin/daemonizing'
autoload :Logging, 'thin/logging'
autoload :Headers, 'thin/headers'
autoload :Request, 'thin/request'
autoload :Response, 'thin/response'
autoload :Runner, 'thin/runner'
autoload :Server, 'thin/server'
autoload :Stats, 'thin/stats'
ROOT = File.expand_path(File.dirname(__FILE__))

autoload :Command, "#{ROOT}/thin/command"
autoload :Connection, "#{ROOT}/thin/connection"
autoload :Daemonizable, "#{ROOT}/thin/daemonizing"
autoload :Logging, "#{ROOT}/thin/logging"
autoload :Headers, "#{ROOT}/thin/headers"
autoload :Request, "#{ROOT}/thin/request"
autoload :Response, "#{ROOT}/thin/response"
autoload :Runner, "#{ROOT}/thin/runner"
autoload :Server, "#{ROOT}/thin/server"
autoload :Stats, "#{ROOT}/thin/stats"

module Backends
autoload :Base, 'thin/backends/base'
autoload :SwiftiplyClient, 'thin/backends/swiftiply_client'
autoload :TcpServer, 'thin/backends/tcp_server'
autoload :UnixServer, 'thin/backends/unix_server'
autoload :Base, "#{ROOT}/thin/backends/base"
autoload :SwiftiplyClient, "#{ROOT}/thin/backends/swiftiply_client"
autoload :TcpServer, "#{ROOT}/thin/backends/tcp_server"
autoload :UnixServer, "#{ROOT}/thin/backends/unix_server"
end

module Controllers
autoload :Cluster, 'thin/controllers/cluster'
autoload :Controller, 'thin/controllers/controller'
autoload :Service, 'thin/controllers/service'
autoload :Cluster, "#{ROOT}/thin/controllers/cluster"
autoload :Controller, "#{ROOT}/thin/controllers/controller"
autoload :Service, "#{ROOT}/thin/controllers/service"
end
end

require 'rack'
require 'rack/adapter/loader'
require "#{Thin::ROOT}/thin/version"
require "#{Thin::ROOT}/thin/statuses"
require "#{Thin::ROOT}/rack/adapter/loader"

module Rack
module Adapter
autoload :Rails, 'rack/adapter/rails'
autoload :Rails, "#{Thin::ROOT}/rack/adapter/rails"
end
end
2 changes: 1 addition & 1 deletion lib/thin/request.rb
@@ -1,4 +1,4 @@
require 'thin_parser'
require "#{Thin::ROOT}/thin_parser"
require 'tempfile'

module Thin
Expand Down

0 comments on commit b06880f

Please sign in to comment.