Class: Gonzui::Importer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#initialize(config, options = {}) ⇒ Importer

Returns a new instance of Importer.



18
19
20
21
22
# File 'lib/gonzui/importer.rb', line 18

def initialize(config, options = {})
  super(config, options)
  # to be initialized
  @last_package_name = nil
end

Instance Attribute Details

#last_package_nameObject (readonly)

Returns the value of attribute last_package_name.



23
24
25
# File 'lib/gonzui/importer.rb', line 23

def last_package_name
  @last_package_name
end

Instance Method Details

#finishObject



80
81
82
# File 'lib/gonzui/importer.rb', line 80

def finish
  @dbm.close
end

#import(source_uri) ⇒ Object



62
63
64
65
66
67
68
69
# File 'lib/gonzui/importer.rb', line 62

def import(source_uri)
  fetcher = Fetcher.new(@config, source_uri)
  begin
    import_package(fetcher, source_uri)
  ensure
    fetcher.finish
  end
end

#summaryObject



71
72
73
74
75
76
77
78
# File 'lib/gonzui/importer.rb', line 71

def summary
  summary = super
  if @config.verbose
    stat = Indexer.statistics
    summary += "\n" + stat unless stat.empty?
  end
  return summary
end