sportdb-models 1.15.2 → 1.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8297074a244e15a0faa0e79815af71b73c93ea68
4
- data.tar.gz: 3b74416dac9a999b96998f8f34f3240fe14038ee
3
+ metadata.gz: e36af9637d46a600b4e6568b167c100647fff611
4
+ data.tar.gz: 26c402a6310e867b95b81ef5f28f12e1642e8024
5
5
  SHA512:
6
- metadata.gz: 1a43679c3e1444aef940475e28ba250a98d2f25146a819d373fc5e7c8a87c2358cf1246548661b000a26251158597f4b91d8b47148018fde684091f2be829be9
7
- data.tar.gz: 1b244eeaab111bcfb6e5fcbf3c74b587494425dddce4370f30b74449e68c815d4eebe318a208fafe21b479cd4457af5c1a3085ddc6009daaede7eea2a622168b
6
+ metadata.gz: 5354bb9771f092349de4bfa740a303d619453d8c4067fedc3eaca4be358b711ca6c6eb74fce9c5b1366023eb9c7ff7e57ae698d1a73df4e2e8d74c974a61e687
7
+ data.tar.gz: ac00526939151845c2959e61c4be81347c7efb669f9ab5fb4de2bc4db8d6b29559736b74505c3e9413fd3aa3e7a33ab1dfbea84a87725273538c5740ba83a141
@@ -58,6 +58,7 @@ lib/sportdb/reader_file.rb
58
58
  lib/sportdb/reader_zip.rb
59
59
  lib/sportdb/readers/assoc.rb
60
60
  lib/sportdb/readers/event.rb
61
+ lib/sportdb/readers/event_meta.rb
61
62
  lib/sportdb/readers/event_table.rb
62
63
  lib/sportdb/readers/game.rb
63
64
  lib/sportdb/readers/ground.rb
@@ -100,6 +101,8 @@ test/data/csv/de-2013-14--1-bundesliga.txt
100
101
  test/data/de-deutschland/2013-14/1-bundesliga.yml
101
102
  test/data/de-deutschland/leagues.txt
102
103
  test/data/de-deutschland/teams.txt
104
+ test/data/eng-england/2015-16/1-premierleague-v2.yml
105
+ test/data/eng-england/2015-16/1-premierleague.yml
103
106
  test/data/national-teams/assocs.txt
104
107
  test/data/national-teams/europe/assocs.txt
105
108
  test/data/national-teams/europe/teams.txt
@@ -144,6 +147,7 @@ test/test_changes.rb
144
147
  test/test_csv_reader.rb
145
148
  test/test_cursor.rb
146
149
  test/test_date.rb
150
+ test/test_event_meta_reader.rb
147
151
  test/test_event_reader.rb
148
152
  test/test_event_table_reader.rb
149
153
  test/test_goals.rb
@@ -73,6 +73,7 @@ require 'sportdb/finders/goals' # no: requires FixturesHelpers
73
73
  require 'sportdb/readers/assoc'
74
74
  require 'sportdb/readers/event' ## old event reader (remove later??)
75
75
  require 'sportdb/readers/event_table' ## new "standard" event reader
76
+ require 'sportdb/readers/event_meta' ## new "standard" event reader for meta data
76
77
  require 'sportdb/readers/game'
77
78
  require 'sportdb/readers/ground'
78
79
  require 'sportdb/readers/league'
@@ -105,20 +105,22 @@ class ReaderBase
105
105
  ### fix: use new ClubReader ??? why? why not?
106
106
  reader = create_team_reader( name, club: true ) ## note: always sets club flag to true / national to false
107
107
  reader.read()
108
+ elsif name =~ /\.conf$/ ## e.g. 1-premierleague.conf => 1-premierleague.conf.txt
109
+ reader = create_event_table_reader( name )
110
+ reader.read()
111
+ # note: keep a "public" reference of last event in @event - e.g. used/required by squads etc.
112
+ @event = reader.event
108
113
  elsif name =~ /\/(\d{4}|\d{4}[_\-]\d{2})(--[^\/]+)?\// ||
