sportdb-readers 0.5.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,7 +20,7 @@ class TestMatchReaderEng < MiniTest::Test
20
20
  end
21
21
 
22
22
 
23
- def xxx_test_read_eng
23
+ def test_read_eng
24
24
  txt =<<TXT
25
25
  = English Premier League 2017/18
26
26
 
@@ -58,7 +58,7 @@ Matchday 2
58
58
  Manchester City 1-1 Everton FC
59
59
  TXT
60
60
 
61
- SportDb::MatchReaderV2.parse( txt )
61
+ SportDb::MatchReader.parse( txt )
62
62
  end # method test_read_eng
63
63
 
64
64
  def test_read_eng_2012_13
@@ -87,7 +87,7 @@ Matchday 20
87
87
  QPR 0-3 Liverpool
88
88
  TXT
89
89
 
90
- SportDb::MatchReaderV2.parse( txt )
90
+ SportDb::MatchReader.parse( txt )
91
91
 
92
92
  puts SportDb::Model::Game.count
93
93
  end
@@ -0,0 +1,156 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_match_reader_euro.rb
6
+
7
+
8
+ require 'helper'
9
+
10
+
11
+ class TestMatchReaderEuro < MiniTest::Test
12
+
13
+ def setup
14
+ SportDb.connect( adapter: 'sqlite3',
15
+ database: ':memory:' )
16
+ SportDb.create_all ## build schema
17
+
18
+ ## turn on logging to console
19
+ ActiveRecord::Base.logger = Logger.new(STDOUT)
20
+ end
21
+
22
+
23
+ def test_read
24
+ txt = <<TXT
25
+ = Euro 2016 # in France
26
+
27
+
28
+ Group A | France Romania Albania Switzerland
29
+ Group B | England Russia Wales Slovakia
30
+ Group C | Germany Ukraine Poland Northern Ireland
31
+ Group D | Spain Czech Republic Turkey Croatia
32
+ Group E | Belgium Italy Ireland Sweden
33
+ Group F | Portugal Iceland Austria Hungary
34
+
35
+
36
+ #############################################
37
+ # Group phase
38
+
39
+ Matchday 1 | Jun/10 - Jun/14
40
+ Matchday 2 | Jun/15 - Jun/18
41
+ Matchday 3 | Jun/19 - Jun/22
42
+
43
+
44
+ Group A:
45
+
46
+ (1) Jun/10 21:00 France 2:1 Romania @ Stade de France, Saint-Denis
47
+ (2) Jun/11 15:00 Albania 0:1 Switzerland @ Stade Bollaert-Delelis, Lens
48
+
49
+ (14) Jun/15 18:00 Romania 1:1 Switzerland @ Parc des Princes, Paris
50
+ (15) Jun/15 21:00 France 2:0 Albania @ Stade Vélodrome, Marseille
51
+
52
+ (25) Jun/19 21:00 Romania 0:1 Albania @ Stade Pierre-Mauroy, Lille
53
+ (26) Jun/19 21:00 Switzerland 0:0 France @ Parc Olympique Lyonnais, Lyon
54
+
55
+
56
+ Group B:
57
+
58
+ (3) Jun/11 18:00 Wales 2:1 Slovakia @ Nouveau Stade de Bordeaux, Bordeaux
59
+ (4) Jun/11 21:00 England 1:1 Russia @ Stade Vélodrome, Marseille
60
+
61
+ (13) Jun/15 15:00 Russia 1:2 Slovakia @ Stade Pierre-Mauroy, Lille
62
+ (16) Jun/16 15:00 England 2:1 Wales @ Stade Bollaert-Delelis, Lens
63
+
64
+ (27) Jun/20 21:00 Russia 0:3 Wales @ Stadium Municipal, Toulouse
65
+ (28) Jun/20 21:00 Slovakia 0:0 England @ Stade Geoffroy-Guichard, Saint-Étienne
66
+
67
+
68
+ Group C:
69
+
70
+ (6) Jun/12 18:00 Poland 1:0 Northern Ireland @ Allianz Riviera, Nice
71
+ (7) Jun/12 21:00 Germany 2:0 Ukraine @ Stade Pierre-Mauroy, Lille
72
+
73
+ (17) Jun/16 18:00 Ukraine 0:2 Northern Ireland @ Parc Olympique Lyonnais, Lyon
74
+ (18) Jun/16 21:00 Germany 0:0 Poland @ Stade de France, Saint-Denis
75
+
76
+ (29) Jun/21 18:00 Northern Ireland 0:1 Germany @ Parc des Princes, Paris
77
+ (30) Jun/21 18:00 Ukraine 0:1 Poland @ Stade Vélodrome, Marseille
78
+
79
+
80
+ Group D:
81
+
82
+ (5) Jun/12 15:00 Turkey 0:1 Croatia @ Parc des Princes, Paris
83
+ (8) Jun/13 15:00 Spain 1:0 Czech Republic @ Stadium Municipal, Toulouse
84
+
85
+ (20) Jun/17 18:00 Czech Republic 2:2 Croatia @ Stade Geoffroy-Guichard, Saint-Étienne
86
+ (21) Jun/17 21:00 Spain 3:0 Turkey @ Allianz Riviera, Nice
87
+
88
+ (31) Jun/21 21:00 Croatia 2:1 Spain @ Nouveau Stade de Bordeaux, Bordeaux
89
+ (32) Jun/21 21:00 Czech Republic 0:2 Turkey @ Stade Bollaert-Delelis, Lens
90
+
91
+
92
+ Group E:
93
+
94
+ (10) Jun/13 21:00 Belgium 0:2 Italy @ Parc Olympique Lyonnais, Lyon
95
+ (9) Jun/13 18:00 Ireland 1:1 Sweden @ Stade de France, Saint-Denis
96
+
97
+ (19) Jun/17 15:00 Italy 1:0 Sweden @ Stadium Municipal, Toulouse
98
+ (22) Jun/18 15:00 Belgium 3:0 Ireland @ Nouveau Stade de Bordeaux, Bordeaux
99
+
100
+ (35) Jun/21 21:00 Italy 0:1 Ireland @ Stade Pierre-Mauroy, Lille
101
+ (36) Jun/21 21:00 Sweden 0:1 Belgium @ Allianz Riviera, Nice
102
+
103
+
104
+ Group F:
105
+
106
+ (11) Jun/14 18:00 Austria 0:2 Hungary @ Nouveau Stade de Bordeaux, Bordeaux
107
+ (12) Jun/14 21:00 Portugal 1:1 Iceland @ Stade Geoffroy-Guichard, Saint-Étienne
108
+
109
+ (23) Jun/18 18:00 Iceland 1:1 Hungary @ Stade Vélodrome, Marseille
110
+ (24) Jun/18 21:00 Portugal 0:0 Austria @ Parc des Princes, Paris
111
+
112
+ (33) Jun/22 18:00 Hungary 3:3 Portugal @ Parc Olympique Lyonnais, Lyon
113
+ (34) Jun/21 18:00 Iceland 2:1 Austria @ Stade de France, Saint-Denis
114
+
115
+
116
+ #############################
117
+ # Knockout phase
118
+
119
+ Round of 16
120
+
121
+ (37) Jun/25 15:00 Switzerland 1:1 0:0nV 4:5iE Poland @ Stade Geoffroy-Guichard, Saint-Étienne
122
+ (38) Jun/25 18:00 Wales 1:0 Northern Ireland @ Parc des Princes, Paris
123
+ (39) Jun/25 21:00 Croatia 0:0 0:1nV Portugal @ Stade Bollaert-Delelis, Lens
124
+
125
+ (40) Jun/26 15:00 France 2:1 Ireland @ Parc Olympique Lyonnais, Lyon
126
+ (41) Jun/26 18:00 Germany 3:0 Slovakia @ Stade Pierre-Mauroy, Lille
127
+ (42) Jun/26 21:00 Hungary 0:4 Belgium @ Stadium Municipal, Toulouse
128
+
129
+ (43) Jun/27 18:00 Italy 2:0 Spain @ Stade de France, Saint-Denis
130
+ (44) Jun/27 21:00 England 1:2 Iceland @ Allianz Riviera, Nice
131
+
132
+
133
+ Quarter-finals
134
+
135
+ (45) Jun/30 21:00 Poland 1:1 0:0nV 3:5iE Portugal @ Stade Vélodrome, Marseille
136
+ (46) Jul/01 21:00 Wales 3:1 Belgium @ Stade Pierre-Mauroy, Lille
137
+ (47) Jul/02 21:00 Germany 1:1 0:0nV 6:5iE Italy @ Nouveau Stade de Bordeaux, Bordeaux
138
+ (48) Jul/03 21:00 France 5:2 Iceland @ Stade de France, Saint-Denis
139
+
140
+
141
+ Semi-finals
142
+
143
+ (49) Jul/06 21:00 Portugal 2:0 Wales @ Parc Olympique Lyonnais, Lyon
144
+ (50) Jul/07 21:00 Germany 0:2 France @ Stade Vélodrome, Marseille
145
+
146
+
147
+ Final
148
+
149
+ (51) Jul/10 21:00 Portugal 0:0 1:0nV France @ Stade de France, Saint-Denis
150
+ TXT
151
+
152
+ SportDb::MatchReader.parse( txt )
153
+ end
154
+ end # class TestMatchReaderEuro
155
+
156
+
@@ -47,19 +47,19 @@ Savanne SC | Savanne Sporting Club
47
47
  TXT
