Class: Gem::Commands::SignCommand

Inherits:
Gem::Command
  • Object
show all
Includes:
VersionOption
Defined in:
lib/rubygems/commands/sign_command.rb

Overview

CLI interface to the internal signing code:

gem sign gemname-0.0.0.gem

gem sign -key 0xDEADBEEF gemname-0.0.0.gem

Instance Method Summary collapse

Constructor Details

#initializeSignCommand

:nodoc:



16
17
18
19
20
21
22
23
24
# File 'lib/rubygems/commands/sign_command.rb', line 16

def initialize # :nodoc:
  super 'sign', 'Signs an existing gem with your OpenPGP key.  This allows third parties to verify the key later via the \'gem verify\' command.', :key => nil

  add_version_option

  add_option('--key KEY', "Specify key id if you don't want to use your default gpg key") do |key, options|
    options[:key] = key
  end
end

Instance Method Details

#argumentsObject

:nodoc:



26
27
28
# File 'lib/rubygems/commands/sign_command.rb', line 26

def arguments # :nodoc:
  "GEMNAME        name of gem to sign"
end

#defaults_strObject

:nodoc:



30
31
32
# File 'lib/rubygems/commands/sign_command.rb', line 30

def defaults_str # :nodoc:
  ""
end

#executeObject

:nodoc:



38
39
40
41
42
# File 'lib/rubygems/commands/sign_command.rb', line 38

def execute  # :nodoc:
  version = options[:version] || Gem::Requirement.default
  gem, specs = get_one_gem_name, []
  Gem::OpenPGP.sign_gem gem, key=options[:key]
end

#usageObject

:nodoc:



34
35
36
# File 'lib/rubygems/commands/sign_command.rb', line 34

def usage # :nodoc:
  "gem sign GEMNAME"
end