class Bundler::RubygemsIntegration

def spec_from_gem(path, policy = nil)

def spec_from_gem(path, policy = nil)
  require 'rubygems/security'
  gem_from_path(path, security_policies[policy]).spec
rescue Gem::Package::FormatError
  raise GemspecError, "Could not read gem at #{path}. It may be corrupted."
rescue Exception, Gem::Exception, Gem::Security::Exception => e
  if e.is_a?(Gem::Security::Exception) ||
      e.message =~ /unknown trust policy|unsigned gem/i ||
      e.message =~ /couldn't verify (meta)?data signature/i
    raise SecurityError,
      "The gem #{File.basename(path, '.gem')} can't be installed because " \
      "the security policy didn't allow it, with the message: #{e.message}"
  else
    raise e
  end
end