Permalink
Browse files

add --delete options; add more builtin fixtures

  • Loading branch information...
1 parent 2c63e9a commit dcb9df53d897733f126d147d96a850223716674c @geraldb geraldb committed Oct 7, 2012
View
@@ -7,7 +7,7 @@ A Free Open Sports Database & Schema
Get a copy of the `sport.db` file. That's it.
-## Example events include:
+## Events include:
* [UEFA Champions League 2012/13](https://github.com/geraldb/sport.db/tree/master/db/cl)
* [UEFA Europa League 2011/12](https://github.com/geraldb/sport.db/tree/master/db/cl)
@@ -21,7 +21,7 @@ Get a copy of the `sport.db` file. That's it.
## Demo
-Try the `sport.db` Web Admin demo install running
+Try the `sport.db` Web Admin demo running
on Heroku [`sportdbdemo.herokuapp.com`](http://sportdbdemo.herokuapp.com).
@@ -74,13 +74,12 @@ The `sport.db` includes the following tables:
sportdb -c # create database schema
-See the [`sportdb` documentation](https://github.com/geraldb/sport.db/tree/master/script) for more.
+See the [`sportdb` command line tool documentation](https://github.com/geraldb/sport.db/tree/master/script) for more.
## Build Your Own `sport.db` Version
-Step 1: Use the `sportdb` command line tool to create an empty database, that is, `sport.db`.
-Issue the command:
+Step 1: Create an empty database, that is, `sport.db`. Issue the command:
sportdb --create
View
@@ -1,3 +1,11 @@
+### 0.3.0 / 2012-10-07
+
+* Add --delete option to delete all records
+
+### 0.2.0 / 2012-10-06
+
+* Add --load option for builtin fixtures
+
### 0.1.0 / 2012-10-06
* Everything is new. First release
View
@@ -3,12 +3,19 @@ Manifest.txt
README.markdown
Rakefile
bin/sportdb
+db/at/2011_12/bl.rb
+db/at/2011_12/cup.rb
+db/at/2012_13/bl.rb
+db/at/2012_13/cup.rb
+db/at/teams.rb
db/cl/2011_12/cl.rb
db/cl/2011_12/el.rb
db/cl/2012_13/cl.rb
db/cl/teams.rb
db/euro/2012.rb
db/euro/teams.rb
+db/mx/apertura_2012.rb
+db/mx/teams.rb
db/world/quali_2012_13.rb
lib/sportdb.rb
lib/sportdb/cli/opts.rb
View
@@ -0,0 +1,123 @@
+# encoding: utf-8
+
+# note: timezone for games (play_at) is *always* CET (central european time)
+
+
+######################################
+## Oesterreichische Bundesliga 2011/12
+##
+## more info => http://bundesliga.at
+
+bl = Event.create!( :key => 'at_bl_2011_12',
+ :title => 'Österr. Bundesliga 2011/12',
+ :start_at => Time.cet('2012-04-07 00:00') )
+
+salzburg = Team.find_by_key!( 'salzburg' )
+rapid = Team.find_by_key!( 'rapid' )
+admira = Team.find_by_key!( 'admira' )
+austria = Team.find_by_key!( 'austria' )
+sturm = Team.find_by_key!( 'sturm' )
+ried = Team.find_by_key!( 'ried' )
+wacker = Team.find_by_key!( 'wacker' )
+mattersburg = Team.find_by_key!( 'mattersburg' )
+neustadt = Team.find_by_key!( 'neustadt' )
+ksv = Team.find_by_key!( 'ksv' )
+
+bl.teams << salzburg
+bl.teams << rapid
+bl.teams << admira
+bl.teams << austria
+bl.teams << sturm
+bl.teams << ried
+bl.teams << wacker
+bl.teams << mattersburg
+bl.teams << neustadt
+bl.teams << ksv
+
+
+bl29 = Round.create!( :event => bl, :pos => 29, :title => '29. Runde', :title2 => '7.+8. April 2012' )
+bl30 = Round.create!( :event => bl, :pos => 30, :title => '30. Runde', :title2 => '14.+15. April 2012' )
+bl31 = Round.create!( :event => bl, :pos => 31, :title => '31. Runde', :title2 => '21.+22. April 2012' )
+bl32 = Round.create!( :event => bl, :pos => 32, :title => '32. Runde', :title2 => '28.+29. April 2012' )
+bl33 = Round.create!( :event => bl, :pos => 33, :title => '33. Runde', :title2 => '5. Mai 2012' )
+bl34 = Round.create!( :event => bl, :pos => 34, :title => '34. Runde', :title2 => '10. Mai 2012' )
+bl35 = Round.create!( :event => bl, :pos => 35, :title => '35. Runde', :title2 => '13. Mai 2012' )
+bl36 = Round.create!( :event => bl, :pos => 36, :title => '36. Runde', :title2 => '17. Mai 2012' )
+
+
+games_bl29 = [
+ [ 1, salzburg, [2, 0], wacker, Time.cet('2012-04-07 16:00') ],
+ [ 2, ried, [0, 1], austria, Time.cet('2012-04-07 18:30') ],
+ [ 3, ksv, [2, 3], admira, Time.cet('2012-04-07 18:30') ],
+ [ 4, rapid, [2, 1], neustadt, Time.cet('2012-04-07 18:30') ],
+ [ 5, mattersburg, [0, 2], sturm, Time.cet('2012-04-08 16:00') ]
+]
+
+games_bl30 = [
+ [ 1, neustadt, [0, 0], ksv, Time.cet('2012-04-14 16:00') ],
+ [ 2, admira, [1, 1], wacker, Time.cet('2012-04-14 18:30') ],
+ [ 3, sturm, [2, 2], salzburg, Time.cet('2012-04-14 18:30') ],
+ [ 4, ried, [2, 0], mattersburg, Time.cet('2012-04-14 18:30') ],
+ [ 5, austria, [0, 0], rapid, Time.cet('2012-04-15 16:00') ]
+]
+
+games_bl31 = [
+ [ 1, wacker, [2, 0], neustadt, Time.cet('2012-04-21 16:00') ],
+ [ 2, ksv, [1, 0], austria, Time.cet('2012-04-21 18:30') ],
+ [ 3, mattersburg, [1, 2], admira, Time.cet('2012-04-21 18:30') ],
+ [ 4, salzburg, [2, 0], ried, Time.cet('2012-04-21 18:30') ],
+ [ 5, rapid, [1, 1], sturm, Time.cet('2012-04-22 16:00') ]
+]
+
+games_bl32 = [
+ [ 1, austria, [3, 0], wacker, Time.cet('2012-04-28 16:00') ],
+ [ 2, neustadt, [1, 4], admira, Time.cet('2012-04-28 18:30') ],
+ [ 3, mattersburg, [0, 1], salzburg, Time.cet('2012-04-28 18:30') ],
+ [ 4, sturm, [2, 1], ksv, Time.cet('2012-04-28 18:30') ],
+ [ 5, ried, [2, 3], rapid, Time.cet('2012-04-29 16:00') ]
+]
+
+games_bl33 = [
+ [ 1, neustadt, [0, 0], sturm, Time.cet('2012-05-05 16:00') ],
+ [ 2, admira, [3, 2], austria, Time.cet('2012-05-05 18:30') ],
+ [ 3, ksv, [0, 0], ried, Time.cet('2012-05-05 18:30') ],
+ [ 4, wacker, [3, 6], mattersburg, Time.cet('2012-05-05 18:30') ],
+ [ 5, rapid, [0, 1], salzburg, Time.cet('2012-05-06 16:00') ]
+]
+
+games_bl34 = [
+ [ 1, salzburg, [2, 0], ksv, Time.cet('2012-05-10 18:30') ],
+ [ 2, austria, [3, 1], neustadt, Time.cet('2012-05-10 20:30') ],
+ [ 3, ried, [1, 1], wacker, Time.cet('2012-05-10 20:30') ],
+ [ 4, mattersburg, [0, 1], rapid, Time.cet('2012-05-10 20:30') ],
+ [ 5, sturm, [0, 3], admira, Time.cet('2012-05-10 20:30') ]
+]
+
+games_bl35 = [
+ [ 1, ksv, [0,2], rapid, Time.cet('2012-05-13 16:00') ],
+ [ 2, wacker, [1,1], sturm, Time.cet('2012-05-13 16:00') ],
+ [ 3, neustadt, [1,5], salzburg, Time.cet('2012-05-13 16:00') ],
+ [ 4, admira, [1,1], ried, Time.cet('2012-05-13 16:00') ],
+ [ 5, austria, [1,0], mattersburg, Time.cet('2012-05-13 16:00') ]
+]
+
+games_bl36 = [
+ [ 1, rapid, [2,0], wacker, Time.cet('2012-05-17 16:00') ],
+ [ 2, ried, [2,2], neustadt, Time.cet('2012-05-17 16:00') ],
+ [ 3, mattersburg, [2,0], ksv, Time.cet('2012-05-17 16:00') ],
+ [ 4, sturm, [3,1], austria, Time.cet('2012-05-17 16:00') ],
+ [ 5, salzburg, [2,0], admira, Time.cet('2012-05-17 16:00') ]
+]
+
+Game.create_from_ary!( games_bl29, bl29 )
+Game.create_from_ary!( games_bl30, bl30 )
+Game.create_from_ary!( games_bl31, bl31 )
+Game.create_from_ary!( games_bl32, bl32 )
+Game.create_from_ary!( games_bl33, bl33 )
+Game.create_from_ary!( games_bl34, bl34 )
+Game.create_from_ary!( games_bl35, bl35 )
+Game.create_from_ary!( games_bl36, bl36 )
+
+
+Prop.create!( :key => 'db.at.bl.2011/12.version', :value => '1' )
+
@@ -0,0 +1,63 @@
+# encoding: utf-8
+
+# note: timezone for games (play_at) is *always* CET (central european time)
+
+
+##################################
+### ÖFB Cup 2011/12
+
+ofb = Event.create!( :key => 'at_cup_2011_12', :title => 'ÖFB Cup 2011/12', :start_at => Time.cet( '2011-10-10 17:00' ) )
+
+
+sturm = Team.find_by_key!( 'sturm' )
+ried = Team.find_by_key!( 'ried' )
+salzburg = Team.find_by_key!( 'salzburg' )
+austria = Team.find_by_key!( 'austria' )
+rapid = Team.find_by_key!( 'rapid' )
+wacker = Team.find_by_key!( 'wacker' )
+neustadt = Team.find_by_key!( 'neustadt')
+ksv = Team.find_by_key!( 'ksv' )
+mattersburg = Team.find_by_key!( 'mattersburg' )
+admira = Team.find_by_key!( 'admira' )
+
+
+hartberg = Team.find_by_key!( 'hartberg' )
+groedig = Team.find_by_key!( 'groedig' )
+juniors = Team.find_by_key!( 'juniors' )
+austrial = Team.find_by_key!( 'austrial' )
+
+ofb.teams << sturm
+ofb.teams << hartberg
+ofb.teams << groedig
+ofb.teams << ried
+ofb.teams << salzburg
+ofb.teams << juniors
+ofb.teams << austrial
+ofb.teams << austria
+
+ofb8 = Round.create!( :event => ofb, :pos => 1, :title => 'Viertelfinale', :title2 => '10.+11. April 2012' )
+ofb4 = Round.create!( :event => ofb, :pos => 2, :title => 'Halbfinale', :title2 => '1.+2. Mai 2012' )
+ofb1 = Round.create!( :event => ofb, :pos => 3, :title => 'Finale', :title2 => '20. Mai 2012' )
+
+games_ofb8 = [
+ [ 1, groedig, [2, 3], ried, Time.cet('2012-04-10 18:00') ],
+ [ 2, austrial, [1, 2], austria, Time.cet('2012-04-11 18:00') ],
+ [ 3, sturm, [2, 2, 2, 4], hartberg, Time.cet('2012-04-11 19:00') ],
+ [ 4, salzburg, [4, 1], juniors, Time.cet('2012-04-11 19:00') ]
+]
+
+games_ofb4 = [
+ [ 1, hartberg, [0, 1], salzburg, Time.cet('2012-05-01 18:00') ],
+ [ 2, ried, [2, 0], austria, Time.cet('2012-05-02 20:30') ]
+]
+
+games_ofb1 = [
+ [ 1, salzburg, [3,0], ried, Time.cet('2012-05-20 16:00') ]
+]
+
+Game.create_knockouts_from_ary!( games_ofb8, ofb8 )
+Game.create_knockouts_from_ary!( games_ofb4, ofb4 )
+Game.create_knockouts_from_ary!( games_ofb1, ofb1 )
+
+
+Prop.create!( :key => 'db.at.cup.2011/12.version', :value => '1' )
Oops, something went wrong.

0 comments on commit dcb9df5

Please sign in to comment.