Class: Bundler::SSLCerts::CertificateManager
- Inherits:
-
Object
- Object
- Bundler::SSLCerts::CertificateManager
- Defined in:
- lib/bundler/ssl_certs/certificate_manager.rb
Instance Attribute Summary collapse
-
#bundler_cert_path ⇒ Object
readonly
Returns the value of attribute bundler_cert_path.
-
#bundler_certs ⇒ Object
readonly
Returns the value of attribute bundler_certs.
-
#rubygems_certs ⇒ Object
readonly
Returns the value of attribute rubygems_certs.
Class Method Summary collapse
Instance Method Summary collapse
- #connect_to(host) ⇒ Object
-
#initialize(rubygems_path = nil) ⇒ CertificateManager
constructor
A new instance of CertificateManager.
- #up_to_date? ⇒ Boolean
- #update! ⇒ Object
Constructor Details
#initialize(rubygems_path = nil) ⇒ CertificateManager
Returns a new instance of CertificateManager.
16 17 18 19 20 21 22 23 24 |
# File 'lib/bundler/ssl_certs/certificate_manager.rb', line 16 def initialize(rubygems_path = nil) if rubygems_path rubygems_cert_path = File.join(rubygems_path, "lib/rubygems/ssl_certs") @rubygems_certs = certificates_in(rubygems_cert_path) end @bundler_cert_path = File.("..", __FILE__) @bundler_certs = certificates_in(bundler_cert_path) end |
Instance Attribute Details
#bundler_cert_path ⇒ Object (readonly)
Returns the value of attribute bundler_cert_path.
10 11 12 |
# File 'lib/bundler/ssl_certs/certificate_manager.rb', line 10 def bundler_cert_path @bundler_cert_path end |
#bundler_certs ⇒ Object (readonly)
Returns the value of attribute bundler_certs.
10 11 12 |
# File 'lib/bundler/ssl_certs/certificate_manager.rb', line 10 def bundler_certs @bundler_certs end |
#rubygems_certs ⇒ Object (readonly)
Returns the value of attribute rubygems_certs.
10 11 12 |
# File 'lib/bundler/ssl_certs/certificate_manager.rb', line 10 def rubygems_certs @rubygems_certs end |
Class Method Details
.update_from!(rubygems_path) ⇒ Object
12 13 14 |
# File 'lib/bundler/ssl_certs/certificate_manager.rb', line 12 def self.update_from!(rubygems_path) new(rubygems_path).update! end |
Instance Method Details
#connect_to(host) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/bundler/ssl_certs/certificate_manager.rb', line 41 def connect_to(host) http = Net::HTTP.new(host, 443) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_PEER http.cert_store = store http.head("/") end |
#up_to_date? ⇒ Boolean
26 27 28 29 30 31 32 |
# File 'lib/bundler/ssl_certs/certificate_manager.rb', line 26 def up_to_date? rubygems_certs.all? do |rc| bundler_certs.find do |bc| File.basename(bc) == File.basename(rc) && FileUtils.compare_file(bc, rc) end end end |