109
114
  name =~ /\/(\d{4}|\d{4}[_\-]\d{2})$/
110
115
 
111
116
  # note: allow 2013_14 or 2013-14 (that, is dash or underscore)
112
117
 
113
- # note: keep a "public" reference of last event in @event - e.g. used/required by squads etc.
114
- eventreader = create_event_reader( name )
115
- eventreader.read()
116
- @event = eventreader.event
117
-
118
118
  # e.g. must match /2012/ or /2012_13/ or /2012--xxx/ or /2012_13--xx/
119
119
  # or /2012 or /2012_13 e.g. brazil/2012 or brazil/2012_13
120
120
  reader = create_game_reader( name )
121
121
  reader.read()
122
+ # note: keep a "public" reference of last event in @event - e.g. used/required by squads etc.
123
+ @event = reader.event
122
124
  else
123
125
  logger.error "unknown sportdb fixture type >#{name}<"
124
126
  # todo/fix: exit w/ error
@@ -84,6 +84,14 @@ class Reader < ReaderBase
84
84
  EventReader.from_file( path, more_attribs )
85
85
  end
86
86
 
87
+ def create_event_table_reader( name, more_attribs={} )
88
+ real_name = name_to_real_name( name )
89
+ path = "#{@include_path}/#{real_name}.txt"
90
+
91
+ logger.info "parsing data (event table) '#{name}' (#{path})..."
92
+ EventTableReader.from_file( path, more_attribs )
93
+ end
94
+
87
95
  def create_game_reader( name, more_attribs={} )
88
96
  real_name = name_to_real_name( name )
89
97
 
@@ -117,6 +117,13 @@ class ZipReader < ReaderBase
117
117
  EventReader.from_zip( @zip_file, path, more_attribs )
118
118
  end
119
119
 
120
+ def create_event_table_reader( name, more_attribs={} )
121
+ path = name_to_zip_entry_path( name, '.txt' ) ## NOTE: use .txt extension
122
+
123
+ logger.info "parsing data in zip (event table) '#{name}' (#{path})..."
124
+ EventTableReader.from_zip( @zip_file, path, more_attribs )
125
+ end
126
+
120
127
  def create_game_reader( name, more_attribs={} )
121
128
  ## NOTE: pass in .yml as path (that is, event config!!!!)
122
129
  path = name_to_zip_entry_path( name, '.yml' ) ## NOTE: use .yml extension
@@ -21,7 +21,8 @@ class EventReader
21
21
  text = entry.get_input_stream().read()
22
22
  text = text.force_encoding( Encoding::UTF_8 )
23
23
 
24
- config = File.basename( entry_path ) # name a of .yml file
24
+ # basename of .yml file
25
+ config = File.basename( entry_path )
25
26
 
26
27
  self.from_string( text, config, more_attribs )
27
28
  end
@@ -31,22 +32,22 @@ class EventReader
31
32
  ## - see textutils/utils.rb
32
33
  text = File.read_utf8( path )
33
34
 
34
- config = File.basename( name ) # name a of .yml file
35
+ # basename of .yml file
36
+ config = File.basename( path )
35
37
 
36
38
  self.from_string( text, config, more_attribs )
37
39
  end
38
40
 
39
41
  def self.from_string( text, config, more_attribs={} )
40
- EventReader.new( text, config, more_attribs )
42
+ self.new( text, config, more_attribs )
41
43
  end
42
44
 
43
45
  def initialize( text, config, more_attribs={} )
44
46
  ## todo/fix: how to add opts={} ???
45
47
  @text = text
46
- @more_attribs = more_attribs
48
+ @more_attribs = more_attribs ## todo/check: not used for now? (remove - why, why not??)
47
49
 
48
- @config = config # name of event configuration (relative basename w/o path or string)
49
- @sources_default = config # note: use same a config for now
50
+ @config = config # name of event configuration (relative basename w/o path or string)
50
51
 
51
52
  @event = nil
52
53
  @fixtures = []
@@ -54,8 +55,8 @@ class EventReader
54
55
 
