Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add --delete options; add more builtin fixtures

  • Loading branch information...
commit dcb9df53d897733f126d147d96a850223716674c 1 parent 2c63e9a
@geraldb geraldb authored
View
9 README.md
@@ -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
8 script/History.markdown
@@ -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
7 script/Manifest.txt
@@ -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
123 script/db/at/2011_12/bl.rb
@@ -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' )
+
View
63 script/db/at/2011_12/cup.rb
@@ -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' )
View
245 script/db/at/2012_13/bl.rb
@@ -0,0 +1,245 @@
+# encoding: utf-8
+
+# note: timezone for games (play_at) is *always* CET (central european time)
+
+######################################
+## Oesterreichische Bundesliga 2012/13
+##
+## more info => http://bundesliga.at
+
+
+bl = Event.create!( :key => 'at_bl_2012_13',
+ :title => 'Österr. Bundesliga 2012/13',
+ :start_at => Time.cet('2012-07-21 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' )
+wac = Team.find_by_key!( 'wac' )
+
+
+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 << wac
+
+
+bl01 = Round.create!( :event => bl, :pos => 1, :title => '1. Runde', :title2 => '21.+22. Jul 2012' )
+bl02 = Round.create!( :event => bl, :pos => 2, :title => '2. Runde', :title2 => '28.+29. Jul 2012' )
+bl03 = Round.create!( :event => bl, :pos => 3, :title => '3. Runde', :title2 => '4.+5. Aug 2012' )
+bl04 = Round.create!( :event => bl, :pos => 4, :title => '4. Runde', :title2 => '11. Aug 2012' )
+bl05 = Round.create!( :event => bl, :pos => 5, :title => '5. Runde', :title2 => '18. Aug 2012' )
+bl06 = Round.create!( :event => bl, :pos => 6, :title => '6. Runde', :title2 => '25. Aug 2012' )
+bl07 = Round.create!( :event => bl, :pos => 7, :title => '7. Runde', :title2 => '1. Sep 2012' )
+bl08 = Round.create!( :event => bl, :pos => 8, :title => '8. Runde', :title2 => '15. Sep 2012' )
+bl09 = Round.create!( :event => bl, :pos => 9, :title => '9. Runde', :title2 => '22. Sep 2012' )
+bl10 = Round.create!( :event => bl, :pos => 10, :title => '10. Runde', :title2 => '29. Sep 2012' )
+bl11 = Round.create!( :event => bl, :pos => 11, :title => '11. Runde', :title2 => '6. Okt 2012' )
+bl12 = Round.create!( :event => bl, :pos => 12, :title => '12. Runde', :title2 => '20. Okt 2012' )
+bl13 = Round.create!( :event => bl, :pos => 13, :title => '13. Runde', :title2 => '27. Okt 2012' )
+bl14 = Round.create!( :event => bl, :pos => 14, :title => '14. Runde', :title2 => '3. Nov 2012' )
+bl15 = Round.create!( :event => bl, :pos => 15, :title => '15. Runde', :title2 => '10. Nov 2012' )
+bl16 = Round.create!( :event => bl, :pos => 16, :title => '16. Runde', :title2 => '17. Nov 2012' )
+bl17 = Round.create!( :event => bl, :pos => 17, :title => '17. Runde', :title2 => '24. Nov 2012' )
+bl18 = Round.create!( :event => bl, :pos => 18, :title => '18. Runde', :title2 => '1. Dez 2012' )
+bl19 = Round.create!( :event => bl, :pos => 19, :title => '19. Runde', :title2 => '8. Dez 2012' )
+bl20 = Round.create!( :event => bl, :pos => 20, :title => '20. Runde', :title2 => '15. Dez 2012' )
+
+
+games_bl01 = [
+ [ 1, sturm, [], salzburg, Time.cet('2012-07-21 16:00') ],
+ [ 2, rapid, [], wacker, Time.cet('2012-07-21 18:30') ],
+ [ 3, mattersburg, [], neustadt, Time.cet('2012-07-21 18:30') ],
+ [ 4, wac, [], austria, Time.cet('2012-07-21 18:30') ],
+ [ 5, admira, [], ried, Time.cet('2012-07-22 16:00') ]
+]
+
+games_bl02 = [
+ [ 1, neustadt, [], rapid, Time.cet('2012-07-28 18:30') ],
+ [ 2, salzburg, [], mattersburg, Time.cet('2012-07-28 18:30') ],
+ [ 3, austria, [], sturm, Time.cet('2012-07-28 18:30') ],
+ [ 4, wacker, [], admira, Time.cet('2012-07-29 16:00') ],
+ [ 5, ried, [], wac, Time.cet('2012-07-29 18:30') ]
+]
+
+games_bl03 = [
+ [ 1, ried, [], wacker, Time.cet('2012-08-04 18:30') ],
+ [ 2, mattersburg, [], sturm, Time.cet('2012-08-04 18:30') ],
+ [ 3, wac, [], salzburg, Time.cet('2012-08-04 18:30') ],
+ [ 4, admira, [], neustadt, Time.cet('2012-08-04 18:30') ],
+ [ 5, rapid, [], austria, Time.cet('2012-08-05 16:00') ]
+]
+
+games_bl04 = [
+ [ 1, neustadt, [], ried, Time.cet('2012-08-11 00:00') ],
+ [ 2, sturm, [], wac, Time.cet('2012-08-11 00:00') ],
+ [ 3, salzburg, [], rapid, Time.cet('2012-08-11 00:00') ],
+ [ 4, austria, [], admira, Time.cet('2012-08-11 00:00') ],
+ [ 5, wacker, [], mattersburg, Time.cet('2012-08-11 00:00') ]
+]
+
+games_bl05 = [
+ [ 1, ried, [], austria, Time.cet('2012-08-18 00:00') ],
+ [ 2, rapid, [], sturm, Time.cet('2012-08-18 00:00') ],
+ [ 3, wacker, [], neustadt, Time.cet('2012-08-18 00:00') ],
+ [ 4, wac, [], mattersburg, Time.cet('2012-08-18 00:00') ],
+ [ 5, admira, [], salzburg, Time.cet('2012-08-18 00:00') ]
+]
+
+games_bl06 = [
+ [ 1, sturm, [], admira, Time.cet('2012-08-25 00:00') ],
+ [ 2, salzburg, [], neustadt, Time.cet('2012-08-25 00:00') ],
+ [ 3, austria, [], wacker, Time.cet('2012-08-25 00:00') ],
+ [ 4, mattersburg, [], ried, Time.cet('2012-08-25 00:00') ],
+ [ 5, wac, [], rapid, Time.cet('2012-08-25 00:00') ]
+]
+
+games_bl07 = [
+ [ 1, ried, [], sturm, Time.cet('2012-09-01 00:00') ],
+ [ 2, neustadt,[], austria, Time.cet('2012-09-01 00:00') ],
+ [ 3, rapid, [], mattersburg, Time.cet('2012-09-01 00:00') ],
+ [ 4, wacker, [], salzburg, Time.cet('2012-09-01 00:00') ],
+ [ 5, admira, [], wac, Time.cet('2012-09-01 00:00') ]
+]
+
+games_bl08 = [
+ [ 1, sturm, [], wacker, Time.cet('2012-09-15 00:00') ],
+ [ 2, salzburg, [], ried, Time.cet('2012-09-15 00:00') ],
+ [ 3, rapid, [], admira, Time.cet('2012-09-15 00:00') ],
+ [ 4, mattersburg, [], austria, Time.cet('2012-09-15 00:00') ],
+ [ 5, wac, [], neustadt, Time.cet('2012-09-15 00:00') ]
+]
+
+games_bl09 = [
+ [ 1, ried, [], rapid, Time.cet('2012-09-22 00:00') ],
+ [ 2, neustadt,[], sturm, Time.cet('2012-09-22 00:00') ],
+ [ 3, austria, [], salzburg, Time.cet('2012-09-22 00:00') ],
+ [ 4, wacker, [], wac, Time.cet('2012-09-22 00:00') ],
+ [ 5, admira, [], mattersburg, Time.cet('2012-09-22 00:00') ]
+]
+
+games_bl10 = [
+ [ 1, salzburg, [], sturm, Time.cet('2012-09-29 00:00') ],
+ [ 2, wacker, [], rapid, Time.cet('2012-09-29 00:00') ],
+ [ 3, neustadt, [], mattersburg, Time.cet('2012-09-29 00:00') ],
+ [ 4, austria, [], wac, Time.cet('2012-09-29 00:00') ],
+ [ 5, ried, [], admira, Time.cet('2012-09-29 00:00') ]
+]
+
+games_bl11 = [
+ [ 1, wac, [], ried, Time.cet('2012-10-06 00:00') ],
+ [ 2, rapid, [], neustadt, Time.cet('2012-10-06 00:00') ],
+ [ 3, mattersburg, [], salzburg, Time.cet('2012-10-06 00:00') ],
+ [ 4, sturm, [], austria, Time.cet('2012-10-06 00:00') ],
+ [ 5, admira, [], wacker, Time.cet('2012-10-06 00:00') ]
+]
+
+games_bl12 = [
+ [ 1, wacker, [], ried, Time.cet('2012-10-20 00:00') ],
+ [ 2, austria, [], rapid, Time.cet('2012-10-20 00:00') ],
+ [ 3, sturm, [], mattersburg, Time.cet('2012-10-20 00:00') ],
+ [ 4, salzburg, [], wac, Time.cet('2012-10-20 00:00') ],
+ [ 5, neustadt, [], admira, Time.cet('2012-10-20 00:00') ]
+]
+
+games_bl13 = [
+ [ 1, ried, [], neustadt, Time.cet('2012-10-27 00:00') ],
+ [ 2, wac, [], sturm, Time.cet('2012-10-27 00:00') ],
+ [ 3, rapid, [], salzburg, Time.cet('2012-10-27 00:00') ],
+ [ 4, admira, [], austria, Time.cet('2012-10-27 00:00') ],
+ [ 5, mattersburg, [], wacker, Time.cet('2012-10-27 00:00') ]
+]
+
+games_bl14 = [
+ [ 1, austria, [], ried, Time.cet('2012-11-03 00:00') ],
+ [ 2, sturm, [], rapid, Time.cet('2012-11-03 00:00') ],
+ [ 3, neustadt, [], wacker, Time.cet('2012-11-03 00:00') ],
+ [ 4, mattersburg, [], wac, Time.cet('2012-11-03 00:00') ],
+ [ 5, salzburg, [], admira, Time.cet('2012-11-03 00:00') ]
+]
+
+games_bl15 = [
+ [ 1, admira, [], sturm, Time.cet('2012-11-10 00:00') ],
+ [ 2, neustadt, [], salzburg, Time.cet('2012-11-10 00:00') ],
+ [ 3, wacker, [], austria, Time.cet('2012-11-10 00:00') ],
+ [ 4, ried, [], mattersburg, Time.cet('2012-11-10 00:00') ],
+ [ 5, rapid, [], wac, Time.cet('2012-11-10 00:00') ]
+]
+
+games_bl16 = [
+ [ 1, sturm, [], ried, Time.cet('2012-11-17 00:00') ],
+ [ 2, austria, [], neustadt, Time.cet('2012-11-17 00:00') ],
+ [ 3, mattersburg,[], rapid, Time.cet('2012-11-17 00:00') ],
+ [ 4, salzburg, [], wacker, Time.cet('2012-11-17 00:00') ],
+ [ 5, wac, [], admira, Time.cet('2012-11-17 00:00') ]
+]
+
+games_bl17 = [
+ [ 1, wacker, [], sturm, Time.cet('2012-11-24 00:00') ],
+ [ 2, ried, [], salzburg, Time.cet('2012-11-24 00:00') ],
+ [ 3, admira, [], rapid, Time.cet('2012-11-24 00:00') ],
+ [ 4, austria, [], mattersburg, Time.cet('2012-11-24 00:00') ],
+ [ 5, neustadt, [], wac, Time.cet('2012-11-24 00:00') ]
+]
+
+games_bl18 = [
+ [ 1, rapid, [], ried, Time.cet('2012-12-01 00:00') ],
+ [ 2, sturm, [], neustadt, Time.cet('2012-12-01 00:00') ],
+ [ 3, salzburg, [], austria, Time.cet('2012-12-01 00:00') ],
+ [ 4, wac, [], wacker, Time.cet('2012-12-01 00:00') ],
+ [ 5, mattersburg, [], admira, Time.cet('2012-12-01 00:00') ]
+]
+
+games_bl19 = [
+ [ 1, sturm, [], salzburg, Time.cet('2012-12-08 00:00') ],
+ [ 2, rapid, [], wacker, Time.cet('2012-12-08 00:00') ],
+ [ 3, mattersburg, [], neustadt, Time.cet('2012-12-08 00:00') ],
+ [ 4, wac, [], austria, Time.cet('2012-12-08 00:00') ],
+ [ 5, admira, [], ried, Time.cet('2012-12-08 00:00') ]
+]
+
+games_bl20 = [
+ [ 1, ried, [], wac, Time.cet('2012-12-15 00:00') ],
+ [ 2, neustadt, [], rapid, Time.cet('2012-12-15 00:00') ],
+ [ 3, salzburg, [], mattersburg, Time.cet('2012-12-15 00:00') ],
+ [ 4, austria, [], sturm, Time.cet('2012-12-15 00:00') ],
+ [ 5, wacker, [], admira, Time.cet('2012-12-15 00:00') ]
+]
+
+
+
+Game.create_from_ary!( games_bl01, bl01 )
+Game.create_from_ary!( games_bl02, bl02 )
+Game.create_from_ary!( games_bl03, bl03 )
+Game.create_from_ary!( games_bl04, bl04 )
+Game.create_from_ary!( games_bl05, bl05 )
+Game.create_from_ary!( games_bl06, bl06 )
+Game.create_from_ary!( games_bl07, bl07 )
+Game.create_from_ary!( games_bl08, bl08 )
+Game.create_from_ary!( games_bl09, bl09 )
+Game.create_from_ary!( games_bl10, bl10 )
+Game.create_from_ary!( games_bl11, bl11 )
+Game.create_from_ary!( games_bl12, bl12 )
+Game.create_from_ary!( games_bl13, bl13 )
+Game.create_from_ary!( games_bl14, bl14 )
+Game.create_from_ary!( games_bl15, bl15 )
+Game.create_from_ary!( games_bl16, bl16 )
+Game.create_from_ary!( games_bl17, bl17 )
+Game.create_from_ary!( games_bl18, bl18 )
+Game.create_from_ary!( games_bl19, bl19 )
+Game.create_from_ary!( games_bl20, bl20 )
+
+
+Prop.create!( :key => 'db.at.bl.2012/13.version', :value => '1' )
View
200 script/db/at/2012_13/cup.rb
@@ -0,0 +1,200 @@
+# encoding: utf-8
+
+##################################
+### ÖFB Cup 2012/13
+
+cup = Event.create!( :key => 'at_cup_2012_13',
+ :title => 'ÖFB Cup 2012/13',
+ :start_at => Time.cet( '2012-07-13 00:00' ) )
+
+cuprunde1 = Round.create!( :event => cup, :pos => 1, :title => '1. Runde', :title2 => '13.-15. Juli 2012' )
+cuprunde2 = Round.create!( :event => cup, :pos => 2, :title => '2. Runde', :title2 => '25.+26. Sep 2012' )
+cup16 = Round.create!( :event => cup, :pos => 3, :title => 'Achtelfinale', :title2 => '30.+31. Okt 2012' )
+cup8 = Round.create!( :event => cup, :pos => 4, :title => 'Viertelfinale', :title2 => '16.+17. April 2013' )
+cup4 = Round.create!( :event => cup, :pos => 5, :title => 'Halbfinale', :title2 => '7.+8. Mai 2013' )
+cup1 = Round.create!( :event => cup, :pos => 6, :title => 'Finale', :title2 => '30. Mai 2013' )
+
+
+## bundesliga teams
+
+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' )
+wac = Team.find_by_key!( 'wac' )
+
+## erste liga teams
+
+ksv = Team.find_by_key!( 'ksv' )
+altach = Team.find_by_key!( 'altach' )
+austrial = Team.find_by_key!( 'austrial' )
+stpoelten = Team.find_by_key!( 'stpoelten' )
+linz = Team.find_by_key!( 'linz' )
+groedig = Team.find_by_key!( 'groedig' )
+lustenau = Team.find_by_key!( 'lustenau' )
+vienna = Team.find_by_key!( 'vienna' )
+hartberg = Team.find_by_key!( 'hartberg' )
+horn = Team.find_by_key!( 'horn' )
+
+## regionalliga west teams
+
+hard = Team.find_by_key!( 'hard' )
+bregenz = Team.find_by_key!( 'bregenz' )
+dornbirn = Team.find_by_key!( 'dornbirn' )
+kufstein = Team.find_by_key!( 'kufstein' )
+wattens = Team.find_by_key!( 'wattens' )
+austrias = Team.find_by_key!( 'austrias')
+pinzgau = Team.find_by_key!( 'pinzgau' )
+stjohann = Team.find_by_key!( 'stjohann' )
+
+## regionalliga mitte teams
+
+vsv = Team.find_by_key!( 'vsv' )
+klagenfurt = Team.find_by_key!( 'klagenfurt' )
+austriak = Team.find_by_key!( 'austriak' )
+kalsdorf = Team.find_by_key!( 'kalsdorf' )
+gratkorn = Team.find_by_key!( 'gratkorn' )
+allerheiligen = Team.find_by_key!( 'allerheiligen' )
+leoben = Team.find_by_key!( 'leoben' )
+gak = Team.find_by_key!( 'gak' )
+pasching = Team.find_by_key!( 'pasching' )
+voecklamarkt = Team.find_by_key!( 'voecklamarkt' )
+stflorian = Team.find_by_key!( 'stflorian' )
+wallern = Team.find_by_key!( 'wallern' )
+lask = Team.find_by_key!( 'lask' )
+
+## regionalliga ost teams
+
+sollenau = Team.find_by_key!( 'sollenau' )
+amstetten = Team.find_by_key!( 'amstetten' )
+retz = Team.find_by_key!( 'retz' )
+fac = Team.find_by_key!( 'fac' )
+schwechat = Team.find_by_key!( 'schwechat' )
+wienersk = Team.find_by_key!( 'wienersk' )
+ostbahn = Team.find_by_key!( 'ostbahn' )
+oberwart = Team.find_by_key!( 'oberwart' )
+parndorf = Team.find_by_key!( 'parndorf' )
+stegersbach = Team.find_by_key!( 'stegersbach' )
+
+## noch einige teams
+
+wolfurt = Team.find_by_key!( 'wolfurt' )
+schwaz = Team.find_by_key!( 'schwaz' )
+reutte = Team.find_by_key!( 'reutte' )
+spittal = Team.find_by_key!( 'spittal' )
+sak = Team.find_by_key!( 'sak' )
+dsc = Team.find_by_key!( 'dsc' )
+micheldorf = Team.find_by_key!( 'micheldorf' )
+badvoeslau = Team.find_by_key!( 'badvoeslau' )
+gaflenz = Team.find_by_key!( 'gaflenz' )
+ardagger = Team.find_by_key!( 'ardagger' )
+rohrendorf = Team.find_by_key!( 'rohrendorf' )
+heiligenkreuz = Team.find_by_key!( 'heiligenkreuz' )
+viktoria = Team.find_by_key!( 'viktoria' )
+
+
+## 10 Bundeliga Teams
+
+cup.teams << salzburg
+cup.teams << rapid
+cup.teams << admira
+cup.teams << austria
+cup.teams << sturm
+cup.teams << ried
+cup.teams << wacker
+cup.teams << mattersburg
+cup.teams << neustadt
+cup.teams << wac
+
+## 10 Erste Liga Teams
+
+cup.teams << ksv
+cup.teams << altach
+cup.teams << austrial
+cup.teams << stpoelten
+cup.teams << linz
+cup.teams << groedig
+cup.teams << lustenau
+cup.teams << vienna
+cup.teams << hartberg
+cup.teams << horn
+
+
+
+games_cuprunde1 = [
+ [ 1, fac, [0,1], altach, Time.cet('2012-07-12 19:00') ],
+# [ 2, hard, [1,0], schwaz, Time.cet('2012-07-13 18:30') ],
+ [ 3, dsc, [1,2], hartberg, Time.cet('2012-07-13 19:00') ],
+ [ 4, gratkorn, [0,0,0,0,4,5], wacker, Time.cet('2012-07-13 19:00') ],
+# [ 5, pasching, [2,1], austrias, Time.cet('2012-07-13 19:00') ],
+ [ 6, parndorf, [0,3], admira, Time.cet('2012-07-13 19:00') ],
+ [ 7, voecklamarkt, [3,4], lustenau, Time.cet('2012-07-13 19:00') ],
+# [ 8, kalsdorf, [3,1], wallern, Time.cet('2012-07-13 19:00') ],
+ [ 9, wattens, [0,1], sturm, Time.cet('2012-07-13 19:00') ],
+# [ 10, vsv, [4,2], rohrendorf, Time.cet('2012-07-13 19:00') ],
+ [ 11, pinzgau, [0,4], groedig, Time.cet('2012-07-13 19:15') ],
+# [ 12, amstetten, [0,1], schwechat, Time.cet('2012-07-13 19:30') ],
+ [ 13, stflorian, [2,1], linz, Time.cet('2012-07-13 19:30') ],
+ [ 14, austriak, [3,2], horn, Time.cet('2012-07-13 19:30') ],
+# [ 15, sak, [0,5], allerheiligen, Time.cet('2012-07-13 19:30') ],
+ [ 16, gak, [2,2,3,2], vienna, Time.cet('2012-07-13 20:00') ],
+ [ 17, wienersk, [0,2], salzburg, Time.cet('2012-07-13 20:30') ],
+# [ 18, stegersbach, [2,2,3,2], reutte, Time.cet('2012-07-14 17:00') ],
+ [ 19, badvoeslau, [1,0], stpoelten, Time.cet('2012-07-14 17:00') ],
+# [ 20, micheldorf, [0,1], viktoria, Time.cet('2012-07-14 17:00') ],
+# [ 21, klagenfurt, [1,2], stjohann, Time.cet('2012-07-14 18:00') ],
+# [ 22, lask, [7,0], spittal, Time.cet('2012-07-14 18:00') ],
+ [ 23, ostbahn, [1,8], wac, Time.cet('2012-07-14 18:00') ],
+# [ 24, gaflenz, [1,2], sollenau, Time.cet('2012-07-14 18:00') ],
+ [ 25, oberwart, [1,3], austria, Time.cet('2012-07-14 18:00') ],
+ [ 26, leoben, [1,3], mattersburg, Time.cet('2012-07-14 18:00') ],
+ [ 27, retz, [1,7], austrial, Time.cet('2012-07-14 18:00') ],
+ [ 28, bregenz, [1,2], ksv, Time.cet('2012-07-14 18:30') ],
+# [ 29, ardagger, [2,2,2,3], dornbirn, Time.cet('2012-07-14 19:00') ],
+ [ 30, kufstein, [1,4], ried, Time.cet('2012-07-14 19:00') ],
+ [ 31, wolfurt, [2,2,2,4], neustadt, Time.cet('2012-07-15 10:30') ],
+ [ 32, heiligenkreuz,[0,5], rapid, Time.cet('2012-07-15 18:00') ]
+]
+
+games_cuprunde2 = [
+ [ 1, kalsdorf, [3,0], hartberg, Time.cet('2012-09-24 19:00') ],
+ [ 2, viktoria, [2,2,3,3,7,4], ksv, Time.cet('2012-09-25 16:00') ],
+ [ 3, hard, [0,3], altach, Time.cet('2012-09-25 16:30') ],
+ [ 4, stegersbach, [1,3], salzburg, Time.cet('2012-09-25 18:00') ],
+ [ 5, pasching, [1,1,3,2], austrial, Time.cet('2012-09-25 19:00') ],
+ [ 6, austriak, [0,0,2,0], admira, Time.cet('2012-09-25 19:00') ],
+ [ 7, schwechat, [0,5], sturm, Time.cet('2012-09-25 19:00') ],
+ [ 8, lask, [2,0], groedig, Time.cet('2012-09-25 19:00') ],
+ [ 9, stjohann, [0,3], lustenau, Time.cet('2012-09-25 19:00') ],
+ [ 10, sollenau, [1,1,1,5], wacker, Time.cet('2012-09-25 19:00') ],
+ [ 11, vsv, [3,1], neustadt, Time.cet('2012-09-25 19:00') ],
+ [ 12, dornbirn, [2,3], austria, Time.cet('2012-09-25 20:30') ],
+ [ 13, badvoeslau, [2,3], mattersburg, Time.cet('2012-09-26 16:00') ],
+ [ 14, stflorian, [1,1,1,1,5,6], ried, Time.cet('2012-09-26 19:00') ],
+ [ 15, allerheiligen, [1,4], rapid, Time.cet('2012-09-26 19:00') ],
+ [ 16, gak, [0,6], wac, Time.cet('2012-09-26 20:20') ]
+]
+
+games_cup16 = [
+ [ 1, lask, [], mattersburg, Time.cet('2012-10-30 00:00') ],
+ [ 2, rapid, [], altach, Time.cet('2012-10-30 00:00') ],
+ [ 3, viktoria, [], ried, Time.cet('2012-10-30 00:00') ],
+ [ 4, sturm, [], wacker, Time.cet('2012-10-30 00:00') ],
+ [ 5, pasching, [], austriak, Time.cet('2012-10-30 00:00') ],
+ [ 6, lustenau, [], wac, Time.cet('2012-10-30 00:00') ],
+ [ 7, kalsdorf, [], salzburg, Time.cet('2012-10-30 00:00') ],
+ [ 8, vsv, [], austria, Time.cet('2012-10-30 00:00') ]]
+
+
+Game.create_knockouts_from_ary!( games_cuprunde1, cuprunde1 )
+Game.create_knockouts_from_ary!( games_cuprunde2, cuprunde2 )
+Game.create_knockouts_from_ary!( games_cup16, cup16 )
+
+
+
+Prop.create!( :key => 'db.at.cup.2012/13.version', :value => '1' )
View
96 script/db/at/teams.rb
@@ -0,0 +1,96 @@
+# encoding: utf-8
+
+
+bl = [
+ [ 'salzburg', 'FC RB Salzburg', 'RBS' ],
+ [ 'rapid', 'SK Rapid Wien', 'RAP' ],
+ [ 'admira', 'FC Admira Wacker', 'ADM' ],
+ [ 'austria', 'FK Austria Wien', 'FAK' ],
+ [ 'sturm', 'SK Sturm Graz', 'STU' ],
+ [ 'ried', 'SV Ried', 'RIE' ],
+ [ 'wacker', 'FC Wacker Innsbruck', 'IBK' ],
+ [ 'mattersburg', 'SV Mattersburg', 'SVM' ],
+ [ 'neustadt', 'SC Wiener Neustadt', 'WRN' ],
+ [ 'wac', 'Wolfsberger AC', 'WAC' ]
+]
+
+ersteliga = [
+ [ 'ksv', 'Kapfenberger SV 1919', 'Erste Liga/Stmk.', 'KSV' ],
+ [ 'altach', 'SCR Altach', 'Erste Liga/Vbg.', 'ALT' ],
+ [ 'austrial', 'SC Austria Lustenau', 'Erste Liga/Vbg.', 'LUS' ],
+ [ 'stpoelten', 'SKN St. Pölten', 'Erste Liga/NÖ', 'POE' ],
+ [ 'linz', 'FC Blau-Weiß Linz', 'Erste Liga/OÖ', 'BWL' ],
+ [ 'groedig', 'SV Grödig', 'Erste Liga/Sbg.', 'GRO' ],
+ [ 'lustenau', 'FC Lustenau 1907', 'Erste Liga/Vbg.', 'LUS' ],
+ [ 'vienna', 'Vienna FC 1894', 'Erste Liga/Wien', 'VIE' ],
+ [ 'hartberg', 'TSV Hartberg', 'Erste Liga/Stmk.', 'HAR' ],
+ [ 'horn', 'SV Horn', 'Erste Liga/NÖ', 'HOR' ]
+]
+
+rlwest = [
+ [ 'hard', 'FC Hard', 'Regionalliga West/Vbg.', 'HAR' ],
+ [ 'bregenz', 'SC Bregenz', 'Regionalliga West/Vbg.', 'BRE' ],
+ [ 'dornbirn', 'FC Dornbirn 1913', 'Regionalliga West/Vbg.', 'DOR' ],
+ [ 'kufstein', 'FC Kufstein', 'Regionalliga West/Tirol', 'KUF' ],
+ [ 'wattens', 'WSG Wattens', 'Regionalliga West/Tirol', 'WAT' ],
+ [ 'austrias', 'SV Austria Salzburg', 'Regionalliga West/Sbg.', 'AUS' ],
+ [ 'pinzgau', 'FC Pinzgau Saalfelden', 'Regionalliga West/Sbg.', 'PIN' ],
+ [ 'stjohann', 'TSV St. Johann', 'Regionalliga West/Sbg.', 'STJ' ]
+]
+
+rlmitte = [
+ [ 'vsv' , 'Villacher SV', 'Regionalliga Mitte/Ktn.', 'VSV' ],
+ [ 'klagenfurt', 'SAK Celovec/Klagenfurt', 'Regionalliga Mitte/Ktn.', 'CEL' ],
+ [ 'austriak', 'SK Austria Klagenfurt', 'Regionalliga Mitte/Ktn.', 'KLA' ],
+ [ 'kalsdorf', 'SC Kalsdorf', 'Regionalliga Mitte/Stmk.', 'KAL' ],
+ [ 'gratkorn', 'FC Gratkorn', 'Regionalliga Mitte/Stmk.', 'GRA' ],
+ [ 'allerheiligen', 'SV Allerheiligen', 'Regionalliga Mitte/Stmk.', 'ALL' ],
+ [ 'leoben', 'DSV Leoben', 'Regionalliga Mitte/Stmk.', 'LEO' ],
+ [ 'gak', 'Grazer AK', 'Regionalliga Mitte/Stmk.', 'GAK' ],
+ [ 'pasching', 'FC Pasching', 'Regionalliga Mitte/OÖ', 'PAS' ],
+ [ 'voecklamarkt', 'Vöcklamarkt', 'Regionalliga Mitte/OÖ', 'VOE' ],
+ [ 'stflorian', 'St. Florian', 'Regionalliga Mitte/OÖ', 'STF' ],
+ [ 'wallern', 'Wallern', 'Regionalliga Mitte/OÖ', 'WAL' ],
+ [ 'lask', 'LASK Linz', 'Regionalliga Mitte/OÖ', 'LAS' ]
+]
+
+rlost = [
+ [ 'sollenau', '1. SC Sollenau', 'Regionalliga Ost/OÖ', 'SOL' ],
+ [ 'amstetten', 'SKU Amstetten', 'Regionalliga Ost/NÖ', 'AMS' ],
+ [ 'retz', 'SV Retz', 'Regionalliga Ost/NÖ', 'RET' ],
+ [ 'fac' , 'FAC Team für Wien', 'Regionalliga Ost/Wien', 'FAC' ],
+ [ 'schwechat', 'SV Schwechat', 'Regionalliga Ost/Wien', 'SCH' ],
+ [ 'wienersk', 'Wiener SK', 'Regionalliga Ost/Wien', 'WIE' ],
+ [ 'ostbahn', 'SC Ostbahn XI', 'Regionalliga Ost/Wien', 'OST' ],
+ [ 'oberwart', 'SV Oberwart', 'Regionalliga Ost/Bgld.', 'OBE' ],
+ [ 'parndorf', 'SC/ESV Parndorf 1919', 'Regionalliga Ost/Bgld.', 'PAR' ],
+ [ 'stegersbach', 'SV Stegersbach', 'Regionalliga Ost/Bgld.', 'STE' ]
+]
+
+misc = [
+ [ 'wolfurt', 'FC Wolfurt', 'Vorarlberg Liga', 'WOL' ],
+ [ 'schwaz', 'SC Schwaz', 'Tirol Liga', 'SCH' ],
+ [ 'reutte', 'SV Reutte', 'Tirol Liga', 'REU' ],
+ [ 'spittal', 'SV Spittal/Drau', 'Kärntner Liga', 'SPI' ],
+ [ 'sak', 'SAK 1914', 'Salzburger Liga', 'SAK' ],
+ [ 'dsc', 'Deutschlandsberger SC', 'Landesliga/Stmk.', 'DSC' ],
+ [ 'micheldorf', 'SV Micheldorf', 'OÖ Liga', 'MIC' ],
+ [ 'badvoeslau', 'ASK Bad Vöslau', 'Landesliga/NÖ', 'VOE' ],
+ [ 'gaflenz', 'SV Gaflenz', 'Landesliga/NÖ', 'GAF' ],
+ [ 'ardagger', 'Ardagger SCU', 'Landesliga/NÖ', 'ARD' ],
+ [ 'rohrendorf', 'SC Rohrendorf', '2. Landesliga West/NÖ', 'ROH' ],
+ [ 'heiligenkreuz', 'SV Heiligenkreuz', '2. Liga Süd/NÖ', 'HEI' ],
+ [ 'viktoria', 'Wiener Viktoria', 'Wiener Stadtliga', 'VIK' ],
+ [ 'juniors', 'FC RB Juniors Salzburg' ]
+]
+
+
+Team.create_from_ary!( bl )
+Team.create_from_ary!( ersteliga )
+Team.create_from_ary!( rlwest )
+Team.create_from_ary!( rlmitte )
+Team.create_from_ary!( rlost )
+Team.create_from_ary!( misc )
+
+
+Prop.create!( :key => 'db.at.teams.version', :value => '1' )
View
2  script/db/cl/2011_12/cl.rb
@@ -10,6 +10,7 @@
:title => 'Champions League 2011/12',
:start_at => Time.cet( '2011-10-10 17:00' ) )
+
inter = Team.find_by_key!( 'inter' )
marseille = Team.find_by_key!( 'marseille' )
bayern = Team.find_by_key!( 'bayern' )
@@ -83,4 +84,5 @@
Game.create_knockout_pairs_from_ary!( games_cl4, cl4, cl4_2 )
Game.create_knockouts_from_ary!( games_cl1, cl1 )
+
Prop.create!( :key => 'db.cl.2011/12.version', :value => '1' )
View
160 script/db/mx/apertura_2012.rb
@@ -0,0 +1,160 @@
+# encoding: utf-8
+
+# note: timezone for games (play_at) is *always* CST (central standard time / -6 hours ??)
+
+
+mx = Event.create!( :key => 'mx_ap_2012',
+ :title => 'México Primera División Apertura 2012',
+ :start_at => Time.cst('2012-07-20 00:00') )
+
+
+america = Team.find_by_key!( 'america' )
+atlante = Team.find_by_key!( 'atlante' )
+atlas = Team.find_by_key!( 'atlas' )
+chivas = Team.find_by_key!( 'chivas' )
+cruzazul = Team.find_by_key!( 'cruzazul' )
+jaguares = Team.find_by_key!( 'jaguares' )
+leon = Team.find_by_key!( 'leon' )
+monarcas = Team.find_by_key!( 'monarcas' )
+monterrey = Team.find_by_key!( 'monterrey' )
+pachuca = Team.find_by_key!( 'pachuca' )
+puebla = Team.find_by_key!( 'puebla' )
+queretaro = Team.find_by_key!( 'queretaro' )
+sanluis = Team.find_by_key!( 'sanluis' )
+slaguna = Team.find_by_key!( 'slaguna' )
+tijuana = Team.find_by_key!( 'tijuana' )
+toluca = Team.find_by_key!( 'toluca' )
+tigres = Team.find_by_key!( 'tigres' )
+pumas = Team.find_by_key!( 'pumas' )
+
+
+mx.teams << america
+mx.teams << atlante
+mx.teams << atlas
+mx.teams << chivas
+mx.teams << cruzazul
+mx.teams << jaguares
+mx.teams << leon
+mx.teams << monarcas
+mx.teams << monterrey
+mx.teams << pachuca
+mx.teams << puebla
+mx.teams << queretaro
+mx.teams << sanluis
+mx.teams << slaguna
+mx.teams << tijuana
+mx.teams << toluca
+mx.teams << tigres
+mx.teams << pumas
+
+j1 = Round.create!( :event => mx, :pos => 1, :title => 'Jornada 1', :title2 => '20, 21 y 22 de julio' )
+j2 = Round.create!( :event => mx, :pos => 2, :title => 'Jornada 2', :title2 => '27, 28 y 29 de julio' )
+j3 = Round.create!( :event => mx, :pos => 3, :title => 'Jornada 3', :title2 => '3, 4, y 5 de agosto' )
+j4 = Round.create!( :event => mx, :pos => 4, :title => 'Jornada 4', :title2 => '10, 11 y 12 de agosto' )
+j5 = Round.create!( :event => mx, :pos => 5, :title => 'Jornada 5', :title2 => '17, 18 y 19 de agosto' )
+j6 = Round.create!( :event => mx, :pos => 6, :title => 'Jornada 6', :title2 => '24, 25 y 26 de agosto' )
+j7 = Round.create!( :event => mx, :pos => 7, :title => 'Jornada 7', :title2 => '31 de agosto, 1 y 2 de septiembre' )
+j8 = Round.create!( :event => mx, :pos => 8, :title => 'Jornada 8', :title2 => '14, 15 y 16 de septiembre' )
+
+
+games_j1 = [
+ [1, jaguares, [], tigres, Time.cst('2012-07-20 19:30') ],
+ [2, tijuana, [], puebla, Time.cst('2012-07-20 21:30') ],
+ [3, cruzazul, [], monarcas, Time.cst('2012-07-21 17:00') ],
+ [4, queretaro, [], leon, Time.cst('2012-07-21 17:00') ],
+ [5, slaguna, [], sanluis, Time.cst('2012-07-21 19:00') ],
+ [6, monterrey, [], america, Time.cst('2012-07-21 19:00') ],
+ [7, atlas, [], pumas, Time.cst('2012-07-21 21:00') ],
+ [8, toluca, [], chivas, Time.cst('2012-07-22 12:00') ],
+ [9, atlante, [], pachuca, Time.cst('2012-07-22 18:00') ]]
+
+
+games_j2 = [
+ [1, monarcas, [], monterrey, Time.cst('2012-07-27 19:30') ],
+ [2, leon, [], tijuana, Time.cst('2012-07-27 21:30') ],
+ [3, america, [], jaguares, Time.cst('2012-07-28 17:00') ],
+ [4, pachuca, [], atlas, Time.cst('2012-07-28 19:00') ],
+ [5, tigres, [], atlante, Time.cst('2012-07-28 19:00') ],
+ [6, sanluis, [], cruzazul, Time.cst('2012-07-28 21:00') ],
+ [7, puebla, [], toluca, Time.cst('2012-07-29 12:00') ],
+ [8, pumas, [], queretaro, Time.cst('2012-07-29 12:00') ],
+ [9, chivas, [], slaguna, Time.cst('2012-07-29 17:00')]]
+
+games_j3 = [
+ [1, slaguna, [], puebla, Time.cst('2012-08-03 19:00') ],
+ [2, tijuana, [], pumas, Time.cst('2012-08-03 19:30') ],
+ [3, monarcas, [], sanluis, Time.cst('2012-08-03 21:30') ],
+ [4, cruzazul, [], chivas, Time.cst('2012-08-04 17:00') ],
+ [5, queretaro, [], pachuca, Time.cst('2012-08-04 17:00') ],
+ [6, monterrey, [], jaguares, Time.cst('2012-08-04 19:00') ],
+ [7, atlas, [], tigres, Time.cst('2012-08-04 21:00') ],
+ [8, toluca, [], leon, Time.cst('2012-08-05 12:00') ],
+ [9, atlante, [], america, Time.cst('2012-08-05 18:00') ]]
+
+games_j4 = [
+ [1, jaguares, [], atlante, Time.cst('2012-08-10 19:30') ],
+ [2, leon, [], slaguna, Time.cst('2012-08-10 21:30') ],
+ [3, america, [], atlas, Time.cst('2012-08-11 17:00') ],
+ [4, pachuca, [], tijuana, Time.cst('2012-08-11 19:00') ],
+ [5, tigres, [], queretaro, Time.cst('2012-08-11 19:00') ],
+ [6, sanluis, [], monterrey, Time.cst('2012-08-11 21:00') ],
+ [7, puebla, [], cruzazul, Time.cst('2012-08-12 12:00') ],
+ [8, pumas, [], toluca, Time.cst('2012-08-12 12:00') ],
+ [9, chivas, [], monarcas, Time.cst('2012-08-12 17:00') ]]
+
+games_j5 = [
+ [1, tijuana, [], tigres, Time.cst('2012-08-17 19:30') ],
+ [2, monarcas, [], puebla, Time.cst('2012-08-17 21:30') ],
+ [3, cruzazul, [], leon, Time.cst('2012-08-17 21:30') ],
+ [4, queretaro, [], america, Time.cst('2012-08-18 17:00') ],
+ [5, slaguna, [], pumas, Time.cst('2012-08-18 19:00') ],
+ [6, monterrey, [], atlante, Time.cst('2012-08-18 19:00') ],
+ [7, sanluis, [], chivas, Time.cst('2012-08-18 21:00') ],
+ [8, atlas, [], jaguares, Time.cst('2012-08-18 21:00') ],
+ [9, toluca, [], pachuca, Time.cst('2012-08-19 12:00') ]]
+
+games_j6 = [
+ [1, jaguares, [], queretaro, Time.cst('2012-08-24 19:30') ],
+ [2, leon, [], monarcas, Time.cst('2012-08-24 21:30') ],
+ [3, america, [], tijuana, Time.cst('2012-08-25 17:00') ],
+ [4, pachuca, [], slaguna, Time.cst('2012-08-25 19:00') ],
+ [5, tigres, [], toluca, Time.cst('2012-08-25 19:00') ],
+ [6, puebla, [], sanluis, Time.cst('2012-08-26 12:00') ],
+ [7, pumas, [], cruzazul, Time.cst('2012-08-26 12:00') ],
+ [8, chivas, [], monterrey, Time.cst('2012-08-26 17:00') ],
+ [9, atlante, [], atlas, Time.cst('2012-08-26 18:00') ]]
+
+games_j7 = [
+ [1, tijuana, [], jaguares, Time.cst('2012-08-31 19:30') ],
+ [2, monarcas, [], pumas, Time.cst('2012-08-31 21:30') ],
+ [3, cruzazul, [], pachuca, Time.cst('2012-09-01 17:00') ],
+ [4, queretaro, [], atlante, Time.cst('2012-09-01 17:00') ],
+ [5, slaguna, [], tigres, Time.cst('2012-09-01 19:00') ],
+ [6, monterrey, [], atlas, Time.cst('2012-09-01 19:00') ],
+ [7, sanluis, [], leon, Time.cst('2012-09-01 21:00') ],
+ [8, toluca, [], america, Time.cst('2012-09-02 12:00') ],
+ [9, chivas, [], puebla, Time.cst('2012-09-02 17:00') ]]
+
+games_j8 = [
+ [1, jaguares, [], toluca, Time.cst('2012-09-14 19:30') ],
+ [2, pachuca, [], monarcas, Time.cst('2012-09-14 19:30') ],
+ [3, leon, [], chivas, Time.cst('2012-09-14 21:30') ],
+ [4, america, [], slaguna, Time.cst('2012-09-15 17:00') ],
+ [5, tigres, [], cruzazul, Time.cst('2012-09-15 19:00') ],
+ [6, atlas, [], queretaro, Time.cst('2012-09-15 21:00') ],
+ [7, puebla, [], monterrey, Time.cst('2012-09-16 12:00') ],
+ [8, pumas, [], sanluis, Time.cst('2012-09-16 12:00') ],
+ [9, atlante, [], tijuana, Time.cst('2012-09-16 18:00') ]]
+
+
+Game.create_from_ary!( games_j1, j1 )
+Game.create_from_ary!( games_j2, j2 )
+Game.create_from_ary!( games_j3, j3 )
+Game.create_from_ary!( games_j4, j4 )
+Game.create_from_ary!( games_j5, j5 )
+Game.create_from_ary!( games_j6, j6 )
+Game.create_from_ary!( games_j7, j7 )
+Game.create_from_ary!( games_j8, j8 )
+
+
+Prop.create!( :key => 'db.mx.apertura.2012.version', :value => '1' )
View
26 script/db/mx/teams.rb
@@ -0,0 +1,26 @@
+# encoding: utf-8
+
+teams = [
+ [ 'america', 'Club América', 'México' ],
+ [ 'atlante', 'Atlante', 'Cancún' ],
+ [ 'atlas', 'Atlas', 'Guadalajara' ],
+ [ 'chivas', 'Guadalajara Chivas', 'Guadalajara' ],
+ [ 'cruzazul', 'Cruz Azul', 'México' ],
+ [ 'jaguares', 'Jaguares de Chiapas', 'Tuxtla Gutiérrez' ],
+ [ 'leon', 'Club León', 'León' ],
+ [ 'monarcas', 'Monarcas Morelia', 'Morelia' ],
+ [ 'monterrey', 'Monterrey', 'Monterrey' ],
+ [ 'pachuca', 'Pachuca', 'Pachuca' ],
+ [ 'puebla', 'Puebla F.C. ', 'Puebla' ],
+ [ 'queretaro', 'Querétaro F.C.', 'Querétaro' ],
+ [ 'sanluis', 'Club San Luis', 'San Luis Potosì' ],
+ [ 'slaguna', 'Santos Laguna', 'Torreón' ],
+ [ 'tijuana', 'Club Tijuana', 'Tijuana' ],
+ [ 'toluca', 'Toluca', 'Toluca' ],
+ [ 'tigres', 'Tigres UANL', 'San Nicolás de los Garza' ],
+ [ 'pumas', 'Pumas UNAM', 'México' ]
+]
+
+Team.create_from_ary!( teams )
+
+Prop.create!( :key => 'db.mx.teams.version', :value => '1' )
View
13 script/lib/sportdb.rb
@@ -48,6 +48,19 @@ def self.main
def self.load( args )
Loader.new.run( args )
end
+
+
+ # delete ALL records (use with care!)
+ def self.delete!
+ Team.delete_all
+ Game.delete_all
+ Event.delete_all
+ EventTeam.delete_all
+ Group.delete_all
+ GroupTeam.delete_all
+ Round.delete_all
+ Prop.delete_all
+ end # method delete!
end # module SportDB
View
10 script/lib/sportdb/cli/opts.rb
@@ -12,6 +12,16 @@ def create?
end
+ def delete=(boolean)
+ @delete = boolean
+ end
+
+ def delete?
+ return false if @delete.nil? # default create flag is false
+ @delete == true
+ end
+
+
# use loader? (that is, built-in seed data)
def load=(boolean)
@load = boolean
View
6 script/lib/sportdb/cli/runner.rb
@@ -20,6 +20,8 @@ def run( args )
## todo: change to different flag?? use -c/--config ???
cmd.on( '-c', '--create', 'Create DB Schema' ) { opts.create = true }
+
+ cmd.on( '--delete', 'Delete all records' ) { opts.delete = true }
cmd.on( '--load', 'Use Loader for Builtin Sports Data' ) { opts.load = true }
@@ -82,6 +84,10 @@ def run( args )
if opts.create?
CreateDB.up
end
+
+ if opts.delete?
+ SportDB.delete!
+ end
loader = nil
if opts.load?
View
2  script/lib/sportdb/version.rb
@@ -1,4 +1,4 @@
module SportDB
- VERSION = '0.2.0'
+ VERSION = '0.3.0'
end
Please sign in to comment.
Something went wrong with that request. Please try again.