Sha256: a951ce56f8e977e884cb4b85c218361eeff1b70dd3fa5517f1a39f56a1a74eeb

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

#
# remover.rb - remove contents from gonzui.db
#
# Copyright (C) 2004-2005 Satoru Takabayashi <satoru@namazu.org> 
#     All rights reserved.
#     This is free software with ABSOLUTELY NO WARRANTY.
#
# You can redistribute it and/or modify it under the terms of 
# the GNU General Public License version 2.
#

module Gonzui
  class RemoverError < GonzuiError; end

  class Remover < AbstractUpdater
    private
    def do_task_name
      "removed"
    end

    public
    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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gonzui-1.2-x86-mswin32-60 lib/gonzui/remover.rb
gonzui-1.2 lib/gonzui/remover.rb