sportdb-config 0.2.1 → 0.2.2

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: 6e1c949ddbf113fbfc92ac6b49c642efea51cf1e
4
- data.tar.gz: 9bbcf4c6f00c08453267110fd79937999eabaed1
3
+ metadata.gz: 3fe2b7c82d6d90391429dc22ec436df758477ea0
4
+ data.tar.gz: f4d99f15a3efdf86204f6a72a188e32f00c8c754
5
5
  SHA512:
6
- metadata.gz: 76b550ec4e4b67425403284eb4cbb52888df3b9408ea56c6514f255509e03ba323610c38ae6caa41582b10279e50f8889fce69a855484ef070f58e79d20478fe
7
- data.tar.gz: 5d2c9c90d4111df3e8d59381801e4db47fc6f3a5369f636fbf2248511debdfe0ac8eb5d47fe2bd2fbbd7397e9ac6af201ef6d03de408b7a16a6639c4a0c39f98
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
@@ -8,7 +8,7 @@ module Boot ## note: use a different module than Config to avoid confusion
8
8
 
9
9
  MAJOR = 0 ## todo: namespace inside version or something - why? why not??
10
10
  MINOR = 2
11
- PATCH = 1
11
+ PATCH = 2
12
12
  VERSION = [MAJOR,MINOR,PATCH].join('.')
13
13
 
14
14
  def self.version
data/test/test_config.rb CHANGED
@@ -14,6 +14,8 @@ class TestConfig < MiniTest::Test
14
14
 
15
15
  pp SportDb::Import.config.teams
16
16
 
17
+ pp SportDb::Import.config.errors
18
+
17
19
  assert true ## assume ok if we get here
18
20
  end # method test_teams
19
21
 
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.1
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-29 00:00:00.000000000 Z
11
+ date: 2019-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc