Loads an adapter identified by name using options hash.
# File lib/rack/adapter/loader.rb, line 40 40: def self.for(name, options={}) 41: ENV['RACK_ENV'] = options[:environment] 42: 43: case name.to_sym 44: when :rack 45: return load(::File.join(options[:chdir], "config.ru")) 46: 47: when :rails 48: return Rails.new(options.merge(:root => options[:chdir])) 49: 50: when :ramaze 51: require "#{options[:chdir]}/start" 52: 53: Ramaze.trait[:essentials].delete Ramaze::Adapter 54: Ramaze.start :force => true 55: 56: return Ramaze::Adapter::Base 57: 58: when :merb 59: require 'merb-core' 60: 61: Merb::Config.setup(:merb_root => options[:chdir], 62: :environment => options[:environment]) 63: Merb.environment = Merb::Config[:environment] 64: Merb.root = Merb::Config[:merb_root] 65: Merb::BootLoader.run 66: 67: return Merb::Rack::Application.new 68: 69: when :halcyon 70: require 'halcyon' 71: 72: $:.unshift(Halcyon.root/'lib') 73: 74: return Halcyon::Runner.new 75: 76: when :mack 77: ENV["MACK_ENV"] = options[:environment] 78: load(::File.join(options[:chdir], "Rakefile")) 79: require 'mack' 80: return Mack::Utils::Server.build_app 81: 82: when :file 83: return Rack::File.new(options[:chdir]) 84: 85: else 86: raise AdapterNotFound, "Adapter not found: #{name}" 87: 88: end 89: end
Guess which adapter to use based on the directory structure or file content. Returns a symbol representing the name of the adapter to use to load the application under dir/.
# File lib/rack/adapter/loader.rb, line 26 26: def self.guess(dir) 27: ADAPTERS.each do |adapter, file| 28: return adapter if file && ::File.exist?(::File.join(dir, file)) 29: end 30: raise AdapterNotFound, "No adapter found for #{dir}" 31: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.