55
56
 
56
57
  def read
57
- @fixtures = [] # reset cached fixtures
58
58
  @event = nil # reset cached event rec
59
+ @fixtures = [] # reset cached fixtures
59
60
 
60
61
  ####
61
62
  ## fix!!!!!
@@ -72,8 +73,7 @@ class EventReader
72
73
  # etc.
73
74
  # use fixtures/sources: to override default
74
75
 
75
- event_attribs[ 'sources' ] = @sources_default
76
- event_attribs[ 'config' ] = @config # name a of .yml file
76
+ event_attribs[ 'config' ] = @config # name of .yml file
77
77
 
78
78
  reader.each_typed do |key, value|
79
79
 
@@ -111,7 +111,7 @@ class EventReader
111
111
  exit 1
112
112
  end
113
113
 
114
- elsif key == 'start_at' || key == 'begin_at' || key.downcase == 'start date'
114
+ elsif key.downcase == 'start_at' || key.downcase == 'begin_at' || key.downcase == 'start date'
115
115
 
116
116
  if value.is_a?(DateTime) || value.is_a?(Date)
117
117
  start_at = value
@@ -121,7 +121,7 @@ class EventReader
121
121
 
122
122
  event_attribs['start_at'] = start_at
123
123
 
124
- elsif key == 'end_at' || key == 'stop_at'
124
+ elsif key.downcase == 'end_at' || key.downcase == 'stop_at'
125
125
 
126
126
  if value.is_a?(DateTime) || value.is_a?(Date)
127
127
  end_at = value
@@ -131,7 +131,7 @@ class EventReader
131
131
 
132
132
  event_attribs['end_at'] = end_at
133
133
 
134
- elsif key == 'grounds' || key == 'stadiums' || key == 'venues'
134
+ elsif key.downcase == 'grounds' || key.downcase == 'stadiums' || key.downcase == 'venues'
135
135
  ## assume grounds value is an array
136
136
 
137
137
  ##
@@ -151,7 +151,7 @@ class EventReader
151
151
 
152
152
  event_attribs['ground_ids'] = ground_ids
153
153
 
154
- elsif key == 'team3' ## note: check before teams (to avoid future gotchas)
154
+ elsif key.downcase == 'team3' ## note: check before teams (to avoid future gotchas)
155
155
  ## for now always assume false # todo: fix - use value and convert to boolean if not boolean
156
156
  event_attribs['team3'] = false
157
157
 
@@ -200,7 +200,7 @@ class EventReader
200
200
 
201
201
  event_attribs['team_ids'] = team_ids
202
202
 
203
- elsif key == 'fixtures' || key == 'sources'
203
+ elsif key.downcase == 'fixtures' || key.downcase == 'sources'
204
204
  ### todo: check for mulitiple fixtures/sources ?? allow disallow?? why? why not?
205
205
  if value.kind_of?(Array)
206
206
  event_attribs['sources'] = value.join(',')
@@ -216,6 +216,14 @@ class EventReader
216
216
 
217
217
  end # each key,value
218
218
 
219
+ if @fixtures.empty?
220
+ ## use basename of config file as default (without extension)
221
+ sources_default = File.basename( @config, File.extname( @config ) )
222
+ @fixtures << sources_default
223
+ event_attribs[ 'sources' ] = sources_default
224
+ end
225
+
226
+
219
227
  league_id = event_attribs['league_id']
220
228
  season_id = event_attribs['season_id']
221
229
 
