Skip to content

Commit

Permalink
Fix Merb adapter autoloading, closes #47
Browse files Browse the repository at this point in the history
  • Loading branch information
macournoyer committed Apr 3, 2008
1 parent 1d1faea commit 0284f81
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions lib/rack/adapter/loader.rb
Expand Up @@ -21,28 +21,34 @@ def self.guess(dir)
def self.for(name, options={})
case name.to_sym
when :rails
Rails.new(options.merge(:root => options[:chdir]))
return Rails.new(options.merge(:root => options[:chdir]))

when :ramaze
require "#{options[:chdir]}/start"

Ramaze.trait[:essentials].delete Ramaze::Adapter
Ramaze.start :force => true

Ramaze::Adapter::Base
return Ramaze::Adapter::Base

# FIXME not working, halp! halp!
# when :merb
# require 'merb'
# require "#{options[:chdir]}/config/init.rb"
# Merb::BootLoader.run
# Merb::Rack::Application.new
when :merb
require 'merb-core'

Merb::Config.setup(:merb_root => options[:chdir],
:environment => options[:environment])
Merb.environment = Merb::Config[:environment]
Merb.root = Merb::Config[:merb_root]
Merb::BootLoader.run

return Merb::Rack::Application.new

when :halcyon
require 'halcyon'

$:.unshift(Halcyon.root/'lib')
Halcyon::Runner.load_config Halcyon.root/'config'/'config.yml'
Halcyon::Runner.new

return Halcyon::Runner.new

else
raise AdapterNotFound, "Adapter not found: #{name}"
Expand Down

0 comments on commit 0284f81

Please sign in to comment.