Fix paths to model and archive

This commit is contained in:
Eryn Wells 2015-05-17 19:10:27 -07:00
parent 1af45f8dbc
commit 7d6f4449a6

15
bots.rb
View file

@ -32,6 +32,9 @@ class ERWEbooksBot < Ebooks::Bot
def top20; @top20 ||= model.keywords.take(20); end def top20; @top20 ||= model.keywords.take(20); end
def on_startup def on_startup
@model_path ||= "model/#{original}.model"
@archive_path = "model/#{original}.json"
archive! archive!
load_model! load_model!
@ -128,17 +131,15 @@ class ERWEbooksBot < Ebooks::Bot
private private
def load_model! def load_model!
@model_path ||= "model/#{original}.model" log "Loading model #{@model_path}"
log "Loading model #{model_path}" @model = Ebooks::Model.load(@model_path)
@model = Ebooks::Model.load(model_path)
end end
private private
def archive! def archive!
archive_path = "model/#{original}.json" log "Archiving tweets #{@archive_path}"
log "Archiving tweets #{archive_path}" Ebooks::Archive.new(@original, @archive_path).sync
Ebooks::Archive.new(@original, archive_path).sync Ebooks::Model.consume(@archive_path).save(@model_path)
Ebooks::Model.consume(archive_path).save(model_path)
end end
end end