Permalink
Browse files

Seed data (old stories).

  • Loading branch information...
1 parent 9f84591 commit e24f88c2e0a1a5043e8a159e3c81a17df546d1f3 @spraints committed Feb 18, 2011
@@ -0,0 +1,18 @@
+- @date = 'July 2010'
+.left.column
+ .story
+ %h4 New family moves in
+ %p A new family moved into Ed Storms's old house. Welcome them to town!
+.middle.column
+ .story
+ %h4 Working hard
+ %p We'll have more news for y'all later.
+.right.column
+ .story
+ %h3 Weather
+ %p The rain seems to have let up.
+ .story
+ %h3 Crops
+ %p The corn is tall.
+ %p The soybeans are bushy.
+ %p Soybeans have been replanted in the low areas.
@@ -0,0 +1,14 @@
+- @date = 'August 2010'
+.left.column
+ .story
+ %h4 Hogs
+ %p They squeal. They stink. The residents of Pickard (and its environs) have noted that the air is much more pleasant with a westerly breeze. Sorry, Tipton County, we'd prefer to be up-wind.
+.middle.column
+ .story
+ %h4 Remarkably slow to update
+ %p The Pickard Ayune staff humbly apologizes for failing to produce the August issue in a timely manner.
+.right.column
+ .story
+ %h4 Traffic
+ %p On the 20th, three cars were seen at the Pickard intersection. One had a trailer, and waited for the others to move out of the intersection.
+ %p Fortunately, they quickly went their different ways, clearing the unusual congestion.
@@ -0,0 +1,24 @@
+- @date = 'September 2010'
+.left.column
+ .story
+ %h4 September!
+ %p I can't believe it's September already.
+ %p Growing up in the city, September meant that fall was definitely here.
+ %p Living on a farm now, I am adjusting to the realization that September is the second peak month of the summer.
+.middle.column
+ .story
+ %h4 Crops
+ %p The row crops are changing colors.
+ %p Fall plantings of vegetables are in the ground.
+ %p Veggies want rain. I don't know what the row crops want.
+.right.column
+ .story
+ %h4 Weather
+ %p It's dry. After a 3x June (rainwise), we just had a 0.5x August.
+ %p There are wild and crazy predictions of rain.
+ %p Cooler temperatures hint at autumn.
+ %p The days are shorter, so get those lights on in your chicken houses!
+ .story
+ %h4 Electric Fence Report
+ %p Matt was zapped while carrying the chicken water lid in one hand and the chicken water fountain in the other. The lid hit the fence, and he was curious what the twitching was. Then he set the fountain down, and twitched violently enough to drop the lid.
+ %p Lisa was zapped while turning on the drip irrigation. She made herself a conductor, with her head on the fence wire. If she acts a little funny in the beginning of September, blame the jolt!
@@ -0,0 +1,17 @@
+- @date = 'October 2010'
+.left.column
+ .story
+ %h3 Happy Halloween!
+ %p Trick-or-treating? in Pickard?
+ %p You never know!
+ %p You never not!
+.middle.column
+ .story
+ %h3 Harvest time
+ %p ... is almost done.
+ %p Unlike last year's snowy harvest conclusion, this year the corn and beans got taken away during our dry dry dry September.
+ .story
+ %h3 Weather
+ %p Fall is hinting at its arrival.
+ %p Will we have frost in the first week?
+.right.column
@@ -0,0 +1,19 @@
+- @date = 'November 2010'
+.left.column
+ .story
+ %h3 Happy thanksgiving!
+ %p Please take time to be thankful and to reflect on the blessings in your life.
+.middle.column
+ .story
+ %h3 Reviews
+ %p We've started doing reviews over at <a href="http://www.urbanspoon.com/u/profile/963940/Pickard_Ayune.html">urbanspoon</a>.
+ %p In Sheridan, we thought <a href="http://www.urbanspoon.com/r/40/1505270/restaurant/Indianapolis/Stuarts-Steak-House-Sheridan">Stuart's Steakhouse</a> was OK and <a href="http://www.urbanspoon.com/r/40/990538/restaurant/Indianapolis/Midwest-Grill-Sheridan">Midwest Grill</a> was better than we expected.
+ %p In Kokomo, we like visiting <a href="http://www.urbanspoon.com/r/172/986148/restaurant/Indiana/Windmill-Grill-Kokomo">Windmill Grill</a>.
+ %p In Zionsville, the place to go (if you have the time and money) is <a href="http://www.urbanspoon.com/r/40/442044/restaurant/Indianapolis/Plums-Upper-Room-Zionsville">Plum's Upper Room</a>.
+ %p This isn't a complete list of places we've been. Keep your eye out for more reviews!
+.right.column
+ .story
+ %h3 Weather
+ %p November came in with a little snow on 5-Nov.
+ %p How much snow will we get?
+ %p Tweet your thoughts with #pickardayune
@@ -0,0 +1,7 @@
+- @date = 'Februrary 2011'
+.left.column
+ .story
+ %h3 Snow
+ %p In case you haven't heard, February is coming in like a blizzard.
+.middle.column
+.right.column
View
@@ -1,7 +1,33 @@
-# This file should contain all the record creation needed to seed the database with its default values.
-# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
-#
-# Examples:
-#
-# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
-# Mayor.create(:name => 'Daley', :city => cities.first)
+puts "Creating an admin account for @spraints"
+Omnisocial::TwitterAccount.create! :remote_account_id => 14919968,
+ :user_id => User.create!(:role => 'admin')
+puts "Creating an admin account for @farmingengineer"
+Omnisocial::TwitterAccount.create! :remote_account_id => 27855975,
+ :user_id => User.create!(:role => 'admin')
+
+(Rails.root + 'db/seed/old_stories').children.select{|x| x.file?}.each do |file|
+ edition = file.basename('.haml').to_s
+ puts "Loading #{edition}..."
+ current_story = nil
+ current_column = nil
+ file.each_line do |line|
+ case line
+ when /@date\s*=/
+ #ignore
+ when /\.(.*)\.column/
+ current_column = $1
+ current_story.save! if current_story
+ current_story = nil
+ when /\.story/
+ current_story.save! if current_story
+ current_story = Story.new :edition => edition, :column => current_column
+ when /%h[34] (.*)/
+ current_story.title = $1.strip
+ when /%p (.*)/
+ (current_story.paragraphs ||= []) << $1.strip
+ else
+ puts "UNHANDLED: #{line.strip}"
+ end
+ end
+ current_story.save! if current_story
+end

0 comments on commit e24f88c

Please sign in to comment.