Class: Herve::CLI::RubyCommands::Uninstall

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/herve/cli/ruby_commands/uninstall.rb

Instance Attribute Summary

Attributes inherited from BaseCommand

#config, #logger

Instance Method Summary collapse

Methods inherited from BaseCommand

inherited

Instance Method Details

#call(version:, **options) ⇒ Object

Raises:



13
14
15
16
17
18
19
20
21
22
# File 'lib/herve/cli/ruby_commands/uninstall.rb', line 13

def call(version:, **options)
  install_dir = Herve.expand_path(options[:install_dir])
  raise ConfigError, "install_dir does not exist" unless File.directory?(install_dir)

  config.ruby_dirs = [install_dir] unless install_dir.nil?
  ruby = RubyCommands.find_ruby(config, version)
  raise RubyError, "no matching ruby" if ruby.nil?

  uninstall_ruby(ruby)
end