Преглед на файлове

Simplify write_page and write_csv method names

main
Adrian Short преди 6 години
родител
ревизия
c2f8851d74
променени са 2 файла, в които са добавени 8 реда и са изтрити 8 реда
  1. +2
    -2
      lib/petrify.rb
  2. +6
    -6
      lib/site.rb

+ 2
- 2
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')


+ 6
- 6
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

Зареждане…
Отказ
Запис