sportdb-config 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +7 -0
  2. data/HISTORY.md +3 -0
  3. data/Manifest.txt +65 -0
  4. data/README.md +27 -0
  5. data/Rakefile +26 -0
  6. data/config/geos/eng.txt +162 -0
  7. data/config/leagues/eng.txt +40 -0
  8. data/config/leagues/fr.txt +9 -0
  9. data/config/leagues/gr.txt +7 -0
  10. data/config/leagues/sco.txt +19 -0
  11. data/config/teams/al.txt +6 -0
  12. data/config/teams/at.txt +26 -0
  13. data/config/teams/be.txt +58 -0
  14. data/config/teams/bg.txt +6 -0
  15. data/config/teams/by.txt +5 -0
  16. data/config/teams/ca.txt +4 -0
  17. data/config/teams/ch.txt +10 -0
  18. data/config/teams/cy.txt +7 -0
  19. data/config/teams/cz.txt +6 -0
  20. data/config/teams/de.txt +129 -0
  21. data/config/teams/dk.txt +6 -0
  22. data/config/teams/eng.txt +294 -0
  23. data/config/teams/es.txt +148 -0
  24. data/config/teams/fi.txt +6 -0
  25. data/config/teams/fr.txt +98 -0
  26. data/config/teams/ga.txt +5 -0
  27. data/config/teams/gr.txt +87 -0
  28. data/config/teams/hr.txt +9 -0
  29. data/config/teams/hu.txt +5 -0
  30. data/config/teams/ie.txt +5 -0
  31. data/config/teams/is.txt +6 -0
  32. data/config/teams/it.txt +99 -0
  33. data/config/teams/lu.txt +6 -0
  34. data/config/teams/mc.txt +4 -0
  35. data/config/teams/md.txt +4 -0
  36. data/config/teams/mt.txt +6 -0
  37. data/config/teams/mx.txt +30 -0
  38. data/config/teams/nir.txt +6 -0
  39. data/config/teams/nl.txt +45 -0
  40. data/config/teams/no.txt +7 -0
  41. data/config/teams/pl.txt +6 -0
  42. data/config/teams/pt.txt +53 -0
  43. data/config/teams/ro.txt +5 -0
  44. data/config/teams/rs.txt +6 -0
  45. data/config/teams/ru.txt +5 -0
  46. data/config/teams/sco.txt +73 -0
  47. data/config/teams/se.txt +6 -0
  48. data/config/teams/si.txt +5 -0
  49. data/config/teams/sk.txt +5 -0
  50. data/config/teams/tr.txt +39 -0
  51. data/config/teams/ua.txt +5 -0
  52. data/config/teams/us.txt +44 -0
  53. data/config/teams/wal.txt +16 -0
  54. data/lib/sportdb/config.rb +26 -0
  55. data/lib/sportdb/config/config.rb +77 -0
  56. data/lib/sportdb/config/league.rb +118 -0
  57. data/lib/sportdb/config/league_reader.rb +65 -0
  58. data/lib/sportdb/config/structs/team.rb +45 -0
  59. data/lib/sportdb/config/team_reader.rb +108 -0
  60. data/lib/sportdb/config/utils/league_utils.rb +24 -0
  61. data/lib/sportdb/config/utils/season_utils.rb +116 -0
  62. data/lib/sportdb/config/version.rb +35 -0
  63. data/test/helper.rb +10 -0
  64. data/test/test_config.rb +19 -0
  65. data/test/test_league_utils.rb +90 -0
  66. data/test/test_season_utils.rb +29 -0
  67. metadata +189 -0
