Class: Google::Cloud::Gemserver::Backend::Key
- Inherits:
-
Object
- Object
- Google::Cloud::Gemserver::Backend::Key
- Defined in:
- lib/google/cloud/gemserver/backend/key.rb
Overview
Key
Manages the creation and deletion of a key used to push gems to the gemserver and download them.
Constant Summary collapse
- MAPPING =
A mapping from gemserver permissions to gemstash permissions.
{ "write" => %w[push yank], "read" => %w[fetch] }.freeze
- ALL =
Aliases for read and write permissions.
["both", "all", "", nil].freeze
- GEM_CREDS =
Path to the credentials file checked when pushing gems to the gem server (or any endpoint).
File.("~/.gem")
- KEY_LENGTH =
The length of a key generated by gemstash.
32
Class Method Summary collapse
-
.create_key(permissions = nil) ⇒ String
Creates a key with given permissions.
-
.delete_key(key) ⇒ Object
Deletes a given key.
Class Method Details
.create_key(permissions = nil) ⇒ String
Creates a key with given permissions.
57 58 59 60 61 62 63 64 |
# File 'lib/google/cloud/gemserver/backend/key.rb', line 57 def self.create_key = nil mapped = map_perms args = base_args.concat mapped output = capture_stdout { GemstashServer.start args } key = parse_key(output) puts "Created key: #{key}" key end |
.delete_key(key) ⇒ Object
Deletes a given key.
70 71 72 73 74 75 76 77 78 |
# File 'lib/google/cloud/gemserver/backend/key.rb', line 70 def self.delete_key key args = [ "--remove", "--key=#{key}" ] GemstashServer.start base_args.concat(args) puts "Deleted key: #{key}" true end |