blob: 3e25b1dc9e35d979324808adda76dbcd2866b31e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#!/usr/bin/env ruby
#
# Run with reils runner like this:
#
# RAILS_ENV=production rails runner script/year-review.rb
#
# Thie ensures it runs in the context of the application.
def normalize(t)
t.gsub("'", '"')
end
cat = Refinery::Blog::Category.where(:title => "Omtaler").first
start_date = Date.new(Date.today.year, 01, 01)
posts = cat.posts.where("published_at > :date", { :date => start_date })
posts.each do |p|
puts "'#{normalize(p.title)}', #{p.published_at}, #{p.author.username}, http://heavymetal.no/blog/posts/#{p.slug}"
end
|