@@ -0,0 +1,133 @@
1
+ # encoding: UTF-8
2
+
3
+ module SportDb
4
+
5
+
6
+ class EventMetaReader
7
+
8
+ include LogUtils::Logging
9
+
10
+ ## make models available by default with namespace
11
+ # e.g. lets you use Usage instead of Model::Usage
12
+ include Models
13
+
14
+ attr_reader :event # returns event record; call read first
15
+ attr_reader :fixtures # fixtures/sources entry from event config
16
+
17
+ def self.from_zip( zip_file, entry_path, more_attribs={} )
18
+ ## get text content from zip
19
+ entry = zip_file.find_entry( entry_path )
20
+
21
+ text = entry.get_input_stream().read()
22
+ text = text.force_encoding( Encoding::UTF_8 )
23
+
24
+ config = File.basename( entry_path ) # name of .yml file
25
+
26
+ self.from_string( text, config, more_attribs )
27
+ end
28
+
29
+ def self.from_file( path, more_attribs={} )
30
+ ## note: assume/enfore utf-8 encoding (with or without BOM - byte order mark)
31
+ ## - see textutils/utils.rb
32
+ text = File.read_utf8( path )
33
+
34
+ config = File.basename( path ) # name of .yml file
35
+
36
+ self.from_string( text, config, more_attribs )
37
+ end
38
+
39
+ def self.from_string( text, config, more_attribs={} )
40
+ self.new( text, config, more_attribs )
41
+ end
42
+
43
+ def initialize( text, config, more_attribs={} )
44
+ ## todo/fix: how to add opts={} ???
45
+ ## todo/check: more_attribs used ???
46
+ @text = text
47
+ @more_attribs = more_attribs
48
+
49
+ # name of event configuration (relative basename w/o path or string)
50
+ @config = config
51
+
52
+ @event = nil
53
+ @fixtures = []
54
+ end
55
+
56
+
57
+ def read
58
+ @event = nil # reset cached event rec
59
+ @fixtures = [] # reset cached fixtures
60
+
61
+ reader = HashReader.from_string( @text )
62
+
63
+ league = nil
64
+ season = nil
65
+
66
+ reader.each_typed do |key, value|
67
+
68
+ ## puts "processing event attrib >>#{key}<< >>#{value}<<..."
69
+
70
+ if key.downcase == 'league' ## note: allow league, League, etc.
71
+ league_key = value.to_s.strip
72
+ ## check if league_key includes uppercase letters (e.g. Deutsche Bundesliga and NOT de etc.)
73
+ if league_key =~ /[A-Z]/
74
+ ## assume league name (NOT league key); try to lookup leauge key in database
75
+ league = League.find_by( title: league_key )
76
+ ## todo: add synonyms/alt names - why? why not??
77
+ else
78
+ ## assume "verbatim/literal" team_key (use as is 1:1)
79
+ league = League.find_by( key: league_key )
80
+ end
81
+
82
+ ## check if it exists
83
+ if league.nil?
84
+ logger.error "league with key >>#{league_key}<< missing"
85
+ exit 1
86
+ end
87
+ elsif key.downcase == 'season' ## note: allow season, Season, etc.
88
+ season_key = value.to_s.strip
89
+ season = Season.find_by( key: season_key )
90
+
91
+ ## check if it exists
92
+ if season.nil?
93
+ logger.error "season with key >>#{season_key}<< missing"
94
+ exit 1
95
+ end
96
+ elsif key.downcase == 'fixtures' || key.downcase == 'sources'
97
+ ### todo: check for mulitiple fixtures/sources ?? allow disallow?? why? why not?
98
+ if value.kind_of?(Array)
99
+ @fixtures += value
100
+ else # assume plain (single fixture) string
101
+ @fixtures << value.to_s
102
+ end
103
+ else
104
+ ## todo: add a source location struct to_s or similar (file, line, col)
105
+ logger.error "unknown event attrib #{key}; skipping attrib"
106
+ end
107
+ end # each key,value
108
+
109
+ # check fixtures - if nothing specified; use basename of config (this) file
110
+ if @fixtures.empty?
111
+ ## use basename of config file as default (without extension)
112
+ sources_default = File.basename( @config, File.extname( @config ) )
113
+ logger.debug " add default fixture (assume same basename as config file) e.g. >#{sources_default}<"
114
+ @fixtures << sources_default
115
+ end
116
+
117
+ logger.debug "find event - league.id: #{league.id}, season.id: #{season.id}"
118
+
119
+ ## note: for now event MUST exist (read-only access)
120
+ # keep a "cached" reference for later use
121
+ @event = Event.find_by!( league_id: league.id,
122
+ season_id: season.id )
123
+
124
+ @event
125
+
126
+ ## todo/check:
127
+ ## return a "simple" hash in new (next) version - why? why not??
128
+ ## add fixtures (defaults) if missing
129
+ end # method read
130
+
131
+
132
+ end # class EventMetaReader
133
+ end # module SportDb
@@ -14,7 +14,15 @@ class EventTableReader
14
14
  attr_reader :event # returns event record; call read first
