sportdb-readers 1.1.2 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +2 -0
- data/Manifest.txt +0 -9
- data/README.md +13 -15
- data/Rakefile +4 -4
- data/lib/sportdb/readers/conf_reader.rb +2 -3
- data/lib/sportdb/readers/match_reader.rb +80 -45
- data/lib/sportdb/readers/version.rb +3 -4
- data/lib/sportdb/readers.rb +5 -5
- metadata +20 -24
- data/test/helper.rb +0 -23
- data/test/test_conf_reader.rb +0 -78
- data/test/test_match_reader_champs.rb +0 -487
- data/test/test_match_reader_eng.rb +0 -95
- data/test/test_match_reader_euro.rb +0 -156
- data/test/test_match_reader_mu.rb +0 -97
- data/test/test_read.rb +0 -35
- data/test/test_reader.rb +0 -37
- data/test/test_reader_champs.rb +0 -187
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1298cb753fdadf33ad2bc2a8c756b16fc9abc06d12ba54705a9d8dc970f0fb5d
|
4
|
+
data.tar.gz: 4b367725fe4e6c18d77bc822152d9da086aa713519f2d676a26ef23ee2e48714
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 202056abc1d45c64ae2ce8855841b71a130e80db244d5d2b2e279b77c4f839588dee9094cdb2780d20678c36bf3e1eb3b340946f23f7e7ab48db8966238d1f5f
|
7
|
+
data.tar.gz: '062494236d53dd2fa51209a520cfd0c3507a3750a802864f462b749d1188d0c13c68fa3679f1fe6839daed570589399ef34407566bb95a7d7fce038abd15d290'
|
data/CHANGELOG.md
CHANGED
data/Manifest.txt
CHANGED
@@ -8,12 +8,3 @@ lib/sportdb/readers/conf_reader.rb
|
|
8
8
|
lib/sportdb/readers/match_reader.rb
|
9
9
|
lib/sportdb/readers/package.rb
|
10
10
|
lib/sportdb/readers/version.rb
|
11
|
-
test/helper.rb
|
12
|
-
test/test_conf_reader.rb
|
13
|
-
test/test_match_reader_champs.rb
|
14
|
-
test/test_match_reader_eng.rb
|
15
|
-
test/test_match_reader_euro.rb
|
16
|
-
test/test_match_reader_mu.rb
|
17
|
-
test/test_read.rb
|
18
|
-
test/test_reader.rb
|
19
|
-
test/test_reader_champs.rb
|
data/README.md
CHANGED
@@ -5,7 +5,6 @@
|
|
5
5
|
* bugs :: [github.com/sportdb/sport.db/issues](https://github.com/sportdb/sport.db/issues)
|
6
6
|
* gem :: [rubygems.org/gems/sportdb-readers](https://rubygems.org/gems/sportdb-readers)
|
7
7
|
* rdoc :: [rubydoc.info/gems/sportdb-readers](http://rubydoc.info/gems/sportdb-readers)
|
8
|
-
* forum :: [opensport](http://groups.google.com/group/opensport)
|
9
8
|
|
10
9
|
|
11
10
|
|
@@ -20,9 +19,7 @@ as an example:
|
|
20
19
|
``` ruby
|
21
20
|
require 'sportdb/readers'
|
22
21
|
|
23
|
-
SportDb.
|
24
|
-
database: './england.db' )
|
25
|
-
SportDb.create_all ## build database schema (tables, indexes, etc.)
|
22
|
+
SportDb.open( './england.db' )
|
26
23
|
```
|
27
24
|
|
28
25
|
**Step 2**
|
@@ -53,15 +50,14 @@ Matchday 1
|
|
53
50
|
...
|
54
51
|
```
|
55
52
|
|
56
|
-
(Source: [england/2015-16/1-premierleague
|
53
|
+
(Source: [england/2015-16/1-premierleague.txt](https://github.com/openfootball/england/blob/master/2015-16/1-premierleague.txt))
|
57
54
|
|
58
55
|
and let's try:
|
59
56
|
|
60
57
|
``` ruby
|
61
58
|
## assumes football.db datasets for England in ./england directory
|
62
59
|
## see github.com/openfootball/england
|
63
|
-
SportDb.read( './england/2015-16/1-premierleague
|
64
|
-
SportDb.read( './england/2015-16/1-premierleague-ii.txt' )
|
60
|
+
SportDb.read( './england/2015-16/1-premierleague.txt' )
|
65
61
|
|
66
62
|
## let's try another season
|
67
63
|
SportDb.read( './england/2019-20/1-premierleague.txt' )
|
@@ -83,14 +79,14 @@ pl_2015_16.teams.count #=> 20
|
|
83
79
|
# INNER JOIN events_teams ON teams.id = events_teams.team_id
|
84
80
|
# WHERE events_teams.event_id = 1
|
85
81
|
|
86
|
-
pl_2015_16.
|
87
|
-
#=> SELECT COUNT(*) FROM
|
88
|
-
# INNER JOIN rounds ON
|
82
|
+
pl_2015_16.matches.count #=> 380
|
83
|
+
#=> SELECT COUNT(*) FROM matches
|
84
|
+
# INNER JOIN rounds ON matches.round_id = rounds.id
|
89
85
|
# WHERE rounds.event_id = 1
|
90
86
|
|
91
87
|
pl_2019_20 = Event.find_by( key: 'eng.1.2019/20' )
|
92
88
|
pl_2015_16.teams.count #=> 20
|
93
|
-
pl_2015_16.
|
89
|
+
pl_2015_16.matches.count #=> 380
|
94
90
|
|
95
91
|
# -or-
|
96
92
|
|
@@ -139,7 +135,7 @@ Round, Date, Team 1, FT, HT, Team 2
|
|
139
135
|
```
|
140
136
|
(Source: [england/2019-20/eng.1.csv](https://github.com/footballcsv/england/blob/master/2010s/2019-20/eng.1.csv))
|
141
137
|
|
142
|
-
Yes, you can. See the [sportdb-importers library / gem »](https://github.com/sportdb/sport.db/tree/master/sportdb-importers)
|
138
|
+
Yes, you can. See the [sportdb-importers library / gem »](https://github.com/sportdb/sport.db/tree/master/sportdb-importers)
|
143
139
|
|
144
140
|
|
145
141
|
|
@@ -151,6 +147,8 @@ Use it as you please with no restrictions whatsoever.
|
|
151
147
|
|
152
148
|
## Questions? Comments?
|
153
149
|
|
154
|
-
|
155
|
-
[
|
156
|
-
|
150
|
+
Yes, you can. More than welcome.
|
151
|
+
See [Help & Support »](https://github.com/openfootball/help)
|
152
|
+
|
153
|
+
|
154
|
+
|
data/Rakefile
CHANGED
@@ -8,10 +8,10 @@ Hoe.spec 'sportdb-readers' do
|
|
8
8
|
self.summary = "sportdb-readers - sport.db readers for leagues, seasons, clubs, match schedules and results, and more"
|
9
9
|
self.description = summary
|
10
10
|
|
11
|
-
self.urls =
|
11
|
+
self.urls = { home: 'https://github.com/sportdb/sport.db' }
|
12
12
|
|
13
13
|
self.author = 'Gerald Bauer'
|
14
|
-
self.email = '
|
14
|
+
self.email = 'gerald.bauer@gmail.com'
|
15
15
|
|
16
16
|
# switch extension to .markdown for gihub formatting
|
17
17
|
self.readme_file = 'README.md'
|
@@ -20,11 +20,11 @@ Hoe.spec 'sportdb-readers' do
|
|
20
20
|
self.licenses = ['Public Domain']
|
21
21
|
|
22
22
|
self.extra_deps = [
|
23
|
-
['sportdb-sync', '>= 1.
|
23
|
+
['sportdb-sync', '>= 1.2.2'],
|
24
24
|
]
|
25
25
|
|
26
26
|
self.spec_extras = {
|
27
|
-
required_ruby_version: '>=
|
27
|
+
required_ruby_version: '>= 3.1.0'
|
28
28
|
}
|
29
29
|
|
30
30
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
|
3
2
|
module SportDb
|
4
3
|
|
@@ -43,8 +42,8 @@ class ConfReader ## todo/check: rename to EventsReaderV2 (use plural?) why? w
|
|
43
42
|
else
|
44
43
|
conf.each do |name, _|
|
45
44
|
## note: rank and standing gets ignored (not used) for now
|
46
|
-
teams << catalog.clubs.find_by!( name:
|
47
|
-
|
45
|
+
teams << catalog.clubs.find_by!( name: name,
|
46
|
+
league: league )
|
48
47
|
end
|
49
48
|
end
|
50
49
|
else ### assume national teams
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
|
3
2
|
module SportDb
|
4
3
|
|
@@ -24,43 +23,22 @@ class MatchReader ## todo/check: rename to MatchReaderV2 (use plural?) why? w
|
|
24
23
|
secs = LeagueOutlineReader.parse( @txt, season: season )
|
25
24
|
pp secs
|
26
25
|
|
27
|
-
|
28
|
-
###
|
29
|
-
## todo/check/fix: move to LeagueOutlineReader for (re)use - why? why not?
|
30
|
-
## use sec[:lang] or something?
|
31
|
-
langs = { ## map country keys to lang codes
|
32
|
-
'de' => 'de', ## de - Deutsch (German)
|
33
|
-
'at' => 'de',
|
34
|
-
'ch' => 'de',
|
35
|
-
'fr' => 'fr', ## fr - French
|
36
|
-
'it' => 'it', ## it - Italian
|
37
|
-
'es' => 'es', ## es - Español (Spanish)
|
38
|
-
'mx' => 'es',
|
39
|
-
'ar' => 'es', ## Argentina
|
40
|
-
'pt' => 'pt', ## pt - Português (Portuguese)
|
41
|
-
'br' => 'pt',
|
42
|
-
}
|
43
|
-
|
44
26
|
secs.each do |sec| ## sec(tion)s
|
45
27
|
season = sec[:season]
|
46
28
|
league = sec[:league]
|
47
29
|
stage = sec[:stage]
|
48
30
|
lines = sec[:lines]
|
49
31
|
|
50
|
-
## hack for now: switch lang
|
51
|
-
## todo/fix: set lang for now depending on league country!!!
|
52
|
-
if league.intl? ## todo/fix: add intl? to ActiveRecord league!!!
|
53
|
-
Import.config.lang = 'en'
|
54
|
-
else ## assume national/domestic
|
55
|
-
Import.config.lang = langs[ league.country.key ] || 'en'
|
56
|
-
end
|
57
|
-
|
58
32
|
### check if event info availabe - use start_date;
|
59
33
|
## otherwise we have to guess (use a "synthetic" start_date)
|
60
34
|
event_info = catalog.events.find_by( season: season,
|
61
35
|
league: league )
|
62
36
|
|
63
37
|
start = if event_info && event_info.start_date
|
38
|
+
puts "event info found:"
|
39
|
+
puts " using start date from event: "
|
40
|
+
pp event_info
|
41
|
+
pp event_info.start_date
|
64
42
|
event_info.start_date
|
65
43
|
else
|
66
44
|
if season.year?
|
@@ -71,45 +49,101 @@ class MatchReader ## todo/check: rename to MatchReaderV2 (use plural?) why? w
|
|
71
49
|
end
|
72
50
|
|
73
51
|
|
74
|
-
|
75
|
-
|
76
|
-
|
52
|
+
parser = MatchParser.new( lines,
|
53
|
+
start ) ## note: keep season start_at date for now (no need for more specific stage date need for now)
|
54
|
+
|
55
|
+
auto_conf_teams, matches, rounds, groups = parser.parse
|
56
|
+
|
57
|
+
puts ">>> #{auto_conf_teams.size} teams:"
|
58
|
+
pp auto_conf_teams
|
59
|
+
puts ">>> #{matches.size} matches:"
|
60
|
+
## pp matches
|
61
|
+
puts ">>> #{rounds.size} rounds:"
|
62
|
+
pp rounds
|
63
|
+
puts ">>> #{groups.size} groups:"
|
64
|
+
pp groups
|
65
|
+
|
66
|
+
|
77
67
|
|
78
68
|
## step 1: map/find teams
|
79
69
|
|
80
70
|
## note: loop over keys (holding the names); values hold the usage counter!! e.g. 'Arsenal' => 2, etc.
|
81
71
|
mods = nil
|
82
72
|
if league.clubs? && league.intl? ## todo/fix: add intl? to ActiveRecord league!!!
|
73
|
+
|
74
|
+
## quick hack - use "dynamic" keys for keys
|
75
|
+
uefa_el_q = catalog.leagues.match_by( code: 'uefa.el.quali' )[0]
|
76
|
+
uefa_cl_q = catalog.leagues.match_by( code: 'uefa.cl.quali' )[0]
|
77
|
+
uefa_cl = catalog.leagues.match_by( code: 'uefa.cl' )[0]
|
78
|
+
uefa_el = catalog.leagues.match_by( code: 'uefa.el' )[0]
|
79
|
+
|
80
|
+
pp [uefa_el_q, uefa_cl_q, uefa_cl, uefa_el]
|
81
|
+
|
83
82
|
### quick hack mods for popular/known ambigious club names
|
84
83
|
## todo/fix: make more generic / reuseable!!!!
|
85
84
|
mods = {}
|
86
85
|
## europa league uses same mods as champions league
|
87
|
-
mods[
|
88
|
-
mods[
|
89
|
-
mods[
|
90
|
-
mods[
|
86
|
+
mods[ uefa_el_q.key ] =
|
87
|
+
mods[ uefa_cl_q.key ] =
|
88
|
+
mods[ uefa_el.key ] =
|
89
|
+
mods[ uefa_cl.key ] = catalog.clubs.build_mods(
|
91
90
|
{ 'Liverpool | Liverpool FC' => 'Liverpool FC, ENG',
|
92
91
|
'Arsenal | Arsenal FC' => 'Arsenal FC, ENG',
|
93
92
|
'Barcelona' => 'FC Barcelona, ESP',
|
94
|
-
'Valencia' => 'Valencia CF, ESP'
|
93
|
+
'Valencia' => 'Valencia CF, ESP',
|
94
|
+
'Rangers FC' => 'Rangers FC, SCO',
|
95
|
+
})
|
95
96
|
end
|
96
97
|
|
97
|
-
|
98
|
+
# puts " [debug] auto_conf_teams:"
|
99
|
+
# pp auto_conf_teams
|
100
|
+
|
101
|
+
|
102
|
+
## todo/fix
|
103
|
+
## ** !!! ERROR - too many matches (2) for club >Barcelona<:
|
104
|
+
## [<Club: FC Barcelona (ESP)>, <Club: Barcelona Guayaquil (ECU)>]
|
105
|
+
|
106
|
+
puts "league:"
|
107
|
+
pp league
|
108
|
+
|
109
|
+
teams = catalog.teams.find_by!( name: auto_conf_teams,
|
98
110
|
league: league,
|
99
111
|
mods: mods )
|
100
112
|
|
113
|
+
puts " [debug] teams:"
|
114
|
+
pp teams
|
115
|
+
|
116
|
+
|
101
117
|
## build mapping - name => team struct record
|
102
|
-
team_mapping = auto_conf_teams.
|
118
|
+
team_mapping = auto_conf_teams.zip( teams ).to_h
|
103
119
|
|
120
|
+
puts " [debug] team_mapping:"
|
121
|
+
pp team_mapping
|
104
122
|
|
105
|
-
parser = MatchParser.new( lines,
|
106
|
-
team_mapping,
|
107
|
-
start ) ## note: keep season start_at date for now (no need for more specific stage date need for now)
|
108
123
|
|
109
|
-
|
124
|
+
## quick (and dirty) hack
|
125
|
+
## update all team strings with mapped records
|
126
|
+
matches.each do |match|
|
127
|
+
match.update( team1: team_mapping[ match.team1 ] )
|
128
|
+
match.update( team2: team_mapping[ match.team2 ] )
|
129
|
+
end
|
110
130
|
|
111
|
-
|
112
|
-
|
131
|
+
## quick hack cont.
|
132
|
+
## rebuild groups with all team strings with mapped records
|
133
|
+
groups = groups.map do |old_group|
|
134
|
+
group = Import::Group.new(
|
135
|
+
name: old_group.name,
|
136
|
+
teams: old_group.teams.map {|team| team_mapping[team] }
|
137
|
+
)
|
138
|
+
group
|
139
|
+
end
|
140
|
+
puts "groups:"
|
141
|
+
pp groups
|
142
|
+
|
143
|
+
## fix
|
144
|
+
## !! ERROR - no (cached) team rec found for team in group >Group A<
|
145
|
+
## for >#<Sports::Club:0x000002c7e1686040><
|
146
|
+
### update sync group to check for records (use .name) !!!
|
113
147
|
|
114
148
|
|
115
149
|
######################################################
|
@@ -151,10 +185,10 @@ class MatchReader ## todo/check: rename to MatchReaderV2 (use plural?) why? w
|
|
151
185
|
## e.g. group.teams assumes an array of team names e.g.
|
152
186
|
## ["Spain", "Czech Republic", "Turkey", "Croatia"]
|
153
187
|
group_team_ids = []
|
154
|
-
group.teams.each do |
|
155
|
-
team_rec = cache_team_recs[
|
188
|
+
group.teams.each do |team|
|
189
|
+
team_rec = cache_team_recs[ team.name ]
|
156
190
|
if team_rec.nil? ## assume team MUST always be present/known in mapping (via autoconfig parser)
|
157
|
-
puts "!! ERROR - no (cached) team rec found for team in group >#{group.name}< for >#{
|
191
|
+
puts "!! ERROR - no (cached) team rec found for team in group >#{group.name}< for >#{team}<"
|
158
192
|
exit 1
|
159
193
|
end
|
160
194
|
group_team_ids << team_rec.id
|
@@ -167,6 +201,7 @@ class MatchReader ## todo/check: rename to MatchReaderV2 (use plural?) why? w
|
|
167
201
|
round_rec = Sync::Round.find_or_create( round, event: event_rec ) ## check: use/rename to EventRound why? why not?
|
168
202
|
end
|
169
203
|
|
204
|
+
|
170
205
|
matches.each do |match|
|
171
206
|
## note: pass along stage (if present): stage - optional from heading!!!!
|
172
207
|
match = match.update( stage: stage ) if stage
|
@@ -1,12 +1,11 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
|
3
2
|
|
4
3
|
module SportDb
|
5
4
|
module Readers
|
6
5
|
|
7
6
|
MAJOR = 1 ## todo: namespace inside version or something - why? why not??
|
8
|
-
MINOR =
|
9
|
-
PATCH =
|
7
|
+
MINOR = 2
|
8
|
+
PATCH = 1
|
10
9
|
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
11
10
|
|
12
11
|
def self.version
|
@@ -14,7 +13,7 @@ module Readers
|
|
14
13
|
end
|
15
14
|
|
16
15
|
def self.banner
|
17
|
-
"sportdb-readers/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
16
|
+
"sportdb-readers/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}] in (#{root})"
|
18
17
|
end
|
19
18
|
|
20
19
|
def self.root
|
data/lib/sportdb/readers.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
|
3
2
|
require 'sportdb/sync'
|
4
3
|
|
5
4
|
|
6
5
|
###
|
7
6
|
# our own code
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
require_relative 'readers/version' # let version always go first
|
8
|
+
require_relative 'readers/conf_reader'
|
9
|
+
require_relative 'readers/match_reader'
|
10
|
+
require_relative 'readers/package'
|
11
|
+
|
12
12
|
|
13
13
|
|
14
14
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sportdb-readers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sportdb-sync
|
@@ -16,45 +16,51 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.2.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.2.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rdoc
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '4.0'
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '7'
|
34
37
|
type: :development
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- - "
|
41
|
+
- - ">="
|
39
42
|
- !ruby/object:Gem::Version
|
40
43
|
version: '4.0'
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '7'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: hoe
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
51
|
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
53
|
+
version: '4.1'
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
58
|
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
60
|
+
version: '4.1'
|
55
61
|
description: sportdb-readers - sport.db readers for leagues, seasons, clubs, match
|
56
62
|
schedules and results, and more
|
57
|
-
email:
|
63
|
+
email: gerald.bauer@gmail.com
|
58
64
|
executables: []
|
59
65
|
extensions: []
|
60
66
|
extra_rdoc_files:
|
@@ -73,20 +79,11 @@ files:
|
|
73
79
|
- lib/sportdb/readers/match_reader.rb
|
74
80
|
- lib/sportdb/readers/package.rb
|
75
81
|
- lib/sportdb/readers/version.rb
|
76
|
-
- test/helper.rb
|
77
|
-
- test/test_conf_reader.rb
|
78
|
-
- test/test_match_reader_champs.rb
|
79
|
-
- test/test_match_reader_eng.rb
|
80
|
-
- test/test_match_reader_euro.rb
|
81
|
-
- test/test_match_reader_mu.rb
|
82
|
-
- test/test_read.rb
|
83
|
-
- test/test_reader.rb
|
84
|
-
- test/test_reader_champs.rb
|
85
82
|
homepage: https://github.com/sportdb/sport.db
|
86
83
|
licenses:
|
87
84
|
- Public Domain
|
88
85
|
metadata: {}
|
89
|
-
post_install_message:
|
86
|
+
post_install_message:
|
90
87
|
rdoc_options:
|
91
88
|
- "--main"
|
92
89
|
- README.md
|
@@ -96,16 +93,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
96
93
|
requirements:
|
97
94
|
- - ">="
|
98
95
|
- !ruby/object:Gem::Version
|
99
|
-
version:
|
96
|
+
version: 3.1.0
|
100
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
98
|
requirements:
|
102
99
|
- - ">="
|
103
100
|
- !ruby/object:Gem::Version
|
104
101
|
version: '0'
|
105
102
|
requirements: []
|
106
|
-
|
107
|
-
|
108
|
-
signing_key:
|
103
|
+
rubygems_version: 3.4.10
|
104
|
+
signing_key:
|
109
105
|
specification_version: 4
|
110
106
|
summary: sportdb-readers - sport.db readers for leagues, seasons, clubs, match schedules
|
111
107
|
and results, and more
|
data/test/helper.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
## note: use the local version of sportdb gems
|
2
|
-
$LOAD_PATH.unshift( File.expand_path( '../sportdb-formats/lib' ))
|
3
|
-
$LOAD_PATH.unshift( File.expand_path( '../sportdb-catalogs/lib' ))
|
4
|
-
$LOAD_PATH.unshift( File.expand_path( '../sportdb-models/lib' ))
|
5
|
-
$LOAD_PATH.unshift( File.expand_path( '../sportdb-sync/lib' ))
|
6
|
-
|
7
|
-
|
8
|
-
## minitest setup
|
9
|
-
require 'minitest/autorun'
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
## our own code
|
14
|
-
require 'sportdb/readers'
|
15
|
-
|
16
|
-
## use (switch to) "external" datasets
|
17
|
-
SportDb::Import.config.leagues_dir = "../../../openfootball/leagues"
|
18
|
-
SportDb::Import.config.clubs_dir = "../../../openfootball/clubs"
|
19
|
-
|
20
|
-
|
21
|
-
COUNTRIES = SportDb::Import.catalog.countries
|
22
|
-
LEAGUES = SportDb::Import.catalog.leagues
|
23
|
-
CLUBS = SportDb::Import.catalog.clubs
|
data/test/test_conf_reader.rb
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
###
|
4
|
-
# to run use
|
5
|
-
# ruby -I ./lib -I ./test test/test_conf_reader.rb
|
6
|
-
|
7
|
-
|
8
|
-
require 'helper'
|
9
|
-
|
10
|
-
|
11
|
-
class TestConfReader < 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
|
-
def test_read
|
23
|
-
# path = "../../../openfootball/austria/2018-19/.conf.txt"
|
24
|
-
path = "../../../openfootball/england/2015-16/.conf.txt"
|
25
|
-
# path = "../../../openfootball/england/2017-18/.conf.txt"
|
26
|
-
# path = "../../../openfootball/england/2018-19/.conf.txt"
|
27
|
-
# path = "../../../openfootball/england/2019-20/.conf.txt"
|
28
|
-
SportDb::ConfReader.read( path )
|
29
|
-
end # method test_read
|
30
|
-
|
31
|
-
|
32
|
-
def test_read_champs
|
33
|
-
txt =<<TXT
|
34
|
-
= UEFA Champions League 2017/18
|
35
|
-
|
36
|
-
Manchester United › ENG
|
37
|
-
Liverpool › ENG
|
38
|
-
Chelsea › ENG
|
39
|
-
Manchester City › ENG
|
40
|
-
Tottenham Hotspur › ENG
|
41
|
-
|
42
|
-
Atlético Madrid › ESP
|
43
|
-
Barcelona › ESP
|
44
|
-
Sevilla › ESP
|
45
|
-
Real Madrid › ESP
|
46
|
-
|
47
|
-
Roma › ITA
|
48
|
-
Juventus › ITA
|
49
|
-
Napoli › ITA
|
50
|
-
|
51
|
-
Bayern München › GER
|
52
|
-
Borussia Dortmund › GER
|
53
|
-
RB Leipzig › GER
|
54
|
-
|
55
|
-
Benfica › POR
|
56
|
-
Sporting CP › POR
|
57
|
-
Porto › POR
|
58
|
-
|
59
|
-
CSKA Moscow › RUS
|
60
|
-
Spartak Moscow › RUS
|
61
|
-
|
62
|
-
Paris Saint-Germain › FRA
|
63
|
-
Basel › SUI
|
64
|
-
Celtic › SCO
|
65
|
-
Anderlecht › BEL
|
66
|
-
Qarabağ › AZE
|
67
|
-
Olympiacos › GRE
|
68
|
-
Maribor › SVN
|
69
|
-
Shakhtar Donetsk › UKR
|
70
|
-
Feyenoord › NED
|
71
|
-
Beşiktaş › TUR
|
72
|
-
Monaco › MCO
|
73
|
-
APOEL › CYP
|
74
|
-
TXT
|
75
|
-
|
76
|
-
SportDb::ConfReader.parse( txt )
|
77
|
-
end
|
78
|
-
end # class TestConfReader
|