Module: BBMB::Util::Updater

Defined in:
lib/bbmb/util/updater.rb

Class Method Summary collapse

Class Method Details

.import(importer, args, io) ⇒ Object



21
22
23
24
25
26
# File 'lib/bbmb/util/updater.rb', line 21

def Updater.import(importer, args, io)
  klass = Util.const_get(importer)
  SBSM.info("Updater.import using klass #{klass}")
  count = klass.new(*args).import(io)
  SBSM.info("updater #{importer.class} imported #{count.is_a?(Integer) ? count : 0} entities")
end

.runObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/bbmb/util/updater.rb', line 11

def Updater.run
  SBSM.info "Updated.run started at #{Time.now}"
  PollingManager.new.poll_sources do |filename, io|
    importer, *args = BBMB.config.importers[filename]
    SBSM.info "Updated.run filename #{File.expand_path(filename)} importer #{importer.class}"
    if(importer)
      import(importer, args, io)
    end
  end
end