15
15
 
16
16
 
17
- ## todo/fix: add from_zip()
17
+ def self.from_zip( zip_file, entry_path, more_attribs={} )
18
+ ## get text content from zip
19
+ entry = zip_file.find_entry( entry_path )
20
+
21
+ text = entry.get_input_stream().read()
22
+ text = text.force_encoding( Encoding::UTF_8 )
23
+
24
+ self.from_string( text, more_attribs )
25
+ end
18
26
 
19
27
  def self.from_file( path, more_attribs={} )
20
28
  ## note: assume/enfore utf-8 encoding (with or without BOM - byte order mark)
@@ -10,6 +10,8 @@ class GameReader
10
10
  # e.g. lets you use Usage instead of Model::Usage
11
11
  include Models
12
12
 
13
+ attr_reader :event # returns event record
14
+
13
15
  ## value helpers e.g. is_year?, is_taglist? etc.
14
16
  include TextUtils::ValueHelper
15
17
 
@@ -19,17 +21,32 @@ class GameReader
19
21
 
20
22
  logger = LogKernel::Logger.root
21
23
 
22
- reader = EventReader.from_zip( zip_file, entry_path )
23
- reader.read()
24
-
24
+ ## get text content from zip
25
+ entry = zip_file.find_entry( entry_path )
26
+ event_text = entry.get_input_stream().read()
27
+ event_text = text.force_encoding( Encoding::UTF_8 )
28
+
29
+ ## hack:
30
+ ## support old event config format for now (will get removed later)
31
+ ## e.g. check for
32
+ ## teams:
33
+ ## 12 teams: etc.
34
+ if event_text =~ /^teams:/i ||
35
+ event_text =~ /^\d{1,2} teams:/i ||
36
+ event_text =~ /^start_at:/i
37
+ ## old format
38
+ puts "*** [DEPRECATED] old event config format w/ yaml, please use new plain text format >#{entry_path}<"
39
+ reader = EventReader.from_zip( zip_file, entry_path )
40
+ reader.read()
41
+ else
42
+ ## new format
43
+ reader = EventMetaReader.from_zip( zip_file, entry_path )
44
+ reader.read()
45
+ end
46
+
25
47
  event = reader.event ## was fetch_event( name )
26
48
  fixtures = reader.fixtures ## was fetch_event_fixtures( name )
27
49
 
28
- if fixtures.empty?
29
- ## logger.warn "no fixtures found for event - >#{name}<; assume fixture name is the same as event"
30
- ## change extension from .yml to .txt
31
- fixtures_with_path = [ entry_path.sub('.yml','.txt') ]
32
- else
33
50
  ## add path to fixtures (use path from event e.g)
34
51
  # - bl + at-austria!/2012_13/bl -> at-austria!/2012_13/bl
35
52
  # - bl_ii + at-austria!/2012_13/bl -> at-austria!/2012_13/bl_ii
@@ -41,7 +58,6 @@ class GameReader
41
58
  logger.debug "fx: #{fx_new} | >#{fx}< + >#{dir}<"
42
59
  fx_new
43
60
  end
44
- end
45
61
 
46
62
  ## fix-fix-fix: change file extension to ??
47
63
  text_ary = []
@@ -67,18 +83,32 @@ class GameReader
67
83
  ## - ## - see textutils/utils.rb
68
84
  ## - text = File.read_utf8( path )
69
85
 
70
- reader = EventReader.from_file( path )
71
- reader.read()
86
+ event_text = File.read_utf8( path )
87
+
88
+ ## hack:
89
+ ## support old event config format for now (will get removed later)
90
+ ## e.g. check for
91
+ ## teams:
92
+ ## 12 teams: etc.
93
+ if event_text =~ /^teams:/i ||
94
+ event_text =~ /^\d{1,2} teams:/i ||
95
+ event_text =~ /^start_at:/i
96
+
97
+ ## old format
98
+ puts "*** [DEPRECATED] old event config format w/ yaml, please use new plain text format >#{path}<"
99
+ reader = EventReader.from_file( path )
100
+ reader.read()
101
+ else
102
+ ## new format
103
+ reader = EventMetaReader.from_file( path )
104
+ reader.read()
105
+ end
106
+
72
107
 
73
108
  event = reader.event ## was fetch_event( name )
74
109
  fixtures = reader.fixtures ## was fetch_event_fixtures( name )
75
110
 
76
111
 
77
- if fixtures.empty?
78
- ## logger.warn "no fixtures found for event - >#{name}<; assume fixture name is the same as event"
79
- ## change extension from .yml to .txt
80
- fixtures_with_path = [ path.sub('.yml','.txt') ]
81
- else
82
112
  ## add path to fixtures (use path from event e.g)
83
113
  # - bl + at-austria!/2012_13/bl -> at-austria!/2012_13/bl
84
114
  # - bl_ii + at-austria!/2012_13/bl -> at-austria!/2012_13/bl_ii
@@ -90,7 +120,6 @@ class GameReader
90
120
  logger.debug "fx: #{fx_new} | >#{fx}< + >#{dir}<"
91
121
  fx_new
92
122
  end
93
- end
94
123
 
95
124
  ## fix-fix-fix: change file extension to ??
96
125
  text_ary = []
@@ -105,7 +134,7 @@ class GameReader
105
134
  def self.from_string( event, text_or_text_ary, more_attribs={} )
106
135
  ### fix - fix -fix:
107
136
  ## change event to event_or_event_key !!!!! - allow event_key as string passed in
108
- GameReader.new( event, text_or_text_ary, more_attribs )
137
+ self.new( event, text_or_text_ary, more_attribs )
109
138
  end
110
139
 
111
140
 
@@ -3,8 +3,8 @@
3
3
  module SportDb
4
4
 
5
5
  MAJOR = 1 ## todo: namespace inside version or something - why? why not??
6
- MINOR = 15
7
- PATCH = 2
6
+ MINOR = 16
7
+ PATCH = 0
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
10
10
  def self.version
@@ -0,0 +1,2 @@
1
+ league: en
2
+ season: 2015/16
@@ -0,0 +1,5 @@
1
+ league: en
2
+ season: 2015/16
3
+ fixtures:
4
+ - 1-premierleague-i
5
+ - 1-premierleague-ii
@@ -50,6 +50,7 @@ AssocReader = SportDb::AssocReader
50
50
  SeasonReader = SportDb::SeasonReader
51
51
  LeagueReader = SportDb::LeagueReader
52
52
  EventReader = SportDb::EventReader
53
+ EventMetaReader = SportDb::EventMetaReader
53
54
  EventTableReader = SportDb::EventTableReader
54
55
  GameReader = SportDb::GameReader
55
56
  NationalTeamSquadReader = SportDb::NationalTeamSquadReader
@@ -106,6 +107,12 @@ module TestEventReader
106
107
  end
107
108
  end
108
109
 
110
+ module TestEventMetaReader
111
+ def self.from_file( name )
112
+ EventMetaReader.from_file( "#{SportDb.test_data_path}/#{name}.yml" )
113
+ end
114
+ end
115
+
109
116
  module TestEventTableReader
110
117
  def self.from_file( name )
111
118
  EventTableReader.from_file( "#{SportDb.test_data_path}/#{name}.txt" )
