Module: InstallGemLocal::RemoveGem

Included in:
Action
Defined in:
lib/install_gem_local/action/remove_gem.rb

Instance Method Summary collapse

Instance Method Details

#remove_file_from_path(file_name) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/install_gem_local/action/remove_gem.rb', line 18

def remove_file_from_path(file_name)
  return if file_name == 'exit'

  if file_name == 'all'
    tty_command.run('rm *.gem')
  else
    tty_command.run("rm #{file_name}")
  end
end

#remove_gemObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/install_gem_local/action/remove_gem.rb', line 5

def remove_gem
  puts ''
  puts 'Remove Gem'.red
  file_exists = file_names
  if file_exists.count > 1
    remove_file_from_path(multiple_version_selection(include_all: true))
  elsif file_exists.count == 1
    remove_file_from_path(file_exists.first)
  else
    ap 'Gem not exist'
  end
end