def activate_gem(gem_name, library_name = nil)
      if !defined?(::Gem)
        begin
          require 'rubygems'
        rescue LoadError
        end
      end
      if Kernel.respond_to?(:gem, true)
        begin
          gem(gem_name)
        rescue Gem::LoadError
        end
      end
      require(library_name || gem_name)
    end
def activate_gem(gem_name, library_name = nil)
      if !defined?(::Gem)
        begin
          require 'rubygems'
        rescue LoadError
        end
      end
      if Kernel.respond_to?(:gem, true)
        begin
          gem(gem_name)
        rescue Gem::LoadError
        end
      end
      require(library_name || gem_name)
    end
Activate a gem and require it. This method exists in order to load
 a library from RubyGems instead of from vendor_ruby. For example,
 on Debian systems, Rack may be installed from APT, but that is usually
 a very old version which we don't want. This method ensures that the
 RubyGems-installed version is loaded, not the the version in vendor_ruby.
 See the following threads for discussion:
 https://github.com/phusion/passenger/issues/1478
 https://github.com/phusion/passenger/issues/1480