class Ruian

not a really queue

Constants

VERSION

Attributes

logger[RW]
fetcher[RW]
importer[RW]
queue[RW]

Public Class Methods

load_tasks() click to toggle source
# File lib/ruian.rb, line 22
def self.load_tasks
  Dir[File.join(File.dirname(__FILE__),'tasks/*.rake')].each { |f| load f }
end
new(importer = Ruian::Importer.new) click to toggle source
# File lib/ruian.rb, line 30
def initialize(importer = Ruian::Importer.new)
  self.fetcher = Ruian::Fetcher.new
  self.importer = importer
  self.queue = Ruian::Queue.new(importer)
end
root() click to toggle source
# File lib/ruian.rb, line 26
def self.root
  Pathname.new(File.expand_path('../', File.dirname(__FILE__)))
end

Public Instance Methods

all() click to toggle source
# File lib/ruian.rb, line 77
def all
  fetch_rows
  fetch_regions
  fetch_counties
  fetch_integrate_counties
  fetch_integrate_regions
  self.importer.finalize!
end
fetch_counties() click to toggle source
# File lib/ruian.rb, line 53
def fetch_counties
  bar = ProgressBar.create(total: 1,
                           title: 'Importing 1 county file.',
                           format: "%a |%b>>%i| %c/%C %p%% %t")

  self.fetcher.parse_counties(self.queue) { bar.increment }
end
fetch_integrate_counties() click to toggle source
# File lib/ruian.rb, line 61
def fetch_integrate_counties
  bar = ProgressBar.create(total: 1,
                           title: 'Importing 1 county integration file.',
                           format: "%a |%b>>%i| %c/%C %p%% %t")

  self.fetcher.parse_counties_integration(self.queue) { bar.increment }
end
fetch_integrate_regions() click to toggle source
# File lib/ruian.rb, line 69
def fetch_integrate_regions
  bar = ProgressBar.create(total: 1,
                           title: 'Importing 1 region integration file.',
                           format: "%a |%b>>%i| %c/%C %p%% %t")

  self.fetcher.parse_regions_integration(self.queue) { bar.increment }
end
fetch_regions() click to toggle source
# File lib/ruian.rb, line 45
def fetch_regions
  bar = ProgressBar.create(total: 1,
                           title: 'Importing 1 region file.',
                           format: "%a |%b>>%i| %c/%C %p%% %t")

  self.fetcher.parse_regions(self.queue) { bar.increment }
end
fetch_rows() click to toggle source
# File lib/ruian.rb, line 36
def fetch_rows
  count = fetcher.row_files.count
  bar = ProgressBar.create(total: count,
                           title: "Importing #{count} row files.",
                           format: "%a |%b>>%i| %c/%C %p%% %t")

  self.fetcher.parse_rows(self.queue) { bar.increment }
end