@@ -0,0 +1,6 @@
1
+ ###############################################
2
+ # Luxembourg (lu)
3
+
4
+
5
+ Jeunesse Esch => Jeunesse d'Esch, Esch-sur-Alzette
6
+ F91 Dudelange => F91 Dudelange, Dudelange
@@ -0,0 +1,4 @@
1
+ #############################################
2
+ ## mc-monaco
3
+
4
+ Monaco => AS Monaco, Monaco
@@ -0,0 +1,4 @@
1
+ ###################################################
2
+ # Moldova
3
+
4
+ Sheriff Tiraspol => FC Sheriff Tiraspol, Tiraspol
@@ -0,0 +1,6 @@
1
+ ###################################
2
+ # Malta (mt)
3
+
4
+
5
+ Valletta => Valletta FC, Valletta
6
+ Sliema Wanderers => Sliema Wanderers FC, Sliema
@@ -0,0 +1,30 @@
1
+
2
+ Club America => Club América, Ciudad de México
3
+ Cruz Azul => Cruz Azul, Ciudad de México
4
+ U.N.A.M.- Pumas => Pumas UNAM, Ciudad de México ## Club Universidad Nacional
5
+
6
+ Guadalajara Chivas => CD Guadalajara Chivas, Guadalajara › Jalisco ## use Zapopan › Jalisco
7
+ Atlas => Club Atlas, Guadalajara › Jalisco
8
+ Leones Negros => Leones Negros U. de G., Guadalajara › Jalisco ## UdeG = Universidad de Guadalajara
9
+
10
+ Monterrey => CF Monterrey, Monterrey › Nuevo León
11
+ U.A.N.L.- Tigres => Tigres UANL, Monterrey › Nuevo León ## San Nicolás de los Garza
12
+
13
+ Lobos BUAP => Lobos BUAP, Puebla › Puebla ## BUAP = Benemérita Universidad Autónoma de Puebla
14
+ Puebla => Club Puebla, Puebla › Puebla
15
+
16
+ Atl. San Luis => Atlético San Luis, San Luis Potosí › San Luis Potosí
17
+ Atlante => Atlante FC, Cancún › Quintana Roo
18
+ Chiapas => Jaguares Chiapas, Tuxtla Gutiérrez › Chiapas ## Chiapas FC or Jaguares de Chiapas
19
+ Club Leon => Club León, León › Guanajuato
20
+ Club Tijuana => Club Tijuana, Tijuana › Baja California
21
+ Dorados de Sinaloa => Dorados Sinaloa, Culiacán › Sinaloa
22
+
23
+ Monarcas => Monarcas Morelia, Morelia › Michoacán
24
+
25
+ Necaxa => Club Necaxa, Aguascalientes › Aguascalientes
26
+ Pachuca => CF Pachuca, Pachuca › Hidalgo
27
+ Queretaro => Querétaro FC, Querétaro › Querétaro
28
+ Santos Laguna => Santos Laguna, Torreón › Coahuila
29
+ Toluca => Deportivo Toluca FC, Toluca › México
30
+ Veracruz => Tiburones Rojos Veracruz, Veracruz › Veracruz ## Boca del Río
@@ -0,0 +1,6 @@
1
+ #################################
2
+ # Northern Ireland (nir)
3
+
4
+
5
+ Linfield => Linfield FC, Belfast
6
+ Glentoran => Glentoran FC, Belfast
@@ -0,0 +1,45 @@
1
+ ##########################################
2
+ # nl-netherlands
3
+
4
+
5
+ Ajax | AFC Ajax => Ajax Amsterdam, Amsterdam › Noord-Holland
6
+
7
+ Feyenoord => Feyenoord Rotterdam, Rotterdam › Zuid-Holland
8
+ Sparta | Sparta Rotterdam => Sparta Rotterdam, Rotterdam › Zuid-Holland
9
+ Excelsior => SBV Excelsior Rotterdam, Rotterdam › Zuid-Holland ## use SBV Excelsior - why? why not?
10
+
11
+
12
+ AZ Alkmaar => AZ Alkmaar, Alkmaar › Noord-Holland
13
+ Cambuur => SC Cambuur, Leeuwarden › Friesland
14
+
15
+ Den Bosch => FC Den Bosch, 's-Hertogenbosch › Noord-Brabant
16
+ Den Haag => ADO Den Haag, Den Haag › Zuid-Holland
17
+ Dordrecht => FC Dordrecht, Dordrecht › Zuid-Holland
18
+ For Sittard => Fortuna Sittard, Sittard › Limburg
19
+ Go Ahead Eagles => Go Ahead Eagles, Deventer › Overijssel
20
+
21
+
22
+ Graafschap => BV De Graafschap, Doetinchem
23
+ Groningen => FC Groningen, Groningen
24
+ Heerenveen => SC Heerenveen, Heerenveen
25
+ Heracles => Heracles Almelo, Almelo
26
+ MVV Maastricht => MVV Maastricht, Maastricht
27
+ NAC Breda => NAC Breda, Breda
28
+ Nijmegen => NEC Nijmegen, Nijmegen
29
+ PSV Eindhoven => PSV Eindhoven, Eindhoven
30
+
31
+ Roda | Roda JC => Roda JC Kerkrade, Kerkrade
32
+
33
+ Roosendaal => RBC Roosendaal, Roosendaal
34
+
35
+
36
+ Twente => FC Twente, Enschede
37
+ Utrecht => FC Utrecht, Utrecht
38
+ VVV Venlo => VVV Venlo, Venlo ## use VVV-Venlo - why? why not?
39
+ Vitesse => Vitesse Arnhem, Arnhem
40
+ Volendam => FC Volendam, Volendam
41
+ Waalwijk => RKC Waalwijk, Waalwijk
42
+
43
+
44
+ Willem II => Willem II Tilburg, Tilburg ## use Willem II - why? why not?
45
+ Zwolle => PEC Zwolle, Zwolle
@@ -0,0 +1,7 @@
1
+ #############################
2
+ # Norway (no)
3
+
4
+
5
+ Rosenborg BK => Rosenborg BK, Trondheim
6
+
7
+
@@ -0,0 +1,6 @@
1
+ #####################################
2
+ # Poland (pl)
3
+
4
+
5
+ Gornik Zabrze => Górnik Zabrze, Zabrze
6
+ Legia Warsaw => Legia Warszawa, Warszawa ## Warsaw [en]
@@ -0,0 +1,53 @@
1
+ #############################################
2
+ ## pt-portugal
3
+
4
+
5
+ Benfica => SL Benfica, Lisboa
6
+ Sp Lisbon => Sporting CP, Lisboa ## Sporting Clube de Portugal
7
+ Belenenses => Os Belenenses, Lisboa
8
+
9
+ Porto => FC Porto, Porto
10
+ Boavista => Boavista FC, Porto
11
+
12
+
13
+ Aves => CD Aves, Aves
14
+ Chaves => GD Chaves, Chaves
15
+ Estoril => Estoril Praia, Estoril
16
+ Feirense => CD Feirense, Santa Maria da Feira
17
+ Guimaraes => Vitória de Guimarães, Guimarães ## Vitória SC
18
+ Maritimo => CS Marítimo, Funchal
19
+ Moreirense => Moreirense FC, Moreira de Cónegos
20
+ Pacos Ferreira => FC Paços de Ferreira, Paços de Ferreira
21
+ Portimonense => Portimonense SC, Portimão
22
+ Rio Ave => Rio Ave FC, Vila do Conde
23
+ Setubal => Vitória de Setúbal, Setúbal ## Vitória FC
24
+ Sp Braga => SC Braga, Braga
25
+ Tondela => CD Tondela, Tondela
26
+
27
+ Academica => Académica de Coimbra, Coimbra ## Associação Académica de Coimbra – Organismo Autónomo de Futebol (AAC–OAF)
28
+ Arouca => FC Arouca, Arouca
29
+ Nacional => CD Nacional Madeira, Funchal ## Clube Desportivo Nacional
30
+ Penafiel => FC Penafiel, Penafiel
31
+
32
+ Beira Mar => SC Beira-Mar, Aveiro
33
+ Desp. Chaves => Desportivo de Chaves, Chaves
34
+ Est Amadora => CF Estrela da Amadora, Amadora
35
+ Farense => SC Farense, Faro
36
+ Gil Vicente => Gil Vicente FC, Barcelos
37
+ Leiria => União de Leiria, Leiria ## União Desportiva de Leiria
38
+ Madeira | Uniao Madeira => União da Madeira, Funchal
39
+ Salgueiros => SC Salgueiros, Paranhos
40
+ Tirsense => FC Tirsense, Santo Tirso
41
+ Campomaior | Campomaiorense => SC Campomaiorense, Campo Maior
42
+ Felgueiras => FC Felgueiras, Felgueiras
43
+ Leca => Leça FC, Leça da Palmeira
44
+
45
+
46
+ Alverca => FC Alverca, Alverca do Ribatejo
47
+ Espinho => Sporting de Espinho, Espinho ## Sporting Clube de Espinho
48
+ Leixoes => Leixões SC, Matosinhos
49
+ Naval => Naval 1º de Maio, Figueira da Foz ## Associação Naval 1º de Maio
50
+ Olhanense => SC Olhanense, Olhão
51
+ Santa Clara => CD Santa Clara, Ponta Delgada
52
+ Trofense => CD Trofense, Tulipa ## Clube Desportivo Trofense
53
+ Varzim => Varzim SC, Póvoa de Varzim
@@ -0,0 +1,5 @@
1
+ ####################################
2
+ # Romania (ro)
3
+
4
+ Steaua Bucuresti => FC Steaua București, Bucharest
5
+ Dinamo Bucuresti => FC Dinamo București, Bucharest
@@ -0,0 +1,6 @@
1
+ ##############################
2
+ # Serbia (rs)
3
+
4
+
5
+ Crvena Zvezda => Red Star Belgrade, Belgrade
6
+ Partizan Belgrade => FK Partizan Belgrade, Belgrade
@@ -0,0 +1,5 @@
1
+ ############################################################
2
+ # Russia (ru)
3
+
4
+ Spartak Moskva => FC Spartak Moskva, Moskva ## Moscow [en]
5
+ CSKA Moskva => PFC CSKA Moskva, Moskva
@@ -0,0 +1,73 @@
1
+ #########################################
2
+ # sco-scotland
3
+
4
+
5
+ Celtic => Celtic FC, Glasgow
6
+ Rangers => Rangers FC, Glasgow
7
+ Partick => Partick Thistle, Glasgow
8
+ Queens Park => Queen's Park, Glasgow
9
+
10
+
11
+ Hearts => Heart of Midlothian FC, Edinburgh ## Gorgie - West of Edinburgh
12
+ Hibernian | Hibernians => Hibernian FC, Edinburgh ## Leith - North of Edinburgh
13
+ Edinburgh City => Edinburgh City, Edinburgh
14
+
15
+ Aberdeen => Aberdeen FC, Aberdeen
16
+
17
+ Dundee => Dundee FC, Dundee ## depends on level (1) for mapping
18
+ Dundee United => Dundee United, Dundee
19
+
20
+ Hamilton => Hamilton Academical FC, Hamilton
21
+ Kilmarnock => Kilmarnock FC, Kilmarnock
22
+ Motherwell => Motherwell FC, Motherwell
23
+ Ross County => Ross County, Dingwall
24
+ St Johnstone => St Johnstone FC, Perth
25
+
26
+
27
+ Brechin => Brechin City, Brechin
28
+ Dumbarton => Dumbarton, Dumbarton
29
+ Dunfermline => Dunfermline Athletic, Dunfermline
30
+ Falkirk => Falkirk, Falkirk
31
+ Morton => Greenock Morton, Greenock
32
+ Inverness C => Inverness Caledonian Thistle, Inverness
33
+ Livingston => Livingston FC, Livingston
34
+ Queen of Sth => Queen of the South, Dumfries
35
+ St Mirren => Saint Mirren FC, Paisley
36
+
37
+
38
+
39
+ ## todo/check/fix: map Airdrie to Airdrieonians - why? why not?
40
+ ##
41
+ ## - x Airdrie (???) - 8 seasons in 1 level
42
+ ## - 2 (8): 2001-02........1994-95 (8)
43
+
44
+ Airdrie Utd | Airdrie => Airdrieonians, Airdrie
45
+
46
+
47
+ Albion Rvs => Albion Rovers, Coatbridge
48
+ Alloa => Alloa Athletic, Alloa
49
+ Arbroath => Arbroath, Arbroath
50
+ Ayr => Ayr United, Ayr
51
+ East Fife => East Fife, Methil
52
+ Forfar => Forfar Athletic, Forfar
53
+ Raith Rvs | Raith => Raith Rovers, Kirkcaldy
54
+ Stranraer => Stranraer, Stranraer
55
+
56
+
57
+
58
+
59
+
60
+ Annan Athletic => Annan Athletic, Annan
61
+ Clyde => Clyde, Cumbernauld
62
+ Cowdenbeath => Cowdenbeath, Cowdenbeath
63
+ Elgin => Elgin City, Elgin
64
+ Montrose => Montrose, Montrose
65
+ Peterhead => Peterhead, Peterhead
66
+ Stenhousemuir => Stenhousemuir, Stenhousemuir
67
+ Stirling => Stirling Albion, Stirling
68
+
69
+
70
+
71
+ Clydebank => Clydebank FC, Clydebank ## see https://en.wikipedia.org/wiki/Clydebank_F.C.
72
+ East Stirling => East Stirlingshire FC, Falkirk ## see https://en.wikipedia.org/wiki/East_Stirlingshire_F.C.
73
+ Gretna => Gretna FC, Gretna ## see https://en.wikipedia.org/wiki/Gretna_F.C.
@@ -0,0 +1,6 @@
1
+ #############################
2
+ # Sweden (se)
3
+
4
+
5
+ Malmo FF => Malmö FF, Malmö
6
+ IFK Goteborg => IFK Göteborg, Göteborg ## Gothenburg [en]
@@ -0,0 +1,5 @@
1
+ ####################################################
2
+ # Slovenia (si)
3
+
4
+
5
+ NK Maribor => NK Maribor, Maribor
@@ -0,0 +1,5 @@
1
+ ##################################################
2
+ # Slovakia (sk)
3
+
4
+
5
+ SK Slovan Bratislava => ŠK Slovan Bratislava, Bratislava
@@ -0,0 +1,39 @@
1
+ ############################################
2
+ ## tr-turkey
3
+ ##
4
+ ## see https://en.wikipedia.org/wiki/Süper_Lig
5
+
6
+
7
+ Fenerbahce => Fenerbahçe İstanbul SK, İstanbul
8
+ Galatasaray => Galatasaray İstanbul AŞ, İstanbul
9
+ Besiktas => Beşiktaş İstanbul JK, İstanbul
10
+ Kasimpasa => Kasımpaşa İstanbul SK, İstanbul
11
+
12
+ ## (double) check if Buyuksehyr matching !?
13
+ Buyuksehyr => İstanbul Başakşehir, İstanbul
14
+
15
+ Genclerbirligi => Gençlerbirliği Ankara SK, Ankara
16
+ Osmanlispor => Osmanlıspor Ankara, Ankara
17
+
18
+ Karabukspor => Kardemir Karabükspor, Karabük
19
+ Elazigspor => Elazığspor, Elazığ
20
+ Eskisehirspor => Eskişehirspor, Eskişehir
21
+
22
+ Akhisar Belediyespor => Akhisar Belediyespor, Akhisar
23
+ Alanyaspor => Alanyaspor, Alanya
24
+ Antalyaspor => Antalyaspor, Antalya
25
+ Bursaspor => Bursaspor, Bursa
26
+ Goztep => Göztepe Izmir, İzmir
27
+ Kayserispor => Kayserispor, Kayseri
28
+ Konyaspor => Konyaspor, Konya
29
+ Sivasspor => Sivasspor, Sivas
30
+ Trabzonspor => Trabzonspor AŞ, Trabzon
31
+ Yeni Malatyaspor => Yeni Malatyaspor, Malatya
32
+
33
+ Adanaspor => Adanaspor, Adana
34
+ Gaziantepspor => Gaziantepspor, Gaziantep
35
+ Rizespor => Çaykur Rizespor, Rize
36
+
37
+ Balikesirspor => Balıkesirspor, Balıkesir
38
+ Erciyesspor => Kayseri Erciyesspor, Kayseri
39
+ Mersin Idman Yurdu => Mersin İdmanyurdu, Mersin
@@ -0,0 +1,5 @@
1
+ ###########################
2
+ # Ukraine (ua)
3
+
4
+ Dinamo Kiev => FC Dynamo Kyiv, Kyiv
5
+ Shakhtar Donetsk => FC Shakhtar Donetsk, Donetsk
@@ -0,0 +1,44 @@
1
+ ######################################################
2
+ # Major League Soccer (MLS) teams
3
+ #
4
+ # note: see ca.txt for Canadian teams
5
+
6
+ Atlanta United => Atlanta United FC (2017-), Atlanta › Georgia
7
+ => Chicago Fire (1998-), Bridgeview › Illinois
8
+ Columbus Crew => Columbus Crew SC (1996-), Columbus › Ohio
9
+ DC United => D.C. United (1996-), Washington › D.C.
10
+ => New England Revolution (1996-), Foxborough › Massachusetts
11
+ => New York City FC (2015-), New York City › New York
12
+ => New York Red Bulls (1996-), Harrison › New Jersey ## note: named >New York/New Jersey MetroStars; MetroStars< from 1996-2005
13
+ Orlando City => Orlando City SC (2015-), Orlando › Florida
14
+ => Philadelphia Union (2010-), Chester › Pennsylvania
15
+
16
+ => Colorado Rapids (1996-), Commerce City › Colorado
17
+ => FC Dallas (1996-), Frisco › Texas ## note: FC Dallas named >Dallas Burn< from 1996-2004
18
+
19
+ => Houston Dynamo (2006-), Houston › Texas
20
+ => LA Galaxy (1996-), Carson › California
21
+ => Los Angeles FC (2018-), Los Angeles › California
22
+ Minnesota United => Minnesota United FC (2017-), Minneapolis › Minnesota
23
+ => Portland Timbers (2011-), Portland › Oregon
24
+ => Real Salt Lake (2005-), Sandy › Utah
25
+ => San Jose Earthquakes (1996-), San Jose › California ## note: named >San Jose Clash< from 1996-1999
26
+ Seattle Sounders => Seattle Sounders FC (2009-), Seattle › Washington
27
+ Sporting KC => Sporting Kansas City (1996-), Kansas City › Kansas ## note: Sporting KC named >Kansas City Wiz / Wizards< from 1996-2010
28
+
29
+
30
+
31
+ ##################################
32
+ ## Defunct / Historic
33
+
34
+ => Tampa Bay Mutiny (1996-2001), Tampa › Florida
35
+ => Miami Fusion (1998-2001), Fort Lauderdale › Florida
36
+ Chivas USA => CD Chivas USA (2005-2014), Carson › California
37
+
38
+
39
+ ####################################
40
+ ## Future / Upcoming
41
+
42
+ => FC Cincinnati (2019-), Cincinnati › Ohio
43
+ => Miami (2020-), Miami › Florida
44
+ => Nashville (2020-), Nashville › Tennessee
@@ -0,0 +1,16 @@
1
+ #########################
2
+ # wal-wales
3
+
4
+
5
+ #######
6
+ # note: teams in english premier league & english league (championship, etc.) !!!!
7
+
8
+ Swansea | Swansea City => Swansea City AFC, Swansea
9
+ Cardiff | Cardiff City => Cardiff City FC, Cardiff
10
+ Wrexham => Wrexham AFC, Wrexham
11
+ Newport County => Newport County AFC, Newport
12
+ Merthyr Town => Merthyr Town FC, Merthyr Tydfil
13
+
14
+ Aberdare Athletic => Aberdare Athletic FC (1893-1928), Aberdare
15
+
16
+ The New Saints => The New Saints FC, Oswestry ## in Shropshire
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+
3
+
4
+ require 'pp'
5
+ require 'date'
6
+ require 'fileutils'
7
+
8
+
9
+
10
+ ###
11
+ # our own code
12
+ require 'sportdb/config/version' # let version always go first
13
+
14
+ require 'sportdb/config/structs/team'
15
+
16
+ require 'sportdb/config/utils/season_utils'
17
+ require 'sportdb/config/utils/league_utils'
18
+
19
+ require 'sportdb/config/league'
20
+ require 'sportdb/config/league_reader'
21
+ require 'sportdb/config/team_reader'
22
+ require 'sportdb/config/config'
23
+
24
+
25
+
26
+ puts SportDb::Boot.banner # say hello
@@ -0,0 +1,77 @@
1
+ # encoding: utf-8
2
+
3
+ module SportDb
4
+ module Import
5
+
6
+
7
+ class Configuration
8
+
9
+ attr_accessor :team_mappings
10
+ attr_accessor :teams
11
+
12
+ attr_accessor :leagues
13
+
14
+
15
+
16
+ def initialize
17
+
18
+ ## unify team names; team (builtin/known/shared) name mappings
19
+ ## cleanup team names - use local ("native") name with umlaut etc.
20
+ recs = []
21
+ %w(de fr mc es it pt nl be tr gr eng wal sco nir at al bg by ch cy cz dk fi ga hr hu ie is lu md mt no pl ro rs ru se si sk ua mx us ca).each do |country|
22
+ recs += TeamReader.from_file( "#{Boot.data_dir}/teams/#{country}.txt" )
23
+ end
24
+
25
+ ############################
26
+ ## add team mappings
27
+ ## alt names to canonical pretty (recommended unique) name
28
+ @team_mappings = {}
29
+
30
+ recs.each do |rec|
31
+ rec.alt_names.each do |alt_name|
32
+ ## todo/fix: warn about duplicates (if key exits) ???????
33
+ @team_mappings[ alt_name ] = rec.name
34
+ end
35
+ end
36
+
37
+ ###
38
+ ## reverse hash for lookup/list of "official / registered(?)"
39
+ ## pretty recommended canonical unique (long form)
40
+ ## team names
41
+
42
+
43
+ ##
44
+ ## todo/fix: move to new TeamConfig class (for reuse) !!!!!!
45
+ @teams = {}
46
+ recs.each do |rec|
47
+ @teams[ rec.name ] = rec
48
+ end
49
+
50
+
51
+ #####
52
+ # add / read-in leagues config
53
+ @leagues = LeagueConfig.new
54
+
55
+
56
+ self ## return self for chaining
57
+ end
58
+ end # class Configuration
59
+
60
+
61
+
62
+
63
+ ## lets you use
64
+ ## SportDb::Import.configure do |config|
65
+ ## config.hello = 'World'
66
+ ## end
67
+
68
+ def self.configure
69
+ yield( config )
70
+ end
71
+
72
+ def self.config
73
+ @config ||= Configuration.new
74
+ end
75
+
76
+ end # module Import
77
+ end # module SportDb