Class: Gem::Commands::VerifyCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::VerifyCommand
- Includes:
- UserInteraction, VersionOption
- Defined in:
- lib/rubygems/commands/verify_command.rb
Overview
Verifies a gem signed by the ‘sign’ command. Iterates through the gem contents and verifies all embedded files, if possible. Errors out if the signature is bad or the key is unknown.
Optionally takes “–get-key” which automatically retreives the key from keyservers to make things easier for people unfamiliar with gpg.
Instance Method Summary collapse
-
#arguments ⇒ Object
:nodoc:.
-
#defaults_str ⇒ Object
:nodoc:.
-
#execute ⇒ Object
:nodoc:.
-
#initialize ⇒ VerifyCommand
constructor
:nodoc:.
-
#usage ⇒ Object
:nodoc:.
Constructor Details
#initialize ⇒ VerifyCommand
:nodoc:
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rubygems/commands/verify_command.rb', line 18 def initialize # :nodoc: super 'verify', 'Verifies a local gem that has been signed via OpenPGP. This helps to ensure the gem has not been tampered with in transit.' add_version_option add_option('--get-key', "If the key is not available, download it from a keyserver") do |key, | [:get_key] = true end add_option("--trust", 'Enforce gnupg trust settings. Only install if trusted.') do |value, | Gem::OpenPGP.[:trust] = true end add_option("--no-trust", "Ignoure gnupg trust settings, even if --trust has previously been specified") do |value, | Gem::OpenPGP.[:no_trust] = true end end |
Instance Method Details
#arguments ⇒ Object
:nodoc:
39 40 41 |
# File 'lib/rubygems/commands/verify_command.rb', line 39 def arguments # :nodoc: "GEMNAME name of gem to verify" end |
#defaults_str ⇒ Object
:nodoc:
43 44 45 |
# File 'lib/rubygems/commands/verify_command.rb', line 43 def defaults_str # :nodoc: "" end |
#execute ⇒ Object
:nodoc:
51 52 53 54 55 56 57 58 |
# File 'lib/rubygems/commands/verify_command.rb', line 51 def execute # :nodoc: version = [:version] || Gem::Requirement.default gem, specs = get_one_gem_name, [] Gem::OpenPGP.verify_gem gem, get_key=[:get_key] rescue Gem::OpenPGPException => ex alert_error(ex.) terminate_interaction(1) end |
#usage ⇒ Object
:nodoc:
47 48 49 |
# File 'lib/rubygems/commands/verify_command.rb', line 47 def usage # :nodoc: "gem verify GEMNAME" end |