sportdb-readers 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sportdb/readers/package.rb +24 -3
- data/lib/sportdb/readers/version.rb +1 -1
- data/lib/sportdb/readers.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34c46804bf8dd427446628b605ecdda05a2bb283
|
4
|
+
data.tar.gz: 3ce074322f2281965d6f3897526f407de3952d46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe151a2000112a722929840be1359181734edbc1f12112ad73fd9e6aafc61eff693ffd69c241da14d5e1ec455677b23e917e17143ac8ac9867b2ec4493dc05fb
|
7
|
+
data.tar.gz: 74b6fd475c43379cd9ef9610f6fab4e1efc9ccbf99f0b5254bb767a999f1ce5aa37c9b6dba6b1fa097fdc139fefe4469b46af71145efcd605822659a7a1f7a6e
|
@@ -4,6 +4,9 @@ module SportDb
|
|
4
4
|
|
5
5
|
CONF_RE = Datafile::CONF_RE
|
6
6
|
CLUB_PROPS_RE = Datafile::CLUB_PROPS_RE
|
7
|
+
LEAGUES_RE = Datafile::LEAGUES_REGEX ## todo/check: rename to _RE
|
8
|
+
CLUBS_RE = Datafile::CLUBS_REGEX ## todo/check: rename to _RE
|
9
|
+
|
7
10
|
|
8
11
|
## note: if pattern includes directory add here (otherwise move to more "generic" datafile) - why? why not?
|
9
12
|
MATCH_RE = %r{ /\d{4}-\d{2} ## season folder e.g. /2019-20
|
@@ -36,8 +39,24 @@ module SportDb
|
|
36
39
|
def each_match( &blk ) @pack.each( pattern: MATCH_RE, &blk ); end
|
37
40
|
def each_club_props( &blk ) @pack.each( pattern: CLUB_PROPS_RE, &blk ); end
|
38
41
|
|
42
|
+
def each_leagues( &blk ) @pack.each( pattern: LEAGUES_RE, &blk ); end
|
43
|
+
def each_clubs( &blk ) @pack.each( pattern: CLUBS_RE, &blk ); end
|
44
|
+
|
45
|
+
|
46
|
+
def read_leagues
|
47
|
+
each_leagues do |entry|
|
48
|
+
SportDb.parse_leagues( entry.read )
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def read_clubs
|
53
|
+
each_clubs do |entry|
|
54
|
+
SportDb.parse_clubs( entry.read )
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
39
58
|
|
40
|
-
def read_club_props( sync: true )
|
59
|
+
def read_club_props( sync: true ) ## todo/fix: remove sync!! - why? why not?
|
41
60
|
each_club_props do |entry|
|
42
61
|
SportDb.parse_club_props( entry.read, sync: sync )
|
43
62
|
end
|
@@ -75,13 +94,15 @@ module SportDb
|
|
75
94
|
def read( *names,
|
76
95
|
season: nil, sync: true )
|
77
96
|
if names.empty? ## read all datafiles
|
78
|
-
|
97
|
+
read_leagues()
|
98
|
+
read_clubs()
|
99
|
+
read_club_props( sync: sync ) ## todo/fix: remove sync - why? why not?
|
79
100
|
read_conf( season: season, sync: sync )
|
80
101
|
read_match( season: season, sync: sync )
|
81
102
|
else
|
82
103
|
names.each do |name|
|
83
104
|
entry = @pack.find( name )
|
84
|
-
## fix/todo: add
|
105
|
+
## fix/todo: add read_leagues, read_clubs too!!!
|
85
106
|
if Datafile.match_conf( name ) ## check if datafile matches conf(iguration) naming (e.g. .conf.txt)
|
86
107
|
SportDb.parse_conf( entry.read, season: season, sync: sync )
|
87
108
|
elsif Datafile.match_club_props( name )
|
data/lib/sportdb/readers.rb
CHANGED
@@ -58,6 +58,17 @@ module SportDb
|
|
58
58
|
end
|
59
59
|
|
60
60
|
|
61
|
+
def self.parse_leagues( txt )
|
62
|
+
recs = SportDb::Import::LeagueReader.parse( txt )
|
63
|
+
Import::config.leagues.add( recs )
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.parse_clubs( txt )
|
67
|
+
recs = SportDb::Import::ClubReader.parse( txt )
|
68
|
+
Import::config.clubs.add( recs )
|
69
|
+
end
|
70
|
+
|
71
|
+
|
61
72
|
def self.read( path, season: nil, sync: true )
|
62
73
|
pack = if File.directory?( path ) ## if directory assume "unzipped" package
|
63
74
|
DirPackage.new( path )
|
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: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sportdb-config
|