class Rigit::Commands::Uninstall::UninstallHandler
Internal class to handle rig removal for the {CommandLine} class.
Attributes
args[R]
rig_name[R]
Public Class Methods
new(args)
click to toggle source
# File lib/rigit/commands/uninstall.rb, line 16 def initialize(args) @args = args @rig_name = args['RIG'] end
Public Instance Methods
execute()
click to toggle source
# File lib/rigit/commands/uninstall.rb, line 21 def execute verify_dirs uninstall end
Private Instance Methods
rig()
click to toggle source
# File lib/rigit/commands/uninstall.rb, line 47 def rig @rig ||= Rigit::Rig.new rig_name end
target_path()
click to toggle source
# File lib/rigit/commands/uninstall.rb, line 51 def target_path @target_path ||= rig.path end
tty_prompt()
click to toggle source
# File lib/rigit/commands/uninstall.rb, line 55 def tty_prompt @tty_prompt ||= TTY::Prompt.new end
uninstall()
click to toggle source
# File lib/rigit/commands/uninstall.rb, line 28 def uninstall say "This will remove !txtgrn!#{rig_name}!txtrst! and delete\n#{target_path}" continue = tty_prompt.yes? "Continue?", default: false uninstall! if continue end
uninstall!()
click to toggle source
# File lib/rigit/commands/uninstall.rb, line 34 def uninstall! say "Uninstalling !txtgrn!#{rig_name}" success = FileUtils.rm_rf target_path if success say "Rig uninstalled !txtgrn!successfully" else # :nocov: say "!txtred!Uninstall failed" # :nocov: end end
verify_dirs()
click to toggle source
# File lib/rigit/commands/uninstall.rb, line 59 def verify_dirs if !rig.exist? say "Rig !txtgrn!#{rig_name}!txtrst! is not installed" raise Rigit::Exit end end