diff --git a/lib/petrify.rb b/lib/petrify.rb index 4f05d01..a295f57 100644 --- a/lib/petrify.rb +++ b/lib/petrify.rb @@ -12,7 +12,7 @@ class Petrify @@log = Logger.new($stdout) @@log.level = Logger::INFO - def self.write_page(path_items, template, locals = {}) + def self.page(path_items, template, locals = {}) dir = create_path(path_items) fn = File.join(dir, 'index.html') @@ -27,7 +27,7 @@ class Petrify # https://support.google.com/webmasters/answer/183668?hl=en&ref_topic=4581190 end - def self.write_csv(path_items, filename, data) + def self.csv(path_items, filename, data) dir = create_path(path_items) fn = File.join(dir, filename + '.csv') diff --git a/lib/site.rb b/lib/site.rb index 0a104cb..eaecd91 100644 --- a/lib/site.rb +++ b/lib/site.rb @@ -8,18 +8,18 @@ class Site from applications group by authority_name, status, decision, appeal_status, appeal_decision ") - Petrify.write_page('.', 'index', { summary: summary }) + Petrify.page('.', 'index', { summary: summary }) # Summary CSV file - Petrify.write_csv('.', 'inlink-summary', summary) + Petrify.csv('.', 'inlink-summary', summary) # New applications page apps = ScraperWiki.select("* from `applications` order by date_received desc limit 30") - Petrify.write_page('new-applications', 'new-applications', { apps: apps }) + Petrify.page('new-applications', 'new-applications', { apps: apps }) # Latest decisions page apps = ScraperWiki.select("* from `applications` order by date_decision desc limit 30") - Petrify.write_page('decisions', 'decisions', { apps: apps }) + Petrify.page('decisions', 'decisions', { apps: apps }) # Page and CSV file for each authority auths = ScraperWiki.select("distinct(authority_name) as authority_name from applications") @@ -34,8 +34,8 @@ class Site apps = ScraperWiki.select("* from applications where authority_name = ? order by date_received", auth['authority_name']) path = ['authorities', slug(auth['authority_name'])] - Petrify.write_page(path, 'authority', { apps: apps, auth: auth, summary: summary }) - Petrify.write_csv(path, slug(auth['authority_name']), apps) + Petrify.page(path, 'authority', { apps: apps, auth: auth, summary: summary }) + Petrify.csv(path, slug(auth['authority_name']), apps) end end end