Gem::Command
Gem command to display the certificate of a gem, if any.
# File lib/rubygems/commands/checkcert_command.rb, line 17
17: def initialize
18: super("checkcert", "Display the certificate of a gem's signature, if any.",
19: :domain => :local, :version => Gem::Requirement.default)
20:
21: add_version_option
22: add_local_remote_options
23: end
# File lib/rubygems/commands/checkcert_command.rb, line 37
37: def check_certificate
38: gem, specs = get_one_gem_name, []
39:
40: dep = Gem::Dependency.new gem, options[:version]
41:
42: if local? then
43: if File.exist? gem then
44: specs << Gem::Format.from_file_by_path(gem).spec # rescue nil
45: end
46:
47: specs.push(*Gem.source_index.search(dep)) if specs.empty?
48: end
49:
50: if remote? then
51: abort "rubygems sucks and doesn't include the cert info..."
52: end
53:
54: if specs.empty? then
55: alert_error "Unknown gem '#{gem}'"
56: terminate_interaction 1
57: end
58:
59: spec = specs.last
60: cert = spec.cert_chain.join
61:
62: unless cert.empty? then
63: IO.popen("openssl x509 -noout -text", "w+") do |io|
64: io.puts cert
65: puts io.read
66: end
67: else
68: alert_error "Gem '#{gem}' is not signed"
69: terminate_interaction 1
70: end
71: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.