sportdb-readers 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +2 -0
- data/Manifest.txt +0 -9
- data/README.md +10 -11
- data/Rakefile +3 -3
- data/lib/sportdb/readers/conf_reader.rb +2 -3
- data/lib/sportdb/readers/match_reader.rb +19 -4
- data/lib/sportdb/readers/version.rb +3 -4
- data/lib/sportdb/readers.rb +5 -5
- metadata +19 -23
- 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: 40a0db453b48c9bed47b6370c44249d5c8197df2fddc90a911653f2ddd145357
|
|
4
|
+
data.tar.gz: 8792558c03345ba1662249e5239f5b6122324740f353be4143c420f482486742
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 342de18d45ec3be01a528be68e2e77d18866911cef7fbad17424179c648eda816170e77ea39987bfa66b48af9627284080535eab292c0e9798e3ca25ad09118a
|
|
7
|
+
data.tar.gz: 5861f675107c90fdd10f865396df5b43f30df1df63ff3e437f409612853b393d575f96df0b59a86d23c2773791a2a63d57db1df9949ebb4e0845768b088a9654
|
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**
|
|
@@ -83,14 +80,14 @@ pl_2015_16.teams.count #=> 20
|
|
|
83
80
|
# INNER JOIN events_teams ON teams.id = events_teams.team_id
|
|
84
81
|
# WHERE events_teams.event_id = 1
|
|
85
82
|
|
|
86
|
-
pl_2015_16.
|
|
87
|
-
#=> SELECT COUNT(*) FROM
|
|
88
|
-
# INNER JOIN rounds ON
|
|
83
|
+
pl_2015_16.matches.count #=> 380
|
|
84
|
+
#=> SELECT COUNT(*) FROM matches
|
|
85
|
+
# INNER JOIN rounds ON matches.round_id = rounds.id
|
|
89
86
|
# WHERE rounds.event_id = 1
|
|
90
87
|
|
|
91
88
|
pl_2019_20 = Event.find_by( key: 'eng.1.2019/20' )
|
|
92
89
|
pl_2015_16.teams.count #=> 20
|
|
93
|
-
pl_2015_16.
|
|
90
|
+
pl_2015_16.matches.count #=> 380
|
|
94
91
|
|
|
95
92
|
# -or-
|
|
96
93
|
|
|
@@ -151,6 +148,8 @@ Use it as you please with no restrictions whatsoever.
|
|
|
151
148
|
|
|
152
149
|
## Questions? Comments?
|
|
153
150
|
|
|
154
|
-
|
|
155
|
-
[
|
|
156
|
-
|
|
151
|
+
Yes, you can. More than welcome.
|
|
152
|
+
See [Help & Support »](https://github.com/openfootball/help)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
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,7 +20,7 @@ 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.0'],
|
|
24
24
|
]
|
|
25
25
|
|
|
26
26
|
self.spec_extras = {
|
|
@@ -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
|
|
|
@@ -72,9 +71,14 @@ class MatchReader ## todo/check: rename to MatchReaderV2 (use plural?) why? w
|
|
|
72
71
|
|
|
73
72
|
|
|
74
73
|
### todo/check: make sure team include teams from group def too!!!!!
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
###
|
|
75
|
+
### note - only use teams and grounds for now
|
|
76
|
+
auto_conf_teams,
|
|
77
|
+
_rounds, _groups, _round_defs, _group_defs,
|
|
78
|
+
auto_conf_grounds,
|
|
79
|
+
_ = AutoConfParser.parse( lines, start: start )
|
|
80
|
+
|
|
81
|
+
|
|
78
82
|
## step 1: map/find teams
|
|
79
83
|
|
|
80
84
|
## note: loop over keys (holding the names); values hold the usage counter!! e.g. 'Arsenal' => 2, etc.
|
|
@@ -94,13 +98,24 @@ class MatchReader ## todo/check: rename to MatchReaderV2 (use plural?) why? w
|
|
|
94
98
|
'Valencia' => 'Valencia CF, ESP' })
|
|
95
99
|
end
|
|
96
100
|
|
|
101
|
+
# puts " [debug] auto_conf_teams:"
|
|
102
|
+
# pp auto_conf_teams
|
|
103
|
+
|
|
104
|
+
|
|
97
105
|
teams = catalog.teams.find_by!( name: auto_conf_teams.keys,
|
|
98
106
|
league: league,
|
|
99
107
|
mods: mods )
|
|
100
108
|
|
|
109
|
+
# puts " [debug] teams:"
|
|
110
|
+
# pp teams
|
|
111
|
+
|
|
101
112
|
## build mapping - name => team struct record
|
|
102
113
|
team_mapping = auto_conf_teams.keys.zip( teams ).to_h
|
|
103
114
|
|
|
115
|
+
# puts " [debug] team_mapping:"
|
|
116
|
+
# pp team_mapping
|
|
117
|
+
|
|
118
|
+
|
|
104
119
|
|
|
105
120
|
parser = MatchParser.new( lines,
|
|
106
121
|
team_mapping,
|
|
@@ -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 = 0
|
|
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.
|
|
4
|
+
version: 1.2.0
|
|
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-06-23 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.0
|
|
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.0
|
|
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
|
|
@@ -103,9 +100,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
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
|