sportdb-readers 0.3.4 → 0.3.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a75121e5975c7428ee0ca635b90a1103d455d784
4
- data.tar.gz: 80531e6bc8e447dc191527f0c2368cac99620b63
3
+ metadata.gz: 34c46804bf8dd427446628b605ecdda05a2bb283
4
+ data.tar.gz: 3ce074322f2281965d6f3897526f407de3952d46
5
5
  SHA512:
6
- metadata.gz: eb47f23f83386d6f3bcd9df958ca0e05379c23de572312fa8889ea5066afd9f8c94158b8dc3ad275704c7e557f930f23ffe2cbd0fd814a1357b5627086b964c2
7
- data.tar.gz: e8ec9a04a9b2d6190924588206cb9e3ffe625e61a280825bdc79c5faa616a1ef3e717bffdcc722b73866dc2b4a0e68133380f773b3e1a0d45a16ad3a52e892b4
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
- read_club_props( sync: sync )
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 read_clubs_props too!!!
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 )
@@ -6,7 +6,7 @@ module Readers
6
6
 
7
7
  MAJOR = 0 ## todo: namespace inside version or something - why? why not??
8
8
  MINOR = 3
9
- PATCH = 4
9
+ PATCH = 5
10
10
  VERSION = [MAJOR,MINOR,PATCH].join('.')
11
11
 
12
12
  def self.version
@@ -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
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-21 00:00:00.000000000 Z
11
+ date: 2019-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sportdb-config