sportdb-config 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sportdb/config/config.rb +14 -6
- data/lib/sportdb/config/version.rb +1 -1
- data/test/test_config.rb +2 -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: 3fe2b7c82d6d90391429dc22ec436df758477ea0
|
4
|
+
data.tar.gz: f4d99f15a3efdf86204f6a72a188e32f00c8c754
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffc5111b12b2b93eaf3bd44a372ba763933ba27894cfab6a373a40bc9edef89496e27f9dfbfb7953baa0f0e8dd8841dca8caaa3a93fcb0ca032e4ee1adba7088
|
7
|
+
data.tar.gz: 03af3c75d752dce366f6c645fd1949d932f3c42261fae3f6eb6cce0ab1260925c3ced78be86e9ba32857ca67292cccce88d934f05a1f944b2b27181c0dd287e1
|
@@ -6,6 +6,10 @@ module SportDb
|
|
6
6
|
|
7
7
|
class Configuration
|
8
8
|
|
9
|
+
def initialize
|
10
|
+
@errors = [] ## make parsing errors "global" for now
|
11
|
+
end
|
12
|
+
|
9
13
|
|
10
14
|
def team_mappings
|
11
15
|
read_teams() if @team_mappings.nil?
|
@@ -26,6 +30,7 @@ class Configuration
|
|
26
30
|
####
|
27
31
|
# todo/fix: find a better way to configure club / team datasets
|
28
32
|
attr_accessor :clubs_dir
|
33
|
+
attr_accessor :errors
|
29
34
|
|
30
35
|
def clubs_dir() @clubs_dir ||= './clubs'; end
|
31
36
|
|
@@ -72,13 +77,14 @@ class Configuration
|
|
72
77
|
ua: 'europe/ua-ukraine',
|
73
78
|
mx: 'north-america/mx-mexico',
|
74
79
|
us: 'north-america/us-united-states',
|
75
|
-
ca: 'north-america/ca-canada'
|
80
|
+
ca: 'north-america/ca-canada',
|
81
|
+
ar: 'south-america/ar-argentina' }
|
76
82
|
|
77
83
|
def read_teams
|
78
84
|
## unify team names; team (builtin/known/shared) name mappings
|
79
85
|
## cleanup team names - use local ("native") name with umlaut etc.
|
80
86
|
recs = []
|
81
|
-
errors = []
|
87
|
+
@errors = [] ## reset errors
|
82
88
|
|
83
89
|
## todo/fix: pass along / use country code too
|
84
90
|
CLUBS_DATAFILES.each do |country, path|
|
@@ -96,7 +102,7 @@ class Configuration
|
|
96
102
|
if name ## todo/fix: add better warn about duplicates (if key exits) ???????
|
97
103
|
msg = "** !!! WARN !!! - alt name conflict/duplicate - >#{alt_name}< will overwrite >#{name}< with >#{rec.name}<"
|
98
104
|
puts msg
|
99
|
-
errors << msg
|
105
|
+
@errors << msg
|
100
106
|
else
|
101
107
|
@team_mappings[ alt_name ] = rec.name
|
102
108
|
end
|
@@ -111,22 +117,24 @@ class Configuration
|
|
111
117
|
|
112
118
|
##
|
113
119
|
## todo/fix: move to new TeamConfig class (for reuse) !!!!!!
|
120
|
+
## todo/fix: add check for duplicates/conflicts too!!!
|
114
121
|
@teams = {}
|
115
122
|
recs.each do |rec|
|
116
123
|
@teams[ rec.name ] = rec
|
117
124
|
end
|
118
125
|
|
119
|
-
if errors.size > 0
|
126
|
+
if @errors.size > 0
|
120
127
|
puts ""
|
121
128
|
puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
122
|
-
puts " #{errors.size} errors:"
|
123
|
-
pp errors
|
129
|
+
puts " #{@errors.size} errors:"
|
130
|
+
pp @errors
|
124
131
|
## exit 1
|
125
132
|
end
|
126
133
|
|
127
134
|
self ## return self for chaining
|
128
135
|
end
|
129
136
|
|
137
|
+
|
130
138
|
def read_leagues
|
131
139
|
#####
|
132
140
|
# add / read-in leagues config
|
data/test/test_config.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sportdb-config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
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-06-
|
11
|
+
date: 2019-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|