48
48
 
49
49
  recs = SportDb::Import::LeagueReader.parse( leagues_txt )
50
- SportDb::Import::config.leagues.add( recs )
50
+ SportDb::Import.catalog.leagues.add( recs )
51
51
 
52
52
  recs = SportDb::Import::ClubReader.parse( clubs_txt )
53
- SportDb::Import::config.clubs.add( recs )
53
+ SportDb::Import.catalog.clubs.add( recs )
54
54
 
55
55
  pp recs
56
56
 
57
- country = SportDb::Import::config.countries[ 'Mauritius']
57
+ country = SportDb::Import.catalog.countries.find( 'Mauritius' )
58
58
  pp country
59
59
 
60
- clubs = SportDb::Import::config.clubs.match( 'Chamarel SC' )
60
+ clubs = SportDb::Import.catalog.clubs.match( 'Chamarel SC' )
61
61
  pp clubs
62
- club = SportDb::Import::config.clubs.find_by( name: 'Chamarel SC',
62
+ club = SportDb::Import.catalog.clubs.find_by( name: 'Chamarel SC',
63
63
  country: country )
64
64
  pp club
65
65
 
@@ -91,7 +91,7 @@ Matchday 3
91
91
  AS Port-Louis 2000 1-0 La Cure Sylvester
92
92
  TXT
93
93
 
94
- SportDb::MatchReaderV2.parse( txt )
94
+ SportDb::MatchReader.parse( txt )
95
95
  end # method test_read_mauritius
96
96
 
97
97
  end # class TestMatchReaderMu
@@ -24,13 +24,13 @@ class TestReader < MiniTest::Test
24
24
  # path = "../../../openfootball/england/2017-18/.conf.txt"
25
25
  # path = "../../../openfootball/england/2018-19/.conf.txt"
26
26
  # path = "../../../openfootball/england/2019-20/.conf.txt"
27
- recs = SportDb::ConfReaderV2.read( path )
27
+ recs = SportDb::ConfReader.read( path )
28
28
  # path = "../../../openfootball/austria/2018-19/1-bundesliga.txt"
29
29
  path = "../../../openfootball/england/2015-16/1-premierleague-i.txt"
30
30
  # path = "../../../openfootball/england/2017-18/1-premierleague-i.txt"
31
31
  # path = "../../../openfootball/england/2018-19/1-premierleague.txt"
32
32
  # path = "../../../openfootball/england/2019-20/1-premierleague.txt"
33
- recs = SportDb::MatchReaderV2.read( path )
33
+ recs = SportDb::MatchReader.read( path )
34
34
  # path = "../../../openfootball/england/2017-18/1-premierleague-ii.txt"
35
35
  #recs = SportDb::MatchReaderV2.read( path )
36
36
  end # method test_read
@@ -0,0 +1,187 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_reader_champs.rb
6
+
7
+
8
+ require 'helper'
9
+
10
+
11
+ class TestReaderChamps < MiniTest::Test
12
+
13
+ def setup
14
+ SportDb.connect( adapter: 'sqlite3',
15
+ database: ':memory:' )
16
+ SportDb.create_all ## build schema
17
+
18
+ ## turn on logging to console
19
+ ActiveRecord::Base.logger = Logger.new(STDOUT)
20
+ end
21
+
22
+
23
+ def test_read
24
+ txt =<<TXT
25
+ = UEFA Champions League 2017/18
26
+
27
+ Manchester United › ENG
28
+ Liverpool › ENG
29
+ Chelsea › ENG
30
+ Manchester City › ENG
31
+ Tottenham Hotspur › ENG
32
+
33
+ Atlético Madrid › ESP
34
+ Barcelona › ESP
35
+ Sevilla › ESP
36
+ Real Madrid › ESP
37
+
38
+ Roma › ITA
39
+ Juventus › ITA
40
+ Napoli › ITA
41
+
42
+ Bayern München › GER
43
+ Borussia Dortmund › GER
44
+ RB Leipzig › GER
45
+
46
+ Benfica › POR
47
+ Sporting CP › POR
48
+ Porto › POR
49
+
50
+ CSKA Moscow › RUS
51
+ Spartak Moscow › RUS
52
+
53
+ Paris Saint-Germain › FRA
54
+ Basel › SUI
55
+ Celtic › SCO
56
+ Anderlecht › BEL
57
+ Qarabağ › AZE
58
+ Olympiacos › GRE
59
+ Maribor › SVN
60
+ Shakhtar Donetsk › UKR
61
+ Feyenoord › NED
62
+ Beşiktaş › TUR
63
+ Monaco › MCO
64
+ APOEL › CYP
65
+ TXT
66
+
67
+ SportDb::ConfReader.parse( txt )
68
+
69
+
70
+ txt =<<TXT
71
+ = UEFA Champions League 2017/18
72
+
73
+ Round of 16 - 1st Leg
74
+
75
+ [Tue Feb/13]
76
+ 20.45 Juventus 2-2 Tottenham Hotspur @ Juventus Stadium, Turin
77
+ [Higuaín 2', 9' (pen.); Kane 35' Eriksen 71']
78
+ 20.45 Basel 0-4 Manchester City @ St. Jakob-Park, Basel
79
+ [-; Gündoğan 14', 53' B. Silva 18' Agüero 23']
80
+
81
+ [Wed Feb/14]
82
+ 20.45 Porto 0-5 Liverpool @ Estádio do Dragão, Porto
83
+ [-; Mané 25', 53', 85' Salah 29' Firmino 69']
84
+ 20.45 Real Madrid 3-1 Paris Saint-Germain @ Santiago Bernabéu, Madrid
85
+ [Ronaldo 45' (pen.), 83' Marcelo 86'; Rabiot 33']
86
+
87
+ [Tue Feb/20]
88
+ 20.45 Bayern München 5-0 Beşiktaş @ Allianz Arena, München
89
+ [Müller 43', 66' Coman 53' Lewandowski 79', 88']
90
+ 20.45 Chelsea 1-1 Barcelona @ Stamford Bridge, London
91
+ [Willian 62'; Messi 75']
92
+
93
+ [Wed Feb/21]
94
+ 20.45 Shakhtar Donetsk 2-1 Roma @ Metalist Stadium, Kharkiv [†]
95
+ [Ferreyra 52' Fred 71'; Ünder 41']
96
+ 20.45 Sevilla 0-0 Manchester United @ Ramón Sánchez Pizjuán, Seville
97
+
98
+
99
+ Round of 16 - 2nd Leg
100
+
101
+ [Tue Mar/6]
102
+ 20.45 Liverpool 0-0 Porto @ Anfield, Liverpool
103
+ 20.45 Paris Saint-Germain 1-2 Real Madrid @ Parc des Princes, Paris
104
+ [Cavani 71'; Ronaldo 51' Casemiro 80']
105
+
106
+ [Wed Mar/7]
107
+ 20.45 Manchester City 1-2 Basel @ City of Manchester Stadium, Manchester
108
+ [Gabriel Jesus 8'; Elyounoussi 17' Lang 71']
109
+ 20.45 Tottenham Hotspur 1-2 Juventus @ Wembley Stadium, London
110
+ [Son Heung-min 39'; Higuaín 64' Dybala 67']
111
+
112
+ [Tue Mar/13]
113
+ 20.45 Roma 1-0 Shakhtar Donetsk @ Stadio Olimpico, Rome
114
+ [Džeko 52']
115
+ 20.45 Manchester United 1-2 Sevilla @ Old Trafford, Manchester
116
+ [Lukaku 84'; Ben Yedder 74', 78']
117
+
118
+ [Wed Mar/14]
119
+ 20.45 Barcelona 3-0 Chelsea @ Camp Nou, Barcelona
120
+ [Messi 3', 63' Dembélé 20']
121
+ 18.00 Beşiktaş 1-3 Bayern München @ Vodafone Park, Istanbul
122
+ [Vágner Love 59'; Thiago 18' Gönül 46' (o.g.) Wagner 84']
123
+
124
+
125
+ Quarter-finals - 1st Leg
126
+
127
+ [Tue Apr/3]
128
+ 20.45 Juventus 0-3 Real Madrid @ Juventus Stadium, Turin
129
+ [-; Ronaldo 3', 64' Marcelo 72']
130
+ 20.45 Sevilla 1-2 Bayern München @ Ramón Sánchez Pizjuán, Seville
131
+ [Sarabia 31'; Navas 37' (o.g.) Thiago 68']
132
+
133
+ [Wed Apr/4]
134
+ 20.45 Barcelona 4-1 Roma @ Camp Nou, Barcelona
135
+ [De Rossi 38' (o.g.) Manolas 55' (o.g.) Piqué 59' L. Suárez 87'; Džeko 80']
136
+ 20.45 Liverpool 3-0 Manchester City @ Anfield, Liverpool
137
+ [Salah 12' Oxlade-Chamberlain 21' Mané 31']
138
+
139
+
140
+ Quarter-finals - 2nd Leg
141
+
142
+ [Tue Apr/10]
143
+ 20.45 Roma 3-0 Barcelona @ Stadio Olimpico, Rome
144
+ [Džeko 6' De Rossi 58' (pen.) Manolas 82']
145
+ 20.45 Manchester City 1-2 Liverpool @ City of Manchester Stadium, Manchester
146
+ [Gabriel Jesus 2'; Salah 56' Firmino 77']
147
+
148
+ [Wed Apr/11]
149
+ 20.45 Real Madrid 1-3 Juventus @ Santiago Bernabéu, Madrid
150
+ [Ronaldo 90+8' (pen.); Mandžukić 2', 37' Matuidi 61']
151
+ 20.45 Bayern München 0-0 Sevilla @ Allianz Arena, München
152
+
153
+
154
+
155
+ Semi-finals - 1st Leg
156
+
157
+ [Tue Apr/24]
158
+ 20.45 Liverpool 5-2 Roma @ Anfield, Liverpool
159
+ [Salah 36', 45+1' Mané 56' Firmino 61', 69'; Džeko 81' Perotti 85' (pen.)]
160
+
161
+ [Wed Apr/25]
162
+ 20.45 Bayern München 1-2 Real Madrid @ Allianz Arena, München
163
+ [Kimmich 28'; Marcelo 44' Asensio 57']
164
+
165
+
166
+ Semi-finals - 2nd Leg
167
+
168
+ [Tue May/1]
169
+ 20.45 Real Madrid 2-2 Bayern München @ Santiago Bernabéu, Madrid
170
+ [Benzema 11', 46'; Kimmich 3' Rodríguez 63']
171
+
172
+ [Wed May/2]
173
+ 20.45 Roma 4-2 Liverpool @ Stadio Olimpico, Rome
174
+ [Milner 15' (o.g.) Džeko 52' Nainggolan 86', 90+4' (pen.); Mané 9' Wijnaldum 25']
175
+
176
+ Final
177
+
178
+ [Sat May/26]
179
+ 20.45 Real Madrid 3-1 Liverpool @ NSC Olimpiyskiy Stadium, Kiev
180
+ [Benzema 51' Bale 64', 83'; Mané 55']
181
+ TXT
182
+
183
+ SportDb::MatchReader.parse( txt )
184
+ end
185
+
186
+
187
+ end # class TestReaderChamps
metadata CHANGED
@@ -1,57 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportdb-readers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-20 00:00:00.000000000 Z
11
+ date: 2020-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: sportdb-config
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 0.9.0
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: 0.9.0
27
- - !ruby/object:Gem::Dependency
28
- name: sportdb-models
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 1.18.6
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: 1.18.6
41
13
  - !ruby/object:Gem::Dependency
42
14
  name: sportdb-sync
43
15
  requirement: !ruby/object:Gem::Requirement
44
16
  requirements:
45
17
  - - ">="
46
18
  - !ruby/object:Gem::Version
47
- version: 0.1.0
19
+ version: 1.1.0
48
20
  type: :runtime
49
21
  prerelease: false
50
22
  version_requirements: !ruby/object:Gem::Requirement
51
23
  requirements:
52
24
  - - ">="
53
25
  - !ruby/object:Gem::Version
54
- version: 0.1.0
26
+ version: 1.1.0
55
27
  - !ruby/object:Gem::Dependency
56
28
  name: rdoc
57
29
  requirement: !ruby/object:Gem::Requirement
@@ -88,25 +60,28 @@ extensions: []
88
60
  extra_rdoc_files:
89
61
  - CHANGELOG.md
90
62
  - Manifest.txt
63
+ - NOTES.md
91
64
  - README.md
92
65
  files:
93
66
  - CHANGELOG.md
94
67
  - Manifest.txt
68
+ - NOTES.md
95
69
  - README.md
96
70
  - Rakefile
97
71
  - lib/sportdb/readers.rb
98
- - lib/sportdb/readers/conf_linter.rb
99
72
  - lib/sportdb/readers/conf_reader.rb
100
- - lib/sportdb/readers/league_outline_reader.rb
101
- - lib/sportdb/readers/match_linter.rb
102
73
  - lib/sportdb/readers/match_reader.rb
103
74
  - lib/sportdb/readers/package.rb
104
75
  - lib/sportdb/readers/version.rb
105
76
  - test/helper.rb
77
+ - test/test_conf_reader.rb
78
+ - test/test_match_reader_champs.rb
106
79
  - test/test_match_reader_eng.rb
80
+ - test/test_match_reader_euro.rb
107
81
  - test/test_match_reader_mu.rb
108
82
  - test/test_read.rb
109
83
  - test/test_reader.rb
84
+ - test/test_reader_champs.rb
110
85
  homepage: https://github.com/sportdb/sport.db
111
86
  licenses:
112
87
  - Public Domain