require 'series'
class Store
+ @@BASEPATH = '/arc/quanlib' # TODO: FIXME: configure this in a sane way
+ @@UNCLASSIFIED_CSV = @@BASEPATH + '/unclassified.csv'
+
+ def self.unclassified_csv
+ @@UNCLASSIFIED_CSV
+ end
+
def initialize
- @basepath = '/arc/quanlib' # TODO: FIXME: configure this in a sane way
@conn = nil
#@dburl = 'dbi:Pg:quanlib:localhost'
(efspath, efsname) = construct_efs_path(id)
- fullpath = @basepath + '/efs/' + efspath + '/' + efsname
+ fullpath = @@BASEPATH + '/efs/' + efspath + '/' + efsname
return Cover.new(nil, fullpath, mime_type)
(efspath, efsname) = construct_efs_path(efs_id)
- efspath = @basepath + '/efs/' + efspath
+ efspath = @@BASEPATH + '/efs/' + efspath
FileUtils.mkdir_p(efspath)
def populate_classifications_table
puts "Populating the Classifications table..."
first = true
- CSV.foreach(@basepath + '/csv/class.csv') do |row|
+ CSV.foreach(@@BASEPATH + '/csv/class.csv') do |row|
if first
# skip the header row
first = false
def populate_fast_table
puts "Populating the FAST table..."
first = true
- CSV.foreach(@basepath + '/csv/fast.csv') do |row|
+ CSV.foreach(@@BASEPATH + '/csv/fast.csv') do |row|
if first
first = false # skip the header row
else
def populate_series_table
puts "Populating the Series table..."
- CSV.foreach(@basepath + '/csv/series.csv') do |row|
+ CSV.foreach(@@BASEPATH + '/csv/series.csv') do |row|
id = next_id('series_id')
sqlInsert = "INSERT INTO Series (id, age, genre, grouping, code, descr) VALUES ($1, $2, $3, $4, $5, $6);"
args = [id] + row