Class: Gemstash::CLI::Authorize

Inherits:
Base
  • Object
show all
Defined in:
lib/gemstash/cli/authorize.rb

Overview

This implements the command line authorize task to authorize users:

$ gemstash authorize authorized-key

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Gemstash::CLI::Base

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/gemstash/cli/authorize.rb', line 12

def run
  prepare
  setup_logging

  # Catch invalid option combinations
  raise Gemstash::CLI::Error.new(@cli, "--remove and --list cannot both be used") if @cli.options[:remove] && @cli.options[:list]

  if @cli.options[:remove]
    remove_authorization
  elsif @cli.options[:list]
    list_authorizations
  else
    save_authorization
  end
end