Class: Gonzui::Remover

Inherits:
AbstractUpdater show all
Defined in:
lib/gonzui/remover.rb

Instance Method Summary collapse

Methods inherited from AbstractUpdater

#finish, #initialize, #summary

Methods included from Util

assert, assert_equal, assert_equal_all, assert_non_nil, assert_not_reached, benchmark, command_exist?, commify, eprintf, format_bytes, program_name, protect_from_signals, require_command, set_verbosity, shell_escape, unix?, vprintf, windows?, wprintf

Constructor Details

This class inherits a constructor from Gonzui::AbstractUpdater

Instance Method Details

#remove_package(package_name) ⇒ Object

Raises:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/gonzui/remover.rb', line 22

def remove_package(package_name)
  raise RemoverError.new("#{package_name}: package not found") unless
    @dbm.has_package?(package_name)
  ncontents = @dbm.get_ncontents_in_package(package_name)

  pbar = make_progress_bar(package_name, ncontents)
  package_id = @dbm.get_package_id(package_name)
  @dbm.get_path_ids(package_id).each {|path_id|
    normalized_path = @dbm.get_path(path_id)
    deindex_content(normalized_path)
    pbar.inc
  }
  pbar.finish
  @npackages += 1
end