Class: Gemvault::CLI::Commands::Remove

Inherits:
Gemvault::CLI::Command show all
Defined in:
lib/gemvault/cli/commands/remove.rb

Overview

gemvault remove subcommand. Parses argv into a GemReference and asks the vault to remove matching gems.

Instance Method Summary collapse

Instance Method Details

#run(vault, name, positional_version = nil) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/gemvault/cli/commands/remove.rb', line 28

def run(vault, name, positional_version = nil)
  begin
    version = options[:version] || positional_version
    reference = Gemvault::GemReference.parse(name, version:)
    remove_matching(vault:, reference:)
  rescue Gemvault::GemReference::NonExactVersionError => e
    print_error(e.message)
    exit(1)
  end
end