Skip to content

Commit

Permalink
Added populate Rake task and updated README.
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerhunt committed Apr 13, 2009
1 parent 2852854 commit aa0ad89
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.markdown
@@ -1,3 +1,21 @@
# BarCampLive

*A Simple BarCamp Scheduler*

Originally created for BarCampOrlando 2008, this scheduler provides a simple interface for BarCamp attendees to use during the event to check the schedule and see upcoming talks.


## Getting Started with BarCampLive

To create and populate the database, execute the following commands at the command line from within the app:

* `rake db:create`
* `rake db:schema:load`
* `rake populate:2009`

This will give you a nice starting point. The data set is from BarCampOrlando 2009, but the populate task should be easy enough to modify for your own events.

Next, start the development server and check out the app in your browser:

* `./script/server`
* `open http://localhost:3000/`
41 changes: 41 additions & 0 deletions lib/tasks/populate.rake
@@ -0,0 +1,41 @@
def venue(name)
Venue.create(:name => name)
end

def talks(venue, starts_at, ends_at, length=30.minutes)
while starts_at < ends_at do
venue.talks.create(:starts_at => starts_at, :ends_at => starts_at + length)
starts_at = starts_at + length
end
end

def topic(name, starts_at)
Talk.find_all_by_starts_at(starts_at).each do |venue|
venue.update_attributes(:topic => name)
end
end

namespace :populate do
desc "Populate the database with venues"
task '2009' => :environment do
date = Date.new(2009, 4, 18)

slingapours = venue("Slingapour's")
one_eyed_jacks = venue("One Eyed Jacks")
gibson_showroom = venue("Gibson Showroom")

talks(slingapours, date + 9.hours + 30.minutes, date + 13.hours)
talks(slingapours, date + 13.hours, date + 14.hours, 1.hour)
talks(slingapours, date + 14.hours, date + 16.hours)
talks(slingapours, date + 16.hours, date + 18.hours, 10.minutes)

[one_eyed_jacks, gibson_showroom].each do |venue|
talks(venue, date + 10.hours, date + 13.hours)
talks(venue, date + 13.hours, date + 14.hours, 1.hour)
talks(venue, date + 14.hours, date + 18.hours)
end

topic("Registration", date + 9.hours + 30.minutes)
topic("Lunch at The Globe", date + 13.hours)
end
end

0 comments on commit aa0ad89

Please sign in to comment.