Froze rails gems
[depot.git] / vendor / rails / activesupport / lib / active_support / core_ext / kernel / requires.rb
1 module Kernel
2 # Require a library with fallback to RubyGems. Warnings during library
3 # loading are silenced to increase signal/noise for application warnings.
4 def require_library_or_gem(library_name)
5 silence_warnings do
6 begin
7 require library_name
8 rescue LoadError => cannot_require
9 # 1. Requiring the module is unsuccessful, maybe it's a gem and nobody required rubygems yet. Try.
10 begin
11 require 'rubygems'
12 rescue LoadError => rubygems_not_installed
13 raise cannot_require
14 end
15 # 2. Rubygems is installed and loaded. Try to load the library again
16 begin
17 require library_name
18 rescue LoadError => gem_not_installed
19 raise cannot_require
20 end
21 end
22 end
23 end
24 end