Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added populate Rake task and updated README.
- Loading branch information
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |