sportdb 1.9.4 → 1.9.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -42,11 +42,8 @@ lib/sportdb/models/group_comp.rb
42
42
  lib/sportdb/models/group_team.rb
43
43
  lib/sportdb/models/league.rb
44
44
  lib/sportdb/models/person.rb
45
- lib/sportdb/models/race.rb
46
- lib/sportdb/models/record.rb
47
45
  lib/sportdb/models/roster.rb
48
46
  lib/sportdb/models/round.rb
49
- lib/sportdb/models/run.rb
50
47
  lib/sportdb/models/season.rb
51
48
  lib/sportdb/models/stats/alltime_standing.rb
52
49
  lib/sportdb/models/stats/alltime_standing_entry.rb
@@ -56,7 +53,6 @@ lib/sportdb/models/stats/group_standing.rb
56
53
  lib/sportdb/models/stats/group_standing_entry.rb
57
54
  lib/sportdb/models/team.rb
58
55
  lib/sportdb/models/team_comp.rb
59
- lib/sportdb/models/track.rb
60
56
  lib/sportdb/models/utils.rb
61
57
  lib/sportdb/models/world/city.rb
62
58
  lib/sportdb/models/world/continent.rb
@@ -69,13 +65,9 @@ lib/sportdb/readers/event.rb
69
65
  lib/sportdb/readers/game.rb
70
66
  lib/sportdb/readers/ground.rb
71
67
  lib/sportdb/readers/league.rb
72
- lib/sportdb/readers/race.rb
73
- lib/sportdb/readers/race_team.rb
74
- lib/sportdb/readers/record.rb
75
68
  lib/sportdb/readers/season.rb
76
69
  lib/sportdb/readers/squad.rb
77
70
  lib/sportdb/readers/team.rb
78
- lib/sportdb/readers/track.rb
79
71
  lib/sportdb/schema.rb
80
72
  lib/sportdb/service.rb
81
73
  lib/sportdb/service/public/style.css
File without changes
@@ -49,15 +49,18 @@ require 'sportdb/models/group_comp'
49
49
  require 'sportdb/models/group_team'
50
50
  require 'sportdb/models/league'
51
51
  require 'sportdb/models/person'
52
- require 'sportdb/models/race'
53
- require 'sportdb/models/record'
54
52
  require 'sportdb/models/roster'
55
53
  require 'sportdb/models/round'
56
- require 'sportdb/models/run'
57
54
  require 'sportdb/models/season'
58
55
  require 'sportdb/models/team'
59
56
  require 'sportdb/models/team_comp'
60
- require 'sportdb/models/track'
57
+
58
+ ### note: moved to racing.db !! - delete
59
+ ## require 'sportdb/models/race'
60
+ ## require 'sportdb/models/record'
61
+ ## require 'sportdb/models/run'
62
+ ## require 'sportdb/models/track'
63
+
61
64
 
62
65
  require 'sportdb/models/stats/alltime_standing'
63
66
  require 'sportdb/models/stats/alltime_standing_entry'
@@ -99,15 +102,19 @@ require 'sportdb/readers/event'
99
102
  require 'sportdb/readers/game'
100
103
  require 'sportdb/readers/ground'
101
104
  require 'sportdb/readers/league'
102
- require 'sportdb/readers/race'
103
- require 'sportdb/readers/record'
104
- require 'sportdb/readers/race_team'
105
105
  require 'sportdb/readers/season'
106
106
  require 'sportdb/readers/squad' # roster
107
107
  require 'sportdb/readers/team'
108
- require 'sportdb/readers/track'
109
108
  require 'sportdb/reader'
110
109
 
110
+
111
+ ### note: moved to racing.db !! - delete
112
+ ## require 'sportdb/readers/race'
113
+ ## require 'sportdb/readers/record'
114
+ ## require 'sportdb/readers/race_team'
115
+ ## require 'sportdb/readers/track'
116
+
117
+
111
118
  require 'sportdb/lang'
112
119
 
113
120
  require 'sportdb/updater'
@@ -2,6 +2,17 @@
2
2
 
3
3
 
4
4
  ### todo/fix: move to sportdb-data gem/plugin/addon ??
5
+ ##
6
+ ### move to sportdb/data ?? or sportdb/const ?? sportdb/
7
+ ## or let use sportdb/keys addon ??
8
+
9
+ ###
10
+ ## add all known repos settings from build scripts ???
11
+ ##
12
+ #
13
+
14
+ ## or sportdb/data ??
15
+
5
16
  ### fix: rename to ::Key (singular) - why? why not??
6
17
 
7
18
 
@@ -18,7 +18,6 @@ module SportDb
18
18
 
19
19
 
20
20
  Goal.delete_all
21
- Record.delete_all
22
21
 
23
22
  Game.delete_all
24
23
  Event.delete_all
@@ -29,11 +28,8 @@ module SportDb
29
28
  Round.delete_all
30
29
  Badge.delete_all
31
30
 
32
- Run.delete_all
33
- Race.delete_all
34
31
  Roster.delete_all
35
32
 
36
- Track.delete_all
37
33
  Team.delete_all
38
34
 
39
35
  League.delete_all
@@ -43,6 +39,12 @@ module SportDb
43
39
 
44
40
  Assoc.delete_all # associations / organizations
45
41
  AssocAssoc.delete_all # associations / organizations
42
+
43
+ ## note: moved to racing.db - delete/remove!!!
44
+ ## Record.delete_all
45
+ ## Run.delete_all
46
+ ## Race.delete_all
47
+ ## Track.delete_all
46
48
  end
47
49
 
48
50
  end # class Deleter
@@ -1,5 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
+ #### fix: move to textutils for reuse !!!!!
4
+
5
+
3
6
  module SportDb
4
7
 
5
8
  class DateFinder
@@ -7,6 +10,45 @@ class DateFinder
7
10
  include LogUtils::Logging
8
11
 
9
12
  # todo: make more generic for reuse
13
+ ### fix:
14
+ ### move to textutils
15
+ ## date/fr.yml en.yml etc. ???
16
+ ## why? why not?
17
+
18
+ MONTH_FR = 'Janvier|Janv|Jan|' +
19
+ 'Février|Févr|Fév|' +
20
+ 'Mars|Mar|' +
21
+ 'Avril|Avri|Avr|' +
22
+ 'Mai|' +
23
+ 'Juin|' +
24
+ 'Juillet|Juil|' +
25
+ 'Août|' +
26
+ 'Septembre|Sept|' +
27
+ 'Octobre|Octo|Oct|' +
28
+ 'Novembre|Nove|Nov|' +
29
+ 'Décembre|Déce|Déc'
30
+ MONTH_FR_TO_MM = {
31
+ 'Janvier' => '1', 'Janv' => '1', 'Jan' => '1', ## check janv in use??
32
+ 'Février' => '2', 'Févr' => '2', 'Fév' => '2', ## check fevr in use???
33
+ 'Mars' => '3', 'Mar' => '3',
34
+ 'Avril' => '4', 'Avri' => '4', 'Avr' => '4', ## check avri in use??? if not remove
35
+ 'Mai' => '5',
36
+ 'Juin' => '6',
37
+ 'Juillet' => '7', 'Juil' => '7',
38
+ 'Août' => '8',
39
+ 'Septembre' => '9', 'Sept' => '9',
40
+ 'Octobre' => '10', 'Octo' => '10', 'Oct' => '10', ### check octo in use??
41
+ 'Novembre' => '11', 'Nove' => '11', 'Nov' => '11', ## check nove in use??
42
+ 'Décembre' => '12', 'Déce' => '12', 'Déc' => '12' } ## check dece in use??
43
+ WEEKDAY_FR = 'Lundi|Lun|L|' +
44
+ 'Mardi|Mar|Ma|' +
45
+ 'Mercredi|Mer|Me|' +
46
+ 'Jeudi|Jeu|J|' +
47
+ 'Vendredi|Ven|V|' +
48
+ 'Samedi|Sam|S|' +
49
+ 'Dimanche|Dim|D|'
50
+
51
+
10
52
  MONTH_EN = 'January|Jan|'+
11
53
  'February|Feb|'+
12
54
  'March|Mar|'+
@@ -33,6 +75,14 @@ class DateFinder
33
75
  'Nov' => '11', 'November' => '11',
34
76
  'Dec' => '12', 'December' =>'12' }
35
77
 
78
+ ###
79
+ ## todo: add days
80
+ ## 1. Sunday - Sun. 2. Monday - Mon.
81
+ ## 3. Tuesday - Tu., Tue., or Tues. 4. Wednesday - Wed.
82
+ ## 5. Thursday - Th., Thu., Thur., or Thurs. 6. Friday - Fri.
83
+ ## 7. Saturday - Sat.
84
+
85
+
36
86
  MONTH_ES = 'Enero|Ene|Feb|Marzo|Mar|Abril|Abr|Mayo|May|Junio|Jun|Julio|Jul|Agosto|Ago|Sept|Set|Sep|Oct|Nov|Dic'
37
87
  MONTH_ES_TO_MM = {
38
88
  'Ene' => '1', 'Enero' => '1',
@@ -123,7 +173,7 @@ class DateFinder
123
173
  # e.g. 14.09. => DD.MM. w/ implied year and implied hours (set to 12:00)
124
174
  # note: allow end delimiter ] e.g. [Sa 12.01.] or end-of-string ($) too
125
175
  # note: we use a lookahead for last part e.g. (?:\s+|$|[\]]) - do NOT cosume
126
- # regex_de4
176
+ # regex_de4 (use lookahead assert)
127
177
  DD_MM__DATE_REGEX = /\b
128
178
  (?<day>\d{1,2})
129
179
  \.
@@ -206,6 +256,18 @@ class DateFinder
206
256
  (?<month_es>#{MONTH_ES})
207
257
  \b/x
208
258
 
259
+ # e.g. Ven 8. Août or [Ven 8. Août]
260
+ ### note: do NOT consume [] in regex (use lookahead assert)
261
+ FR__WEEKDAY_DD_MONTH__DATE_REGEX = /\b
262
+ (?:#{WEEKDAY_FR}) # note: skip weekday for now; do NOT capture
263
+ \s+
264
+ (?<day>\d{1,2})
265
+ \.
266
+ \s+
267
+ (?<month_fr>#{MONTH_FR})
268
+ (?=\s+|$|[\]])/x ## note: allow end-of-string/line too
269
+
270
+
209
271
 
210
272
 
211
273
  # map table - 1) tag, 2) regex - note: order matters; first come-first matched/served
@@ -216,6 +278,7 @@ class DateFinder
216
278
  [ '[DD_MM_hh_mm]', DD_MM__DATE_TIME_REGEX ],
217
279
  [ '[DD_MM_YYYY]', DD_MM_YYYY__DATE_REGEX ],
218
280
  [ '[DD_MM]', DD_MM__DATE_REGEX ],
281
+ [ '[FR_WEEKDAY_DD_MONTH]', FR__WEEKDAY_DD_MONTH__DATE_REGEX ],
219
282
  [ '[EN_DD_MONTH_YYYY_hh_mm]', EN__DD_MONTH_YYYY__DATE_TIME_REGEX ],
220
283
  [ '[EN_MONTH_DD_YYYY_hh_mm]', EN__MONTH_DD_YYYY__DATE_TIME_REGEX ],
221
284
  [ '[EN_MONTH_DD_hh_mm]', EN__MONTH_DD__DATE_TIME_REGEX ],
@@ -289,6 +352,7 @@ private
289
352
 
290
353
  h[ :month ] = MONTH_EN_TO_MM[ h[:month_en] ] if h[:month_en]
291
354
  h[ :month ] = MONTH_ES_TO_MM[ h[:month_es] ] if h[:month_es]
355
+ h[ :month ] = MONTH_FR_TO_MM[ h[:month_fr] ] if h[:month_fr]
292
356
 
293
357
  month = h[:month]
294
358
  day = h[:day]
@@ -54,11 +54,8 @@ class Reader
54
54
  end
55
55
  end
56
56
 
57
-
58
- def load( name ) # convenience helper for all-in-one reader
59
-
60
- logger.debug "enter load( name=>>#{name}<<, include_path=>>#{include_path}<<)"
61
-
57
+ def fix_fix_load_racing_fix_fix
58
+ =begin
62
59
  if name =~ /^circuits/ # e.g. circuits.txt in formula1.db
63
60
  reader = TrackReader.new( include_path )
64
61
  reader.read( name )
@@ -75,11 +72,6 @@ class Reader
75
72
  elsif name =~ /^drivers/ # e.g. drivers.txt in formula1.db
76
73
  reader = PersonDb::PersonReader.new( include_path )
77
74
  reader.read( name )
78
- elsif match_players_for_country( name ) do |country_key|
79
- country = Country.find_by_key!( country_key )
80
- reader = PersonDb::PersonReader.new( include_path )
81
- reader.read( name, country_id: country.id )
82
- end
83
75
  elsif match_skiers_for_country( name ) do |country_key| # name =~ /^([a-z]{2})\/skiers/
84
76
  # auto-add country code (from folder structure) for country-specific skiers (persons)
85
77
  # e.g. at/skiers or at-austria/skiers.men
@@ -90,14 +82,45 @@ class Reader
90
82
  elsif name =~ /^skiers/ # e.g. skiers.men.txt in ski.db
91
83
  reader = PersonDb::PersonReader.new( include_path )
92
84
  reader.read( name )
93
- elsif name =~ /^teams/ # e.g. teams.txt in formula1.db ### fix: check if used for football ? - add clubs
94
- reader = TeamReader.new( include_path )
95
- reader.read( name )
96
85
  elsif name =~ /\/races/ # e.g. 2013/races.txt in formula1.db
97
86
  ## fix/bug: NOT working for now; sorry
98
87
  # need to read event first and pass along to read (event_id: event.id) etc.
99
88
  reader = RaceReader.new( include_path )
100
89
  reader.read( name )
90
+ elsif name =~ /^teams/ # e.g. teams.txt in formula1.db ### fix: check if used for football ? - add clubs
91
+ reader = TeamReader.new( include_path )
92
+ reader.read( name )
93
+ ## fix!!! - find a better unique pattern to generic???
94
+ ##
95
+ ## fix: use two routes/tracks/modes:
96
+ ##
97
+ ## races w/ records etc and teams/matches etc. split into two to make code easier to read/extend!!!
98
+ ##
99
+ elsif name =~ /\/([0-9]{2})-/
100
+ race_pos = $1.to_i
101
+ # NB: assume @event is set from previous load
102
+ race = Race.find_by_event_id_and_pos( @event.id, race_pos )
103
+ reader = RecordReader.new( include_path )
104
+ reader.read( name, race_id: race.id ) # e.g. 2013/04-gp-monaco.txt in formula1.db
105
+
106
+ elsif name =~ /\/squads/ || name =~ /\/rosters/ # e.g. 2013/squads.txt in formula1.db
107
+ reader = RaceTeamReader.new( include_path )
108
+ reader.read( name )
109
+
110
+ =end
111
+ end
112
+
113
+
114
+ def load( name ) # convenience helper for all-in-one reader
115
+
116
+ logger.debug "enter load( name=>>#{name}<<, include_path=>>#{include_path}<<)"
117
+
118
+
119
+ if match_players_for_country( name ) do |country_key|
120
+ country = Country.find_by_key!( country_key )
121
+ reader = PersonDb::PersonReader.new( include_path )
122
+ reader.read( name, country_id: country.id )
123
+ end
101
124
  elsif name =~ /\/squads\/([a-z]{2,3})-[^\/]+$/
102
125
  ## fix: add to country matcher new format
103
126
  ## name is country! and parent folder is type name e.g. /squads/br-brazil
@@ -121,25 +144,6 @@ class Reader
121
144
  reader = SquadReader.new( include_path )
122
145
  ## note: pass in @event.id - that is, last seen event (e.g. parsed via GameReader/MatchReader)
123
146
  reader.read( name, team_id: team.id, event_id: @event.id )
124
- elsif name =~ /\/squads/ || name =~ /\/rosters/ # e.g. 2013/squads.txt in formula1.db
125
- reader = RaceTeamReader.new( include_path )
126
- reader.read( name )
127
-
128
-
129
- ## fix!!! - find a better unique pattern to generic???
130
- ##
131
- ## fix: use two routes/tracks/modes:
132
- ##
133
- ## races w/ records etc and teams/matches etc. split into two to make code easier to read/extend!!!
134
- ##
135
- elsif name =~ /\/([0-9]{2})-/
136
- race_pos = $1.to_i
137
- # NB: assume @event is set from previous load
138
- race = Race.find_by_event_id_and_pos( @event.id, race_pos )
139
- reader = RecordReader.new( include_path )
140
- reader.read( name, race_id: race.id ) # e.g. 2013/04-gp-monaco.txt in formula1.db
141
-
142
-
143
147
  elsif name =~ /(?:^|\/)seasons/ # NB: ^seasons or also possible at-austria!/seasons
144
148
  reader = SeasonReader.new( include_path )
145
149
  reader.read( name )
@@ -76,56 +76,6 @@ create_table :goals do |t|
76
76
  end
77
77
 
78
78
 
79
- create_table :tracks do |t| # e.g. Formula 1 circuits or Apline Ski resorts/slops/pistes
80
- t.string :key, null: false # import/export key
81
- t.string :title, null: false
82
- t.string :synonyms # comma separated list of synonyms
83
- t.string :code # three letter code (short title)
84
-
85
- t.references :city
86
- t.references :region
87
- t.references :country, null: false
88
- t.timestamps
89
- end
90
-
91
-
92
- # join table -> event(season+league)+track
93
- create_table :races do |t| # e.g. Formula 1 race (Grand Prix Monaco) or Alpine Ski race (Downhill Lake Louise)
94
- t.references :track, null: false
95
- t.references :event, null: false
96
- t.integer :pos, null: false # Race #1,#2,#3,#4 etc.
97
-
98
- ## todo: add auto-created key (for import/export) e.g.
99
-
100
- t.datetime :start_at
101
- t.timestamps
102
- end
103
-
104
- create_table :runs do |t|
105
- t.references :race, null: false
106
- t.integer :pos, null: false
107
-
108
- t.datetime :start_at
109
- t.timestamps
110
- end
111
-
112
- # join table -> race+person or run+person
113
- create_table :records do |t| # use TimeRecord? instead of simple record
114
- t.references :race # optional either race or run references
115
- t.references :run
116
- t.references :person, null: false
117
- t.integer :pos # 1,2,3, etc or 0
118
- t.boolean :completed, null: false, default: true # completed race - find better name?
119
- t.string :state # find a better name? e.g. retired, e.g.
120
- t.string :comment # find a better name ? e.g. collision damage (if ret) for formula 1
121
- t.time :time
122
- t.string :timeline # e.g. + 0:45.343 or +1 lap
123
- t.integer :laps # laps counter for formula1
124
-
125
- t.timestamps
126
- end
127
-
128
-
129
79
  ################
130
80
  # fix/todo: rename to squads / lineups
131
81
 
@@ -11,13 +11,15 @@ module SportDb
11
11
  puts " #{Game.count} games"
12
12
  puts " #{Badge.count} badges"
13
13
 
14
- puts " #{Track.count} tracks / #{Race.count} races (track+event recs) / #{Run.count} runs"
15
- puts " #{Record.count} records (race|run+person recs)"
16
14
  puts " #{Roster.count} rosters (person+team+event recs)"
17
15
  puts " #{Goal.count} goals (person+game recs)"
18
16
 
19
17
  puts " #{Assoc.count} assocs|orgs"
20
18
  puts " #{Ground.count} grounds|stadiums"
19
+
20
+ ## note: moved to racing.db -- remove/delete!!
21
+ ## puts " #{Track.count} tracks / #{Race.count} races (track+event recs) / #{Run.count} runs"
22
+ ## puts " #{Record.count} records (race|run+person recs)"
21
23
  end
22
24
 
23
25
  ## fix/chek:
@@ -1,6 +1,6 @@
1
1
 
2
2
  module SportDb
3
- VERSION = '1.9.4'
3
+ VERSION = '1.9.5'
4
4
  end
5
5
 
6
6
 
@@ -53,7 +53,9 @@ LeagueReader = SportDb::LeagueReader
53
53
  EventReader = SportDb::EventReader
54
54
  GameReader = SportDb::GameReader
55
55
  SquadReader = SportDb::SquadReader
56
- RaceTeamReader = SportDb::RaceTeamReader
56
+
57
+ ## moved to racing.db - remove/delete!!
58
+ ## RaceTeamReader = SportDb::RaceTeamReader
57
59
 
58
60
  PersonReader = PersonDb::PersonReader
59
61
 
@@ -20,6 +20,22 @@ class TestDate < MiniTest::Unit::TestCase
20
20
  assert_dates( data, start_at: DateTime.new( 2013, 1, 1 ) )
21
21
  end
22
22
 
23
+ def test_date_fr
24
+ data = [
25
+ [ '[Ven 08. Août]', '2014-08-08' ],
26
+ [ 'Ven 08. Août', '2014-08-08' ],
27
+ [ 'Ven 8. Août', '2014-08-08' ],
28
+ [ '[Sam 9. Août]', '2014-08-09' ],
29
+ [ '[Dim 10. Août]', '2014-08-10' ],
30
+ [ '[Sam 31. Janv]', '2015-01-31' ],
31
+ [ '[Sam 7. Févr]', '2015-02-07' ],
32
+ [ '[Sam 31. Jan]', '2015-01-31' ],
33
+ [ '[Sam 7. Fév]', '2015-02-07' ],
34
+ ]
35
+
36
+ assert_dates( data, start_at: DateTime.new( 2014, 8, 1 ) )
37
+ end
38
+
23
39
  def test_date_en
24
40
  data = [
25
41
  [ 'Jun/12 2011 14:00', '2011-06-12 14:00' ],
@@ -17,7 +17,7 @@ class TestLang < MiniTest::Unit::TestCase
17
17
 
18
18
  group = 'Group'
19
19
 
20
- round = 'Round|Matchday'
20
+ round = 'Round|Matchday|Week'
21
21
  round << '|Round of 32|Last 32'
22
22
  round << '|Round of 16|Last 16|8th finals'
23
23
  round << '|Quarterfinals|Quarter-finals|Quarters|Quarterfinal|Last 8'
metadata CHANGED
@@ -1,183 +1,148 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.4
4
+ version: 1.9.5
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Gerald Bauer
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-07-27 00:00:00.000000000 Z
12
+ date: 2014-08-10 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: props
15
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &72969190 !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0'
20
22
  type: :runtime
21
23
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ! '>='
25
- - !ruby/object:Gem::Version
26
- version: '0'
24
+ version_requirements: *72969190
27
25
  - !ruby/object:Gem::Dependency
28
26
  name: logutils
29
- requirement: !ruby/object:Gem::Requirement
27
+ requirement: &72968780 !ruby/object:Gem::Requirement
28
+ none: false
30
29
  requirements:
31
30
  - - ! '>='
32
31
  - !ruby/object:Gem::Version
33
32
  version: '0'
34
33
  type: :runtime
35
34
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ! '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
35
+ version_requirements: *72968780
41
36
  - !ruby/object:Gem::Dependency
42
37
  name: textutils
43
- requirement: !ruby/object:Gem::Requirement
38
+ requirement: &72968550 !ruby/object:Gem::Requirement
39
+ none: false
44
40
  requirements:
45
41
  - - ! '>='
46
42
  - !ruby/object:Gem::Version
47
43
  version: '0'
48
44
  type: :runtime
49
45
  prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
46
+ version_requirements: *72968550
55
47
  - !ruby/object:Gem::Dependency
56
48
  name: worlddb
57
- requirement: !ruby/object:Gem::Requirement
49
+ requirement: &72968280 !ruby/object:Gem::Requirement
50
+ none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: 2.0.2
62
55
  type: :runtime
63
56
  prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ! '>='
67
- - !ruby/object:Gem::Version
68
- version: 2.0.2
57
+ version_requirements: *72968280
69
58
  - !ruby/object:Gem::Dependency
70
59
  name: tagutils
71
- requirement: !ruby/object:Gem::Requirement
60
+ requirement: &72968080 !ruby/object:Gem::Requirement
61
+ none: false
72
62
  requirements:
73
63
  - - ! '>='
74
64
  - !ruby/object:Gem::Version
75
65
  version: '0'
76
66
  type: :runtime
77
67
  prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ! '>='
81
- - !ruby/object:Gem::Version
82
- version: '0'
68
+ version_requirements: *72968080
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: persondb
85
- requirement: !ruby/object:Gem::Requirement
71
+ requirement: &72967860 !ruby/object:Gem::Requirement
72
+ none: false
86
73
  requirements:
87
74
  - - ! '>='
88
75
  - !ruby/object:Gem::Version
89
76
  version: '0'
90
77
  type: :runtime
91
78
  prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ! '>='
95
- - !ruby/object:Gem::Version
96
- version: '0'
79
+ version_requirements: *72967860
97
80
  - !ruby/object:Gem::Dependency
98
81
  name: activerecord-utils
99
- requirement: !ruby/object:Gem::Requirement
82
+ requirement: &72967640 !ruby/object:Gem::Requirement
83
+ none: false
100
84
  requirements:
101
85
  - - ! '>='
102
86
  - !ruby/object:Gem::Version
103
87
  version: '0'
104
88
  type: :runtime
105
89
  prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ! '>='
109
- - !ruby/object:Gem::Version
110
- version: '0'
90
+ version_requirements: *72967640
111
91
  - !ruby/object:Gem::Dependency
112
92
  name: fetcher
113
- requirement: !ruby/object:Gem::Requirement
93
+ requirement: &72967380 !ruby/object:Gem::Requirement
94
+ none: false
114
95
  requirements:
115
96
  - - ! '>='
116
97
  - !ruby/object:Gem::Version
117
98
  version: '0.3'
118
99
  type: :runtime
119
100
  prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ! '>='
123
- - !ruby/object:Gem::Version
124
- version: '0.3'
101
+ version_requirements: *72967380
125
102
  - !ruby/object:Gem::Dependency
126
103
  name: gli
127
- requirement: !ruby/object:Gem::Requirement
104
+ requirement: &72967120 !ruby/object:Gem::Requirement
105
+ none: false
128
106
  requirements:
129
107
  - - ! '>='
130
108
  - !ruby/object:Gem::Version
131
109
  version: 2.5.6
132
110
  type: :runtime
133
111
  prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ! '>='
137
- - !ruby/object:Gem::Version
138
- version: 2.5.6
112
+ version_requirements: *72967120
139
113
  - !ruby/object:Gem::Dependency
140
114
  name: activerecord
141
- requirement: !ruby/object:Gem::Requirement
115
+ requirement: &72983150 !ruby/object:Gem::Requirement
116
+ none: false
142
117
  requirements:
143
118
  - - ! '>='
144
119
  - !ruby/object:Gem::Version
145
120
  version: '0'
146
121
  type: :runtime
147
122
  prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ! '>='
151
- - !ruby/object:Gem::Version
152
- version: '0'
123
+ version_requirements: *72983150
153
124
  - !ruby/object:Gem::Dependency
154
125
  name: rdoc
155
- requirement: !ruby/object:Gem::Requirement
126
+ requirement: &72982730 !ruby/object:Gem::Requirement
127
+ none: false
156
128
  requirements:
157
129
  - - ~>
158
130
  - !ruby/object:Gem::Version
159
131
  version: '4.0'
160
132
  type: :development
161
133
  prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ~>
165
- - !ruby/object:Gem::Version
166
- version: '4.0'
134
+ version_requirements: *72982730
167
135
  - !ruby/object:Gem::Dependency
168
136
  name: hoe
169
- requirement: !ruby/object:Gem::Requirement
137
+ requirement: &72982430 !ruby/object:Gem::Requirement
138
+ none: false
170
139
  requirements:
171
140
  - - ~>
172
141
  - !ruby/object:Gem::Version
173
- version: '3.10'
142
+ version: '3.11'
174
143
  type: :development
175
144
  prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - ~>
179
- - !ruby/object:Gem::Version
180
- version: '3.10'
145
+ version_requirements: *72982430
181
146
  description: sportdb - sport.db command line tool
182
147
  email: opensport@googlegroups.com
183
148
  executables:
@@ -232,11 +197,8 @@ files:
232
197
  - lib/sportdb/models/group_team.rb
233
198
  - lib/sportdb/models/league.rb
234
199
  - lib/sportdb/models/person.rb
235
- - lib/sportdb/models/race.rb
236
- - lib/sportdb/models/record.rb
237
200
  - lib/sportdb/models/roster.rb
238
201
  - lib/sportdb/models/round.rb
239
- - lib/sportdb/models/run.rb
240
202
  - lib/sportdb/models/season.rb
241
203
  - lib/sportdb/models/stats/alltime_standing.rb
242
204
  - lib/sportdb/models/stats/alltime_standing_entry.rb
@@ -246,7 +208,6 @@ files:
246
208
  - lib/sportdb/models/stats/group_standing_entry.rb
247
209
  - lib/sportdb/models/team.rb
248
210
  - lib/sportdb/models/team_comp.rb
249
- - lib/sportdb/models/track.rb
250
211
  - lib/sportdb/models/utils.rb
251
212
  - lib/sportdb/models/world/city.rb
252
213
  - lib/sportdb/models/world/continent.rb
@@ -259,13 +220,9 @@ files:
259
220
  - lib/sportdb/readers/game.rb
260
221
  - lib/sportdb/readers/ground.rb
261
222
  - lib/sportdb/readers/league.rb
262
- - lib/sportdb/readers/race.rb
263
- - lib/sportdb/readers/race_team.rb
264
- - lib/sportdb/readers/record.rb
265
223
  - lib/sportdb/readers/season.rb
266
224
  - lib/sportdb/readers/squad.rb
267
225
  - lib/sportdb/readers/team.rb
268
- - lib/sportdb/readers/track.rb
269
226
  - lib/sportdb/schema.rb
270
227
  - lib/sportdb/service.rb
271
228
  - lib/sportdb/service/public/style.css
@@ -353,7 +310,6 @@ files:
353
310
  homepage: https://github.com/sportdb/sport.db.ruby
354
311
  licenses:
355
312
  - Public Domain
356
- metadata: {}
357
313
  post_install_message: ! '******************************************************************************
358
314
 
359
315
 
@@ -371,36 +327,38 @@ rdoc_options:
371
327
  require_paths:
372
328
  - lib
373
329
  required_ruby_version: !ruby/object:Gem::Requirement
330
+ none: false
374
331
  requirements:
375
332
  - - ! '>='
376
333
  - !ruby/object:Gem::Version
377
334
  version: 1.9.2
378
335
  required_rubygems_version: !ruby/object:Gem::Requirement
336
+ none: false
379
337
  requirements:
380
338
  - - ! '>='
381
339
  - !ruby/object:Gem::Version
382
340
  version: '0'
383
341
  requirements: []
384
342
  rubyforge_project:
385
- rubygems_version: 2.1.10
343
+ rubygems_version: 1.8.17
386
344
  signing_key:
387
- specification_version: 4
345
+ specification_version: 3
388
346
  summary: sportdb - sport.db command line tool
389
347
  test_files:
390
- - test/test_assoc_reader.rb
391
- - test/test_changes.rb
392
- - test/test_cursor.rb
393
348
  - test/test_date.rb
394
- - test/test_goals.rb
395
349
  - test/test_lang.rb
396
350
  - test/test_load.rb
397
- - test/test_reader.rb
398
- - test/test_reader_from_string.rb
399
- - test/test_round_auto.rb
400
- - test/test_round_def.rb
401
- - test/test_round_header.rb
402
- - test/test_scores.rb
403
- - test/test_squad_reader.rb
351
+ - test/test_cursor.rb
404
352
  - test/test_standings.rb
405
- - test/test_utils.rb
353
+ - test/test_scores.rb
406
354
  - test/test_winner.rb
355
+ - test/test_round_def.rb
356
+ - test/test_utils.rb
357
+ - test/test_squad_reader.rb
358
+ - test/test_reader_from_string.rb
359
+ - test/test_round_header.rb
360
+ - test/test_round_auto.rb
361
+ - test/test_goals.rb
362
+ - test/test_reader.rb
363
+ - test/test_assoc_reader.rb
364
+ - test/test_changes.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 75701bce9778f7729f1ea7a9e5244ba7fb471edb
4
- data.tar.gz: e08713c56ec7e46286b7b8f2ded213d1b8db42aa
5
- SHA512:
6
- metadata.gz: 996b1532556e67a7b9b56db38e955f87375968ae0fb4c872ae2eb377f83730c05c9777e01f073638e76dc6e077061e92d6b988ece00c12b8073fbc9b0d1db87d
7
- data.tar.gz: 837ba63144656e2596294e4f76e490889592456e9d77d63155fcf7b466a6640d7342a9d57f236cb702d211286d1fa04e01d8f31184254ece93c5e6425753ec4c
@@ -1,20 +0,0 @@
1
-
2
- module SportDb
3
- module Model
4
-
5
-
6
- class Race < ActiveRecord::Base
7
-
8
- belongs_to :track
9
- belongs_to :event
10
-
11
- ### fix/todo: add runs/records (records - join table - run/race+person)
12
- ## has_many :runs # e.g. Test Drive, Quali 1, Quali 2, Quali 3, Race
13
- ## run - has_many records? - run_stats? - what name to use?
14
-
15
- end # class Race
16
-
17
-
18
- end # module Model
19
- end # module SportDb
20
-
@@ -1,17 +0,0 @@
1
-
2
- module SportDb
3
- module Model
4
-
5
-
6
- class Record < ActiveRecord::Base
7
-
8
- belongs_to :race # or
9
- belongs_to :run
10
- belongs_to :person, class_name: 'PersonDb::Model::Person', foreign_key: 'person_id'
11
-
12
- end # class Record
13
-
14
-
15
- end # module Model
16
- end # module SportDb
17
-
@@ -1,15 +0,0 @@
1
-
2
- module SportDb
3
- module Model
4
-
5
-
6
- class Run < ActiveRecord::Base
7
-
8
- belongs_to :race
9
-
10
- end # class Run
11
-
12
-
13
- end # module Model
14
- end # module SportDb
15
-
@@ -1,61 +0,0 @@
1
- module SportDb
2
- module Model
3
-
4
- class Track < ActiveRecord::Base
5
-
6
- has_many :races
7
-
8
- belongs_to :country, :class_name => 'WorldDb::Model::Country', :foreign_key => 'country_id'
9
-
10
- #####################
11
- ## convenience helper for text parser/reader
12
-
13
-
14
- ### fix: move known_tracks_table to event!!! (e.g. scoped by event)
15
-
16
- def self.known_tracks_table
17
- @@known_tracks_table ||= TextUtils.build_title_table_for( Track.all )
18
- end # method known_tracks_table
19
-
20
-
21
- def self.create_or_update_from_values( new_attributes, values )
22
-
23
- ## fix: add/configure logger for ActiveRecord!!!
24
- logger = LogKernel::Logger.root
25
-
26
- ## check optional values
27
- values.each_with_index do |value, index|
28
- if value =~ /^[a-z]{2}$/ ## assume two-letter country key e.g. at,de,mx,etc.
29
- value_country = Country.find_by_key!( value )
30
- new_attributes[ :country_id ] = value_country.id
31
- elsif value =~ /^[A-Z]{3}$/ ## assume three-letter code e.g. AUS, MAL, etc.
32
- new_attributes[ :code ] = value
33
- else
34
- ## todo: assume title2 ??
35
- ## assume title2 if title2 is empty (not already in use)
36
- ## and if it title2 contains at least two letter e.g. [a-zA-Z].*[a-zA-Z]
37
- # issue warning: unknown type for value
38
- logger.warn "unknown type for value >#{value}< - key #{new_attributes[:key]}"
39
- end
40
- end
41
-
42
- rec = Track.find_by_key( new_attributes[ :key ] )
43
- if rec.present?
44
- logger.debug "update Track #{rec.id}-#{rec.key}:"
45
- else
46
- logger.debug "create Track:"
47
- rec = Track.new
48
- end
49
-
50
- logger.debug new_attributes.to_json
51
-
52
- rec.update_attributes!( new_attributes )
53
- end # create_or_update_from_values
54
-
55
-
56
- end # class Track
57
-
58
-
59
- end # module Model
60
- end # module SportDb
61
-
@@ -1,102 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- module SportDb
4
-
5
-
6
- class RaceReader
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
- ## value helpers e.g. is_year?, is_taglist? etc.
15
- include TextUtils::ValueHelper
16
-
17
- include FixtureHelpers
18
-
19
-
20
- attr_reader :include_path
21
-
22
- def initialize( include_path, opts = {} )
23
- @include_path = include_path
24
- end
25
-
26
-
27
- ###
28
- ## fix: use read_fixtures( event_key, name )
29
- ##
30
- ## move EventReader out of read - why?? why not??
31
-
32
- def read( name, more_attribs={} )
33
-
34
- # must have .yml file with same name for event definition
35
- evreader = EventReader.new( include_path )
36
- evreader.read( name )
37
-
38
- @event = evreader.event
39
-
40
- logger.info " event: #{@event.key} >>#{@event.full_title}<<"
41
-
42
- path = "#{include_path}/#{name}.txt"
43
-
44
- logger.info "parsing data '#{name}' (#{path})..."
45
-
46
- ### SportDb.lang.lang = LangChecker.new.analyze( name, include_path )
47
-
48
- ## for now: use all tracks (later filter/scope by event)
49
- @known_tracks = Track.known_tracks_table
50
-
51
- reader = LineReader.new( path )
52
-
53
- read_races_worker( reader )
54
-
55
- Prop.create_from_fixture!( name, path )
56
- end
57
-
58
-
59
- def read_races_worker( reader )
60
-
61
- reader.each_line do |line|
62
- logger.debug " line: >#{line}<"
63
-
64
- cut_off_end_of_line_comment!( line )
65
-
66
- pos = find_leading_pos!( line )
67
-
68
- map_track!( line )
69
- track_key = find_track!( line )
70
- track = Track.find_by_key!( track_key )
71
-
72
- date = find_date!( line )
73
-
74
- logger.debug " line2: >#{line}<"
75
-
76
- ### check if games exists
77
- race = Race.find_by_event_id_and_track_id( @event.id, track.id )
78
-
79
- if race.present?
80
- logger.debug "update race #{race.id}:"
81
- else
82
- logger.debug "create race:"
83
- race = Race.new
84
- end
85
-
86
- race_attribs = {
87
- pos: pos,
88
- track_id: track.id,
89
- start_at: date,
90
- event_id: @event.id
91
- }
92
-
93
- logger.debug race_attribs.to_json
94
-
95
- race.update_attributes!( race_attribs )
96
- end # lines.each
97
-
98
- end # method read_races_worker
99
-
100
-
101
- end # class RaceReader
102
- end # module SportDb
@@ -1,109 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- module SportDb
4
-
5
-
6
- ### squad/roster reader for races
7
- class RaceTeamReader
8
-
9
- include LogUtils::Logging
10
-
11
- ## make models available by default with namespace
12
- # e.g. lets you use Usage instead of Model::Usage
13
- include Models
14
-
15
- ## value helpers e.g. is_year?, is_taglist? etc.
16
- include TextUtils::ValueHelper
17
-
18
- include FixtureHelpers
19
-
20
-
21
- attr_reader :include_path
22
-
23
-
24
- def initialize( include_path, opts = {} )
25
- @include_path = include_path
26
- end
27
-
28
-
29
- def read( name, more_attribs={} )
30
- ## todo: move name_real_path code to LineReaderV2 ????
31
- pos = name.index( '!/')
32
- if pos.nil?
33
- name_real_path = name # not found; real path is the same as name
34
- else
35
- # cut off everything until !/ e.g.
36
- # at-austria!/w-wien/beers becomes
37
- # w-wien/beers
38
- name_real_path = name[ (pos+2)..-1 ]
39
- end
40
-
41
- path = "#{include_path}/#{name_real_path}.txt"
42
-
43
- logger.info "parsing data '#{name}' (#{path})..."
44
- ### SportDb.lang.lang = LangChecker.new.analyze( name, include_path )
45
-
46
- reader = LineReader.new( path )
47
-
48
- ## for now: use all tracks (later filter/scope by event)
49
- # @known_tracks = Track.known_tracks_table
50
-
51
- ## fix: add @known_teams - for now; use teams (not scoped by event)
52
- ## for now use all teams
53
- @known_teams = TextUtils.build_title_table_for( Team.all )
54
- ## and for now use all persons
55
- @known_persons = TextUtils.build_title_table_for( Person.all )
56
-
57
-
58
- read_worker( reader )
59
-
60
- Prop.create_from_fixture!( name, path )
61
- end
62
-
63
-
64
- def read_worker( reader )
65
-
66
- reader.each_line do |line|
67
- logger.debug " line: >#{line}<"
68
-
69
- cut_off_end_of_line_comment!( line )
70
-
71
- pos = find_leading_pos!( line )
72
-
73
- map_team!( line )
74
- team_key = find_team!( line )
75
- team = Team.find_by_key!( team_key )
76
-
77
- map_person!( line )
78
- person_key = find_person!( line )
79
- person = Person.find_by_key!( person_key )
80
-
81
- logger.debug " line2: >#{line}<"
82
-
83
- ### check if roster record exists
84
- roster = Roster.find_by_event_id_and_team_id_and_person_id( @event.id, team.id, person.id )
85
-
86
- if roster.present?
87
- logger.debug "update Roster #{roster.id}:"
88
- else
89
- logger.debug "create Roster:"
90
- roster = Roster.new
91
- end
92
-
93
- roster_attribs = {
94
- pos: pos,
95
- team_id: team.id,
96
- person_id: person.id,
97
- event_id: @event.id # NB: reuse/fallthrough from races - make sure load_races goes first (to setup event)
98
- }
99
-
100
- logger.debug roster_attribs.to_json
101
-
102
- roster.update_attributes!( roster_attribs )
103
- end # lines.each
104
-
105
- end # method read_worker
106
-
107
-
108
- end # class RaceTeamReader
109
- end # module SportDb
@@ -1,108 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- module SportDb
4
-
5
-
6
- class RecordReader
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
- ## value helpers e.g. is_year?, is_taglist? etc.
15
- include TextUtils::ValueHelper
16
-
17
- include FixtureHelpers
18
-
19
-
20
- attr_reader :include_path
21
-
22
-
23
- def initialize( include_path, opts = {} )
24
- @include_path = include_path
25
- end
26
-
27
-
28
- def read( name, more_attribs={} )
29
- path = "#{include_path}/#{name}.txt"
30
-
31
- logger.info "parsing data '#{name}' (#{path})..."
32
-
33
- ### SportDb.lang.lang = LangChecker.new.analyze( name, include_path )
34
-
35
- reader = LineReader.new( path )
36
-
37
- ## for now: use all tracks (later filter/scope by event)
38
- # @known_tracks = Track.known_tracks_table
39
-
40
- ## fix: add @known_teams - for now; use teams (not scoped by event)
41
- @known_teams = TextUtils.build_title_table_for( Team.all )
42
- ## and for now use all persons
43
- @known_persons = TextUtils.build_title_table_for( Person.all )
44
-
45
- read_records_worker( reader, more_attribs )
46
-
47
- Prop.create_from_fixture!( name, path )
48
- end
49
-
50
-
51
- def read_records_worker( reader, more_attribs )
52
-
53
- reader.each_line do |line|
54
- logger.debug " line: >#{line}<"
55
-
56
- cut_off_end_of_line_comment!( line )
57
-
58
- state = find_record_leading_state!( line )
59
-
60
- map_team!( line )
61
- team_key = find_team!( line )
62
- team = Team.find_by_key!( team_key )
63
-
64
- map_person!( line )
65
- person_key = find_person!( line )
66
- person = Person.find_by_key!( person_key )
67
-
68
- timeline = find_record_timeline!( line )
69
-
70
- laps = find_record_laps!( line )
71
-
72
- comment = find_record_comment!( line )
73
-
74
- logger.debug " line2: >#{line}<"
75
-
76
- record_attribs = {
77
- state: state,
78
- ## team_id: team.id, ## NB: not needed for db
79
- person_id: person.id,
80
- timeline: timeline,
81
- comment: comment,
82
- laps: laps
83
- }
84
-
85
- record_attribs = record_attribs.merge( more_attribs )
86
-
87
- ### check if record exists
88
- record = Record.find_by_race_id_and_person_id( record_attribs[ :race_id ],
89
- record_attribs[ :person_id ])
90
-
91
- if record.present?
92
- logger.debug "update Record #{record.id}:"
93
- else
94
- logger.debug "create Record:"
95
- record = Record.new
96
- end
97
-
98
- logger.debug record_attribs.to_json
99
-
100
- record.update_attributes!( record_attribs )
101
-
102
- end # lines.each
103
-
104
- end # method read_records_worker
105
-
106
-
107
- end # class RecordReader
108
- end # module SportDb
@@ -1,34 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- module SportDb
4
-
5
-
6
- class TrackReader
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
-
15
- attr_reader :include_path
16
-
17
-
18
- def initialize( include_path, opts = {} )
19
- @include_path = include_path
20
- end
21
-
22
-
23
- def read( name, more_attribs={} )
24
- reader = ValuesReaderV2.new( name, include_path, more_attribs )
25
-
26
- reader.each_line do |new_attributes, values|
27
- Track.create_or_update_from_values( new_attributes, values )
28
- end # each lines
29
- end
30
-
31
-
32
-
33
- end # class TrackReader
34
- end # module SportDb