Module: Mongrel::Gems

Defined in:
lib/mongrel/gems.rb

Class Method Summary collapse

Class Method Details

.require(library, version = nil) ⇒ Object


5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/mongrel/gems.rb', line 5

def require(library, version = nil)
  begin
    Kernel.require library
  rescue LoadError, RuntimeError => e
    begin 
      # ActiveSupport breaks 'require' by making it always return a true value
      Kernel.require 'rubygems'
      version ? gem(library, version) : gem(library)
      retry
    rescue Gem::LoadError, LoadError, RuntimeError
      # puts "** #{library.inspect} could not be loaded" unless library == "mongrel_experimental"
    end
  end  
end