sportdb 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +2 -0
- data/db/at/teams.rb +10 -10
- data/db/cities.rb +162 -0
- data/db/cl/teams.rb +34 -37
- data/db/de/teams.rb +18 -18
- data/db/en/teams.rb +20 -20
- data/db/mx/teams.rb +18 -18
- data/lib/sportdb.rb +6 -1
- data/lib/sportdb/cli/runner.rb +1 -1
- data/lib/sportdb/models/city.rb +44 -0
- data/lib/sportdb/models/country.rb +2 -0
- data/lib/sportdb/models/team.rb +9 -2
- data/lib/sportdb/schema.rb +10 -1
- data/lib/sportdb/version.rb +1 -1
- metadata +6 -4
data/Manifest.txt
CHANGED
@@ -15,6 +15,7 @@ db/at/2012_13/cup.txt
|
|
15
15
|
db/at/2012_13/cup_fixtures.rb
|
16
16
|
db/at/badges.rb
|
17
17
|
db/at/teams.rb
|
18
|
+
db/cities.rb
|
18
19
|
db/cl/2011_12/cl.rb
|
19
20
|
db/cl/2011_12/el.rb
|
20
21
|
db/cl/2012_13/cl.rb
|
@@ -56,6 +57,7 @@ lib/sportdb/cli/opts.rb
|
|
56
57
|
lib/sportdb/cli/runner.rb
|
57
58
|
lib/sportdb/loader.rb
|
58
59
|
lib/sportdb/models/badge.rb
|
60
|
+
lib/sportdb/models/city.rb
|
59
61
|
lib/sportdb/models/country.rb
|
60
62
|
lib/sportdb/models/event.rb
|
61
63
|
lib/sportdb/models/event_team.rb
|
data/db/at/teams.rb
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
bl = [
|
5
|
-
[ 'salzburg', 'FC RB Salzburg|RB Salzburg|Red Bull Salzburg', 'RBS' ],
|
6
|
-
[ 'rapid', 'SK Rapid Wien|Rapid Wien',
|
7
|
-
[ 'admira', 'FC Admira Wacker|Admira Wacker|FC Admira Wacker Mödling', 'ADM' ],
|
8
|
-
[ 'austria', 'FK Austria Wien|Austria Wien', 'FAK' ],
|
9
|
-
[ 'sturm', 'SK Sturm Graz|Sturm Graz', 'STU' ],
|
10
|
-
[ 'ried', 'SV Ried|SV Josko Ried|SV Josko Fenster Ried', 'RIE' ],
|
11
|
-
[ 'innsbruck', 'FC Wacker Innsbruck|FC Wacker|Wacker Innsbruck', 'IBK' ],
|
12
|
-
[ 'mattersburg', 'SV Mattersburg', 'SVM' ],
|
13
|
-
[ 'wrneustadt', 'SC Wiener Neustadt|Wiener Neustadt|Wr. Neustadt', 'WRN' ],
|
14
|
-
[ 'wac', 'Wolfsberger AC', 'WAC' ]
|
5
|
+
[ 'salzburg', 'FC RB Salzburg|RB Salzburg|Red Bull Salzburg', 'RBS', 'city:salzburg' ],
|
6
|
+
[ 'rapid', 'SK Rapid Wien|Rapid Wien', 'RAP', 'city:wien' ],
|
7
|
+
[ 'admira', 'FC Admira Wacker|Admira Wacker|FC Admira Wacker Mödling', 'ADM', 'city:moedling' ],
|
8
|
+
[ 'austria', 'FK Austria Wien|Austria Wien', 'FAK', 'city:wien' ],
|
9
|
+
[ 'sturm', 'SK Sturm Graz|Sturm Graz', 'STU', 'city:graz' ],
|
10
|
+
[ 'ried', 'SV Ried|SV Josko Ried|SV Josko Fenster Ried', 'RIE', 'city:ried' ],
|
11
|
+
[ 'innsbruck', 'FC Wacker Innsbruck|FC Wacker|Wacker Innsbruck', 'IBK', 'city:innsbruck' ],
|
12
|
+
[ 'mattersburg', 'SV Mattersburg', 'SVM', 'city:mattersburg' ],
|
13
|
+
[ 'wrneustadt', 'SC Wiener Neustadt|Wiener Neustadt|Wr. Neustadt', 'WRN', 'city:wrneustadt' ],
|
14
|
+
[ 'wac', 'Wolfsberger AC', 'WAC', 'city:wolfsberg' ]
|
15
15
|
]
|
16
16
|
|
17
17
|
ersteliga = [
|
data/db/cities.rb
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
### todo/fix: add regions (Stmk., NOE, OOE, etc,)
|
6
|
+
|
7
|
+
cities_at = [
|
8
|
+
['wien', 'Wien|Vienna'],
|
9
|
+
['innsbruck', 'Innsbruck'],
|
10
|
+
['moedling', 'Mödling|Moedling'],
|
11
|
+
['salzburg', 'Salzburg'],
|
12
|
+
['graz', 'Graz'],
|
13
|
+
['linz', 'Linz'],
|
14
|
+
['mattersburg', 'Mattersburg'],
|
15
|
+
['ried', 'Ried'],
|
16
|
+
['wrneustadt', 'Wiener Neustadt|Wr. Neustadt'],
|
17
|
+
['wolfsberg', 'Wolfsberg']
|
18
|
+
]
|
19
|
+
|
20
|
+
at = Country.find_by_key!( 'at' )
|
21
|
+
City.create_from_ary!( cities_at, country: at )
|
22
|
+
|
23
|
+
|
24
|
+
cities_en = [
|
25
|
+
['manchester', 'Manchester'],
|
26
|
+
['london', 'London'],
|
27
|
+
['liverpool', 'Liverpool'],
|
28
|
+
['birmingham', 'Birmingham'], # e.g.Aston Villa
|
29
|
+
['blackburn', 'Blackburn'],
|
30
|
+
['westbrom', 'West Bromwich'],
|
31
|
+
['newcastle', 'Newcastle upon Tyne'],
|
32
|
+
['stoke', 'Stoke-on-Trent'],
|
33
|
+
['sunderland', 'Sunderland'],
|
34
|
+
['wigan', 'Wigan'],
|
35
|
+
['southampton', 'Southampton'],
|
36
|
+
['reading', 'Reading'],
|
37
|
+
['norwich', 'Norwich'],
|
38
|
+
['swansea', 'Swansea']
|
39
|
+
]
|
40
|
+
|
41
|
+
en = Country.find_by_key!( 'en' )
|
42
|
+
City.create_from_ary!( cities_en, country: en )
|
43
|
+
|
44
|
+
|
45
|
+
cities_de = [
|
46
|
+
['hoffenheim', 'Hoffenheim'],
|
47
|
+
['nuernberg', 'Nürnberg'],
|
48
|
+
['stuttgart', 'Stuttgart'],
|
49
|
+
['augsburg', 'Augsburg'],
|
50
|
+
['wolfsburg', 'Wolfsburg'],
|
51
|
+
['fuerth', 'Fürth'],
|
52
|
+
['muenchen', 'München'],
|
53
|
+
['gelsenkirchen', 'Gelsenkirchen'],
|
54
|
+
['dortmund', 'Dortmund'],
|
55
|
+
['frankfurt', 'Frankfurt'],
|
56
|
+
['hannover', 'Hannover'],
|
57
|
+
['leverkusen', 'Leverkusen'],
|
58
|
+
['duesseldorf', 'Düsseldorf'],
|
59
|
+
['hamburg', 'Hamburg'],
|
60
|
+
['mainz', 'Mainz'],
|
61
|
+
['mgladbach', "Mönchengladbach|M'gladbach" ],
|
62
|
+
['freiburg', 'Freiburg'],
|
63
|
+
['bremen', 'Bremen']
|
64
|
+
]
|
65
|
+
|
66
|
+
de = Country.find_by_key!( 'de' )
|
67
|
+
City.create_from_ary!( cities_de, country: de )
|
68
|
+
|
69
|
+
|
70
|
+
cities_es = [
|
71
|
+
['bilbao', 'Bilbao'],
|
72
|
+
['valencia', 'Valencia'],
|
73
|
+
['barcelona', 'Barcelona'],
|
74
|
+
['madrid', 'Madrid'],
|
75
|
+
['malaga', 'Málaga']
|
76
|
+
]
|
77
|
+
|
78
|
+
es = Country.find_by_key!( 'es' )
|
79
|
+
City.create_from_ary!( cities_es, country: es )
|
80
|
+
|
81
|
+
|
82
|
+
cities_fr = [
|
83
|
+
['lille', 'Lille'],
|
84
|
+
['paris', 'Paris'],
|
85
|
+
['marseille', 'Marseille'],
|
86
|
+
['montpellier', 'Montpellier']
|
87
|
+
]
|
88
|
+
|
89
|
+
fr = Country.find_by_key!( 'fr' )
|
90
|
+
City.create_from_ary!( cities_fr, country: fr )
|
91
|
+
|
92
|
+
|
93
|
+
cities_it = [
|
94
|
+
['turin', 'Turin'],
|
95
|
+
['milano', 'Mailand|Milano'],
|
96
|
+
['napoli', 'Neapel|Napoli']
|
97
|
+
]
|
98
|
+
|
99
|
+
it = Country.find_by_key!( 'it' )
|
100
|
+
City.create_from_ary!( cities_it, country: it )
|
101
|
+
|
102
|
+
|
103
|
+
cities_pt = [
|
104
|
+
['porto', 'Porto'],
|
105
|
+
['braga', 'Braga'],
|
106
|
+
['lisboa', 'Lissabon|Lisboa']
|
107
|
+
]
|
108
|
+
|
109
|
+
pt = Country.find_by_key!( 'pt' )
|
110
|
+
City.create_from_ary!( cities_pt, country: pt )
|
111
|
+
|
112
|
+
|
113
|
+
cities_ru = [
|
114
|
+
['moskva', 'Moskau|Moskva'],
|
115
|
+
['stpetersburg','St. Petersburg']
|
116
|
+
]
|
117
|
+
|
118
|
+
ru = Country.find_by_key!( 'ru' )
|
119
|
+
City.create_from_ary!( cities_ru, country: ru )
|
120
|
+
|
121
|
+
|
122
|
+
cities_be = [
|
123
|
+
['brussel', 'Brüssel|Brussel|Bruxelles|Brussels'] # de|nl|fr|en - RCA Anderlecht
|
124
|
+
]
|
125
|
+
|
126
|
+
be = Country.find_by_key!( 'be' )
|
127
|
+
City.create_from_ary!( cities_be, country: be )
|
128
|
+
|
129
|
+
|
130
|
+
cities_ua = [
|
131
|
+
['kiev', 'Kiew|Kiev|Kyiv' ],
|
132
|
+
['donetsk', 'Donezk|Donetsk'],
|
133
|
+
['kharkov', 'Kharkiv|Kharkov']
|
134
|
+
]
|
135
|
+
|
136
|
+
ua = Country.find_by_key!( 'ua' )
|
137
|
+
City.create_from_ary!( cities_ua, country: ua )
|
138
|
+
|
139
|
+
|
140
|
+
cities_mx = [
|
141
|
+
['mexico', 'México' ],
|
142
|
+
['cancun', 'Cancún' ],
|
143
|
+
['guadalajara', 'Guadalajara' ],
|
144
|
+
['tuxtla', 'Tuxtla Gutiérrez' ],
|
145
|
+
['leon', 'León' ],
|
146
|
+
['morelia', 'Morelia' ],
|
147
|
+
['monterrey', 'Monterrey' ],
|
148
|
+
['pachuca', 'Pachuca' ],
|
149
|
+
['puebla', 'Puebla' ],
|
150
|
+
['queretaro', 'Querétaro' ],
|
151
|
+
['sanluispotosi', 'San Luis Potosì' ],
|
152
|
+
['torreon', 'Torreón' ],
|
153
|
+
['tijuana', 'Tijuana' ],
|
154
|
+
['toluca', 'Toluca' ],
|
155
|
+
['sannicolas', 'San Nicolás de los Garza' ]
|
156
|
+
]
|
157
|
+
|
158
|
+
mx = Country.find_by_key!( 'mx' )
|
159
|
+
City.create_from_ary!( cities_mx, country: mx )
|
160
|
+
|
161
|
+
|
162
|
+
Prop.create!( key: 'db.cities.version', value: '1' )
|
data/db/cl/teams.rb
CHANGED
@@ -37,52 +37,49 @@ cy = Country.find_by_key!( 'cy' )
|
|
37
37
|
|
38
38
|
|
39
39
|
teams = [
|
40
|
-
[ '
|
41
|
-
[ '
|
42
|
-
[ '
|
43
|
-
[ '
|
44
|
-
|
45
|
-
[ '
|
46
|
-
|
40
|
+
[ 'malaga', 'FC Málaga|Malaga CF ESP|CF Malaga', es, 'city:malaga' ],
|
41
|
+
[ 'madrid', 'Real Madrid|Real Madrid ESP', es, 'city:madrid' ],
|
42
|
+
[ 'valencia', 'FC Valencia|FC Valencia ESP|CF Valencia', es, 'city:valencia' ],
|
43
|
+
[ 'barcelona', 'FC Barcelona|FC Barcelona ESP', es, 'city:barcelona' ],
|
44
|
+
[ 'atletico', 'Atlético Madrid', es, 'city:madrid' ],
|
45
|
+
[ 'athletic', 'Athletic Bilbao', es, 'city:bilbao' ],
|
46
|
+
|
47
|
+
[ 'porto', 'FC Porto|FC Porto POR', pt, 'city:porto' ],
|
48
|
+
[ 'benfica', 'Benfica Lissabon|Benfica Lis. POR', pt, 'city:lisboa' ],
|
49
|
+
[ 'braga', 'Sporting Braga|Sporting Braga POR', pt, 'city:braga' ],
|
50
|
+
[ 'sporting', 'Sporting Lisboa', pt, 'city:lisboa' ],
|
51
|
+
|
52
|
+
[ 'milan', 'AC Mailand|AC Milan ITA|AC Milan', it, 'city:milano' ],
|
53
|
+
[ 'inter', 'FC Internazionale Milano', it, 'city:milano' ],
|
54
|
+
[ 'napoli', 'SSC Napoli', it, 'city:napoli' ],
|
55
|
+
[ 'juventus', 'Juventus Turin|Juventus Turin ITA', it, 'city:turin' ],
|
56
|
+
|
57
|
+
[ 'paris', 'Paris St. Germain|Paris S.Germai FRA|Paris Saint Germain', fr, 'city:paris' ],
|
58
|
+
[ 'montpellier', 'HSC Montpellier|Montpellier FRA', fr, 'city:montpellier' ],
|
59
|
+
[ 'lille', 'OSC Lille|Lille OSC FRA', fr, 'city:lille' ],
|
60
|
+
[ 'marseille', 'Olympique Marseille', fr, 'city:marseille' ],
|
61
|
+
|
62
|
+
[ 'kiew', 'Dynamo Kiew|FC Dynamo Kiew UKR|Dynamo Kiev', ua, 'city:kiev' ],
|
63
|
+
[ 'donezk', 'Schachtjor Donezk|Shakhtar Don. UKR|Shakhtar Donetsk', ua, 'city:donetsk' ],
|
64
|
+
[ 'metalist', 'FC Metalist Kharkiv', ua, 'city:kharkov' ],
|
65
|
+
|
66
|
+
[ 'zenit', 'Zenit St. Petersburg|Zenit Petersb. RUS|FC Zenit St Petersburg', ru, 'city:stpetersburg' ],
|
67
|
+
[ 'spartak', 'Spartak Moskau|Spartak Moskau RUS|Spartak Moscow', ru, 'city:moskva' ],
|
68
|
+
[ 'moskva', 'PFC CSKA Moskva', ru, 'city:moskva' ],
|
69
|
+
|
70
|
+
[ 'anderlecht', 'RSC Anderlecht|RSC Anderlecht BEL', be, 'city:brussel' ],
|
47
71
|
|
48
|
-
[ 'milan', 'AC Mailand|AC Milan ITA|AC Milan', it ],
|
49
|
-
[ 'zenit', 'Zenit St. Petersburg|Zenit Petersb. RUS|FC Zenit St Petersburg', ru ],
|
50
|
-
[ 'anderlecht', 'RSC Anderlecht|RSC Anderlecht BEL', be ],
|
51
|
-
[ 'malaga', 'FC Málaga|Malaga CF ESP|CF Malaga', es ],
|
52
|
-
|
53
|
-
[ 'madrid', 'Real Madrid|Real Madrid ESP', es ],
|
54
72
|
[ 'ajax', 'Ajax Amsterdam|Ajax Amsterdam NED', nl ],
|
73
|
+
[ 'az', 'AZ Alkmaar', nl ],
|
55
74
|
|
56
|
-
[ '
|
57
|
-
[ '
|
75
|
+
[ 'zagreb', 'Dinamo Zagreb|Dinamo Zagreb CRO|NK Dinamo Zagreb', hr ],
|
76
|
+
[ 'olympiacos', 'Olympiakos Piräus|Olympiakos P. GRE|Olympiakos Piraeus', gr ],
|
58
77
|
[ 'nordsjalland', 'FC Nordsjælland|Nordsjaelland DEN|FC Nordsjaelland', dk ],
|
59
|
-
|
60
|
-
[ 'valencia', 'FC Valencia|FC Valencia ESP|CF Valencia', es ],
|
61
|
-
[ 'lille', 'OSC Lille|Lille OSC FRA', fr ],
|
62
78
|
[ 'borissow', 'BATE Borissow|Bate Borisov BLR|Bate Borisov', by ],
|
63
|
-
|
64
|
-
[ 'barcelona', 'FC Barcelona|FC Barcelona ESP', es ],
|
65
|
-
[ 'benfica', 'Benfica Lissabon|Benfica Lis. POR', pt ],
|
66
|
-
[ 'spartak', 'Spartak Moskau|Spartak Moskau RUS|Spartak Moscow', ru ],
|
67
79
|
[ 'celtic', 'Celtic Glasgow|Celtic Glasgow SCO', sc ],
|
68
|
-
|
69
|
-
[ 'braga', 'Sporting Braga|Sporting Braga POR', pt ],
|
70
80
|
[ 'galatasaray', 'Galatasaray|Galatasaray TUR', tr ],
|
71
81
|
[ 'cluj', 'CFR Cluj|CFR Cluj ROU', ro ],
|
72
|
-
|
73
|
-
###################
|
74
|
-
# more teams from cl/el 2011-12
|
75
|
-
#
|
76
|
-
[ 'atletico', 'Atlético Madrid', es ],
|
77
|
-
[ 'athletic', 'Athletic Bilbao', es ],
|
78
|
-
[ 'sporting', 'Sporting Lisboa', pt ],
|
79
|
-
[ 'inter', 'FC Internazionale Milano', it ],
|
80
|
-
[ 'napoli', 'SSC Napoli', it ],
|
81
|
-
[ 'marseille', 'Olympique Marseille', fr ],
|
82
82
|
[ 'basel', 'FC Basel 1893', ch ],
|
83
|
-
[ 'az', 'AZ Alkmaar', nl ],
|
84
|
-
[ 'metalist', 'FC Metalist Kharkiv', ua ],
|
85
|
-
[ 'moskva', 'PFC CSKA Moskva', ru ],
|
86
83
|
[ 'apoel', 'APOEL Nikosia', cy ]
|
87
84
|
|
88
85
|
]
|
data/db/de/teams.rb
CHANGED
@@ -8,24 +8,24 @@
|
|
8
8
|
## nb: three letter codes (tags) taken from official bundesliga.de site
|
9
9
|
|
10
10
|
teams = [
|
11
|
-
[ 'bayern', 'FC Bayern München|Bayern München|Bayern München GER', 'FCB' ],
|
12
|
-
[ 'schalke', 'FC Schalke 04|FC Schalke 04 GER', 'S04' ],
|
13
|
-
[ 'dortmund', 'Borussia Dortmund|Bor. Dortmund|Bor. Dortmund GER', 'BVB' ],
|
14
|
-
[ 'frankfurt', 'Eintracht Frankfurt|E. Frankfurt', 'FFM' ],
|
15
|
-
[ 'hannover', 'Hannover 96', 'H96' ],
|
16
|
-
[ 'leverkusen', 'Bayer 04 Leverkusen|Bay. Leverkusen', 'B04' ],
|
17
|
-
[ 'duesseldorf', 'Fortuna Düsseldorf|F. Düsseldorf', 'F95' ],
|
18
|
-
[ 'hsv', 'Hamburger SV', 'HSV' ],
|
19
|
-
[ 'mainz', '1. FSV Mainz 05', 'M05' ],
|
20
|
-
[ 'mgladbach', "Borussia M'gladbach|Bor. M'gladbach", 'BMG' ],
|
21
|
-
[ 'freiburg', 'SC Freiburg', 'SCF' ],
|
22
|
-
[ 'bremen', 'Werder Bremen', 'BRE' ],
|
23
|
-
[ 'hoffenheim', '1899 Hoffenheim', 'HOF' ],
|
24
|
-
[ 'nuernberg', '1. FC Nürnberg', 'FCN' ],
|
25
|
-
[ 'stuttgart', 'VfB Stuttgart', 'VFB' ],
|
26
|
-
[ 'augsburg', 'FC Augsburg', 'FCA' ],
|
27
|
-
[ 'wolfsburg', 'VfL Wolfsburg', 'WOB' ],
|
28
|
-
[ 'fuerth', 'Greuther Fürth', 'SGF' ]
|
11
|
+
[ 'bayern', 'FC Bayern München|Bayern München|Bayern München GER', 'FCB', 'city:muenchen' ],
|
12
|
+
[ 'schalke', 'FC Schalke 04|FC Schalke 04 GER', 'S04', 'city:gelsenkirchen' ],
|
13
|
+
[ 'dortmund', 'Borussia Dortmund|Bor. Dortmund|Bor. Dortmund GER', 'BVB', 'city:dortmund' ],
|
14
|
+
[ 'frankfurt', 'Eintracht Frankfurt|E. Frankfurt', 'FFM', 'city:frankfurt' ],
|
15
|
+
[ 'hannover', 'Hannover 96', 'H96', 'city:hannover' ],
|
16
|
+
[ 'leverkusen', 'Bayer 04 Leverkusen|Bay. Leverkusen', 'B04', 'city:leverkusen' ],
|
17
|
+
[ 'duesseldorf', 'Fortuna Düsseldorf|F. Düsseldorf', 'F95', 'city:duesseldorf' ],
|
18
|
+
[ 'hsv', 'Hamburger SV', 'HSV', 'city:hamburg' ],
|
19
|
+
[ 'mainz', '1. FSV Mainz 05', 'M05', 'city:mainz' ],
|
20
|
+
[ 'mgladbach', "Borussia M'gladbach|Bor. M'gladbach", 'BMG', 'city:mgladbach' ],
|
21
|
+
[ 'freiburg', 'SC Freiburg', 'SCF', 'city:freiburg' ],
|
22
|
+
[ 'bremen', 'Werder Bremen', 'BRE', 'city:bremen' ],
|
23
|
+
[ 'hoffenheim', '1899 Hoffenheim', 'HOF', 'city:hoffenheim' ],
|
24
|
+
[ 'nuernberg', '1. FC Nürnberg', 'FCN', 'city:nuernberg' ],
|
25
|
+
[ 'stuttgart', 'VfB Stuttgart', 'VFB', 'city:stuttgart' ],
|
26
|
+
[ 'augsburg', 'FC Augsburg', 'FCA', 'city:augsburg' ],
|
27
|
+
[ 'wolfsburg', 'VfL Wolfsburg', 'WOB', 'city:wolfsburg' ],
|
28
|
+
[ 'fuerth', 'Greuther Fürth', 'SGF', 'city:fuerth' ]
|
29
29
|
]
|
30
30
|
|
31
31
|
de = Country.find_by_key!( 'de' )
|
data/db/en/teams.rb
CHANGED
@@ -10,26 +10,26 @@
|
|
10
10
|
## nb: three letter codes (tags) taken from official premierleague.com site
|
11
11
|
|
12
12
|
teams = [
|
13
|
-
[ 'chelsea', 'Chelsea|Chelsea FC|FC Chelsea|FC Chelsea ENG', 'CHE' ],
|
14
|
-
[ 'manunited', 'Manchester United|Man Utd|Manchester U. ENG', 'MUN' ],
|
15
|
-
[ 'mancity', 'Manchester City|Man City|Man. City ENG', 'MCI' ],
|
16
|
-
[ 'arsenal', 'Arsenal|Arsenal FC|FC Arsenal|FC Arsenal ENG', 'ARS' ],
|
17
|
-
[ 'everton', 'Everton|Everton FC|FC Everton', 'EVE' ],
|
18
|
-
[ 'tottenham', 'Tottenham Hotspur|Tottenham', 'TOT' ],
|
19
|
-
[ 'westbrom', 'West Bromwich Albion|West Brom', 'WBA' ],
|
20
|
-
[ 'westham', 'West Ham United|West Ham', 'WHU' ],
|
21
|
-
[ 'fulham', 'Fulham|Fulham FC|FC Fulham', 'FUL' ],
|
22
|
-
[ 'newcastle', 'Newcastle United|Newcastle', 'NEW' ],
|
23
|
-
[ 'swansea', 'Swansea City|Swansea', 'SWA' ],
|
24
|
-
[ 'stoke', 'Stoke City|Stoke', 'STK' ],
|
25
|
-
[ 'sunderland', 'Sunderland|Sunderland AFC|AFC Sunderland', 'SUN' ],
|
26
|
-
[ 'liverpool', 'Liverpool|Liverpool FC|FC Liverpool', 'LIV' ],
|
27
|
-
[ 'wigan', 'Wigan Athletic|Wigan', 'WIG' ],
|
28
|
-
[ 'astonvilla', 'Aston Villa', 'AVL' ],
|
29
|
-
[ 'southampton', 'Southampton|Southampton FC|FC Southampton', 'SOU' ],
|
30
|
-
[ 'reading', 'Reading|Reading FC|FC Reading', 'RDG' ],
|
31
|
-
[ 'norwich', 'Norwich City|Norwich', 'NOR' ],
|
32
|
-
[ 'qpr', 'Queens Park Rangers', 'QPR' ]]
|
13
|
+
[ 'chelsea', 'Chelsea|Chelsea FC|FC Chelsea|FC Chelsea ENG', 'CHE', 'city:london' ],
|
14
|
+
[ 'manunited', 'Manchester United|Man Utd|Manchester U. ENG', 'MUN', 'city:manchester' ],
|
15
|
+
[ 'mancity', 'Manchester City|Man City|Man. City ENG', 'MCI', 'city:manchester' ],
|
16
|
+
[ 'arsenal', 'Arsenal|Arsenal FC|FC Arsenal|FC Arsenal ENG', 'ARS', 'city:london' ],
|
17
|
+
[ 'everton', 'Everton|Everton FC|FC Everton', 'EVE', 'city:liverpool' ],
|
18
|
+
[ 'tottenham', 'Tottenham Hotspur|Tottenham', 'TOT', 'city:london' ],
|
19
|
+
[ 'westbrom', 'West Bromwich Albion|West Brom', 'WBA', 'city:westbrom' ],
|
20
|
+
[ 'westham', 'West Ham United|West Ham', 'WHU', 'city:london' ],
|
21
|
+
[ 'fulham', 'Fulham|Fulham FC|FC Fulham', 'FUL', 'city:london' ],
|
22
|
+
[ 'newcastle', 'Newcastle United|Newcastle', 'NEW', 'city:newcastle' ],
|
23
|
+
[ 'swansea', 'Swansea City|Swansea', 'SWA', 'city:swansea' ],
|
24
|
+
[ 'stoke', 'Stoke City|Stoke', 'STK', 'city:stoke' ],
|
25
|
+
[ 'sunderland', 'Sunderland|Sunderland AFC|AFC Sunderland', 'SUN', 'city:sunderland' ],
|
26
|
+
[ 'liverpool', 'Liverpool|Liverpool FC|FC Liverpool', 'LIV', 'city:liverpool' ],
|
27
|
+
[ 'wigan', 'Wigan Athletic|Wigan', 'WIG', 'city:wigan' ],
|
28
|
+
[ 'astonvilla', 'Aston Villa', 'AVL', 'city:birmingham' ],
|
29
|
+
[ 'southampton', 'Southampton|Southampton FC|FC Southampton', 'SOU', 'city:southampton' ],
|
30
|
+
[ 'reading', 'Reading|Reading FC|FC Reading', 'RDG', 'city:reading' ],
|
31
|
+
[ 'norwich', 'Norwich City|Norwich', 'NOR', 'city:norwich' ],
|
32
|
+
[ 'qpr', 'Queens Park Rangers', 'QPR', 'city:london' ]]
|
33
33
|
|
34
34
|
|
35
35
|
en = Country.find_by_key!( 'en' )
|
data/db/mx/teams.rb
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
teams = [
|
4
|
-
[ 'america', 'Club América', '
|
5
|
-
[ 'atlante', 'Atlante', '
|
6
|
-
[ 'atlas', 'Atlas', '
|
7
|
-
[ 'chivas', 'Guadalajara Chivas', '
|
8
|
-
[ 'cruzazul', 'Cruz Azul', '
|
9
|
-
[ 'jaguares', 'Jaguares de Chiapas', '
|
10
|
-
[ 'leon', 'Club León', '
|
11
|
-
[ 'monarcas', 'Monarcas Morelia', '
|
12
|
-
[ 'monterrey', 'Monterrey', '
|
13
|
-
[ 'pachuca', 'Pachuca', '
|
14
|
-
[ 'puebla', 'Puebla F.C. ', '
|
15
|
-
[ 'queretaro', 'Querétaro F.C.', '
|
16
|
-
[ 'sanluis', 'Club San Luis', '
|
17
|
-
[ 'slaguna', 'Santos Laguna', '
|
18
|
-
[ 'tijuana', 'Club Tijuana', '
|
19
|
-
[ 'toluca', 'Toluca', '
|
20
|
-
[ 'tigres', 'Tigres UANL', '
|
21
|
-
[ 'pumas', 'Pumas UNAM', '
|
4
|
+
[ 'america', 'Club América', 'city:mexico' ],
|
5
|
+
[ 'atlante', 'Atlante', 'city:cancun' ],
|
6
|
+
[ 'atlas', 'Atlas', 'city:guadalajara' ],
|
7
|
+
[ 'chivas', 'Guadalajara Chivas', 'city:guadalajara' ],
|
8
|
+
[ 'cruzazul', 'Cruz Azul', 'city:mexico' ],
|
9
|
+
[ 'jaguares', 'Jaguares de Chiapas', 'city:tuxtla' ],
|
10
|
+
[ 'leon', 'Club León', 'city:leon' ],
|
11
|
+
[ 'monarcas', 'Monarcas Morelia', 'city:morelia' ],
|
12
|
+
[ 'monterrey', 'Monterrey', 'city:monterrey' ],
|
13
|
+
[ 'pachuca', 'Pachuca', 'city:pachuca' ],
|
14
|
+
[ 'puebla', 'Puebla F.C. ', 'city:puebla' ],
|
15
|
+
[ 'queretaro', 'Querétaro F.C.', 'city:queretaro' ],
|
16
|
+
[ 'sanluis', 'Club San Luis', 'city:sanluispotosi' ],
|
17
|
+
[ 'slaguna', 'Santos Laguna', 'city:torreon' ],
|
18
|
+
[ 'tijuana', 'Club Tijuana', 'city:tijuana' ],
|
19
|
+
[ 'toluca', 'Toluca', 'city:toluca' ],
|
20
|
+
[ 'tigres', 'Tigres UANL', 'city:sannicolas' ],
|
21
|
+
[ 'pumas', 'Pumas UNAM', 'city:mexico' ]
|
22
22
|
]
|
23
23
|
|
24
24
|
mx = Country.find_by_key!( 'mx' )
|
data/lib/sportdb.rb
CHANGED
@@ -25,6 +25,7 @@ module SportDB # forward reference; more to come later
|
|
25
25
|
end
|
26
26
|
|
27
27
|
require 'sportdb/models/badge'
|
28
|
+
require 'sportdb/models/city'
|
28
29
|
require 'sportdb/models/country'
|
29
30
|
require 'sportdb/models/event'
|
30
31
|
require 'sportdb/models/event_team'
|
@@ -99,7 +100,11 @@ module SportDB
|
|
99
100
|
GroupTeam.delete_all
|
100
101
|
Round.delete_all
|
101
102
|
Prop.delete_all
|
102
|
-
Country.delete_all
|
103
|
+
Country.delete_all
|
104
|
+
City.delete_all
|
105
|
+
Badge.delete_all
|
106
|
+
League.delete_all
|
107
|
+
Season.delete_all
|
103
108
|
end
|
104
109
|
|
105
110
|
end
|
data/lib/sportdb/cli/runner.rb
CHANGED
@@ -121,7 +121,7 @@ EOS
|
|
121
121
|
puts "Stats:"
|
122
122
|
puts " #{Event.count} events / #{Round.count} rounds / #{Group.count} groups"
|
123
123
|
puts " #{League.count} leagues / #{Season.count} seasons"
|
124
|
-
puts " #{Country.count} countries"
|
124
|
+
puts " #{Country.count} countries / #{City.count} cities"
|
125
125
|
puts " #{Team.count} teams"
|
126
126
|
puts " #{Game.count} games"
|
127
127
|
puts " #{Badge.count} badges"
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module SportDB::Models
|
2
|
+
|
3
|
+
class City < ActiveRecord::Base
|
4
|
+
self.table_name = 'cities'
|
5
|
+
|
6
|
+
belongs_to :country, :class_name => 'Country', :foreign_key => 'country_id'
|
7
|
+
|
8
|
+
def self.create_from_ary!( cities, more_values={} )
|
9
|
+
cities.each do |values|
|
10
|
+
|
11
|
+
## todo/fix: split optional synonyms from title (see team for example)
|
12
|
+
|
13
|
+
## key & title & country required
|
14
|
+
attr = {
|
15
|
+
key: values[0]
|
16
|
+
}
|
17
|
+
|
18
|
+
## title (split of optional synonyms)
|
19
|
+
# e.g. FC Bayern Muenchen|Bayern Muenchen|Bayern
|
20
|
+
titles = values[1].split('|')
|
21
|
+
|
22
|
+
attr[ :title ] = titles[0]
|
23
|
+
## add optional synonyms
|
24
|
+
attr[ :synonyms ] = titles[1..-1].join('|') if titles.size > 1
|
25
|
+
|
26
|
+
attr = attr.merge( more_values )
|
27
|
+
|
28
|
+
## check for optional values
|
29
|
+
values[2..-1].each do |value|
|
30
|
+
if value.is_a? Country
|
31
|
+
attr[ :country_id ] = value.id
|
32
|
+
else
|
33
|
+
# issue warning: unknown type for value
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
City.create!( attr )
|
38
|
+
end # each city
|
39
|
+
end
|
40
|
+
|
41
|
+
end # class Cities
|
42
|
+
|
43
|
+
|
44
|
+
end # module Models::SportDB
|
data/lib/sportdb/models/team.rb
CHANGED
@@ -9,6 +9,7 @@ class Team < ActiveRecord::Base
|
|
9
9
|
has_many :badges # Winner, 2nd, Cupsieger, Aufsteiger, Absteiger, etc.
|
10
10
|
|
11
11
|
belongs_to :country, :class_name => 'Country', :foreign_key => 'country_id'
|
12
|
+
belongs_to :city, :class_name => 'City', :foreign_key => 'city_id'
|
12
13
|
|
13
14
|
|
14
15
|
def self.create_from_ary!( teams, more_values={} )
|
@@ -16,7 +17,7 @@ class Team < ActiveRecord::Base
|
|
16
17
|
|
17
18
|
## key & title required
|
18
19
|
attr = {
|
19
|
-
:
|
20
|
+
key: values[0]
|
20
21
|
}
|
21
22
|
|
22
23
|
## title (split of optional synonyms)
|
@@ -34,8 +35,14 @@ class Team < ActiveRecord::Base
|
|
34
35
|
values[2..-1].each do |value|
|
35
36
|
if value.is_a? Country
|
36
37
|
attr[ :country_id ] = value.id
|
37
|
-
elsif value.
|
38
|
+
elsif value.is_a? City
|
39
|
+
attr[ :city_id ] = value.id
|
40
|
+
elsif value.length == 3 ## assume its a tag (three letters e.g. ITA)
|
38
41
|
attr[ :tag ] = value
|
42
|
+
elsif value =~ /^city:/ ## city:
|
43
|
+
value_city_key = value[5..-1] ## cut off city: prefix
|
44
|
+
value_city = City.find_by_key!( value_city_key )
|
45
|
+
attr[ :city_id ] = value_city.id
|
39
46
|
else
|
40
47
|
attr[ :title2 ] = value
|
41
48
|
end
|
data/lib/sportdb/schema.rb
CHANGED
@@ -15,11 +15,19 @@ def self.up
|
|
15
15
|
|
16
16
|
create_table :countries do |t|
|
17
17
|
t.string :title, :null => false
|
18
|
-
t.string :tag, :null => false # short three letter tag
|
18
|
+
t.string :tag, :null => false # short three letter tag (FIFA country code)
|
19
19
|
t.string :key, :null => false
|
20
20
|
t.timestamps
|
21
21
|
end
|
22
22
|
|
23
|
+
create_table :cities do |t|
|
24
|
+
t.string :title, :null => false
|
25
|
+
t.string :key, :null => false
|
26
|
+
t.string :synonyms # comma separated list of synonyms
|
27
|
+
t.references :country, :null => false
|
28
|
+
t.timestamps
|
29
|
+
end
|
30
|
+
|
23
31
|
create_table :props do |t|
|
24
32
|
t.string :key, :null => false
|
25
33
|
t.string :value, :null => false
|
@@ -33,6 +41,7 @@ create_table :teams do |t|
|
|
33
41
|
t.string :tag # make it not null? - three letter tag (short title)
|
34
42
|
t.string :synonyms # comma separated list of synonyms
|
35
43
|
t.references :country, :null => false
|
44
|
+
t.references :city # NB: city is optional (should be required for clubs e.g. non-national teams)
|
36
45
|
t.boolean :club, :null => false, :default => false # is it a club (not a national team)?
|
37
46
|
t.boolean :national, :null => false, :default => false # is it a national selection team (not a club)?
|
38
47
|
t.timestamps
|
data/lib/sportdb/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sportdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 1
|
10
|
+
version: 0.5.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Gerald Bauer
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-11-
|
18
|
+
date: 2012-11-03 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: activerecord
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- db/at/2012_13/cup_fixtures.rb
|
99
99
|
- db/at/badges.rb
|
100
100
|
- db/at/teams.rb
|
101
|
+
- db/cities.rb
|
101
102
|
- db/cl/2011_12/cl.rb
|
102
103
|
- db/cl/2011_12/el.rb
|
103
104
|
- db/cl/2012_13/cl.rb
|
@@ -139,6 +140,7 @@ files:
|
|
139
140
|
- lib/sportdb/cli/runner.rb
|
140
141
|
- lib/sportdb/loader.rb
|
141
142
|
- lib/sportdb/models/badge.rb
|
143
|
+
- lib/sportdb/models/city.rb
|
142
144
|
- lib/sportdb/models/country.rb
|
143
145
|
- lib/sportdb/models/event.rb
|
144
146
|
- lib/sportdb/models/event_team.rb
|