You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
amarok/amarok/src/mediadevice/daap/mongrel/lib/rubygems/gem_openssl.rb

47 lines
1.1 KiB

#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++
# Some system might not have OpenSSL installed, therefore the core
# library file openssl might not be available. We localize testing
# for the presence of OpenSSL in this file.
module Gem
class << self
# Is SSL (used by the signing commands) available on this
# platform?
def ssl_available?
require 'rubygems/gem_openssl'
@ssl_available
end
# Set the value of the ssl_avilable flag.
attr_writer :ssl_available
# Ensure that SSL is available. Throw an exception if it is not.
def ensure_ssl_available
unless ssl_available?
fail Gem::Exception, "SSL is not installed on this system"
end
end
end
end
begin
require 'openssl'
# Reference a constant defined in the .rb portion of ssl (just to
# make sure that part is loaded too).
dummy = OpenSSL::Digest::SHA1
Gem.ssl_available = true
rescue LoadError
Gem.ssl_available = false
rescue
Gem.ssl_available = false
end