@@ -0,0 +1,50 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_event_meta_reader.rb
6
+ # or better
7
+ # rake -I ./lib test
8
+
9
+
10
+ require 'helper'
11
+
12
+ class TestEventMetaReaderXX < MiniTest::Test # note: TestEventMetaReader alreay defined, thus, add xx
13
+
14
+ def setup
15
+ WorldDb.delete!
16
+ SportDb.delete!
17
+ PersonDb.delete!
18
+
19
+ ## setup premier league
20
+ eng = Country.create!( key: 'eng', name: 'England', code: 'ENG', pop: 1, area: 1)
21
+ season = Season.create!( key: '2015/16', title: '2015/16' )
22
+ league = League.create!( key: 'en', title: 'English Premier League', club: true, country_id: eng.id )
23
+ pl = Event.create!( season_id: season.id, league_id: league.id,
24
+ start_at: Date.new( 2015, 7, 1 ) )
25
+ end
26
+
27
+ def test_pl
28
+ r = TestEventMetaReader.from_file( 'eng-england/2015-16/1-premierleague' )
29
+ r.read
30
+
31
+ pp r.event
32
+ pp r.fixtures
33
+
34
+ assert_equal ['1-premierleague-i','1-premierleague-ii'], r.fixtures
35
+ assert true ## if we get here; assume everything ok
36
+ end
37
+
38
+ def test_pl_v2
39
+ r = TestEventMetaReader.from_file( 'eng-england/2015-16/1-premierleague-v2' )
40
+ r.read
41
+
42
+ pp r.event
43
+ pp r.fixtures
44
+
45
+ assert_equal ['1-premierleague-v2'], r.fixtures
46
+ assert true ## if we get here; assume everything ok
47
+ end
48
+
49
+ end # class TestEventMetaReader
50
+
@@ -31,7 +31,10 @@ class TestEventReaderXX < MiniTest::Test # note: TestEventReader alreay defined
31
31
  def test_bl
32
32
  r = TestEventReader.from_file( 'at-austria/2015_16/1-bundesliga' )
33
33
  r.read
34
+
35
+ pp r.fixtures
34
36
 
37
+ assert_equal ['1-bundesliga-i', '1-bundesliga-ii'], r.fixtures
35
38
  assert true ## if we get here; assume everything ok
36
39
  end
37
40
 
@@ -39,6 +42,9 @@ class TestEventReaderXX < MiniTest::Test # note: TestEventReader alreay defined
39
42
  r = TestEventReader.from_file( 'at-austria/2015_16/1-bundesliga-v2' )
40
43
  r.read
41
44
 
45
+ pp r.fixtures
46
+
47
+ assert_equal ['1-bundesliga-v2'], r.fixtures
42
48
  assert true ## if we get here; assume everything ok
43
49
  end
44
50
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportdb-models
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.15.2
4
+ version: 1.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-08 00:00:00.000000000 Z
11
+ date: 2015-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: worlddb-models
@@ -135,6 +135,7 @@ files:
135
135
  - lib/sportdb/reader_zip.rb
136
136
  - lib/sportdb/readers/assoc.rb
137
137
  - lib/sportdb/readers/event.rb
138
+ - lib/sportdb/readers/event_meta.rb
138
139
  - lib/sportdb/readers/event_table.rb
139
140
  - lib/sportdb/readers/game.rb
140
141
  - lib/sportdb/readers/ground.rb
@@ -177,6 +178,8 @@ files:
177
178
  - test/data/de-deutschland/2013-14/1-bundesliga.yml
178
179
  - test/data/de-deutschland/leagues.txt
179
180
  - test/data/de-deutschland/teams.txt
181
+ - test/data/eng-england/2015-16/1-premierleague-v2.yml
182
+ - test/data/eng-england/2015-16/1-premierleague.yml
180
183
  - test/data/national-teams/assocs.txt
181
184
  - test/data/national-teams/europe/assocs.txt
182
185
  - test/data/national-teams/europe/teams.txt
@@ -221,6 +224,7 @@ files:
221
224
  - test/test_csv_reader.rb
222
225
  - test/test_cursor.rb
223
226
  - test/test_date.rb
227
+ - test/test_event_meta_reader.rb
224
228
  - test/test_event_reader.rb
225
229
  - test/test_event_table_reader.rb
226
230
  - test/test_goals.rb