sportdb 1.8.6 → 1.8.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/{History.md → HISTORY.md} +0 -0
  3. data/Manifest.txt +6 -2
  4. data/Rakefile +12 -8
  5. data/config/fixtures/de.yml +3 -0
  6. data/config/fixtures/en.yml +3 -0
  7. data/config/fixtures/es.yml +3 -0
  8. data/config/fixtures/fr.yml +53 -0
  9. data/config/fixtures/it.yml +55 -0
  10. data/config/fixtures/pt.yml +28 -25
  11. data/config/fixtures/ro.yml +55 -0
  12. data/data/seasons.txt +43 -5
  13. data/data/setups/all.txt +5 -0
  14. data/lib/sportdb.rb +2 -1
  15. data/lib/sportdb/cli/main.rb +4 -0
  16. data/lib/sportdb/lang.rb +6 -1
  17. data/lib/sportdb/matcher.rb +31 -0
  18. data/lib/sportdb/models/badge.rb +4 -3
  19. data/lib/sportdb/models/event.rb +4 -2
  20. data/lib/sportdb/models/event_ground.rb +5 -2
  21. data/lib/sportdb/models/event_team.rb +6 -2
  22. data/lib/sportdb/models/forward.rb +9 -3
  23. data/lib/sportdb/models/game.rb +5 -2
  24. data/lib/sportdb/models/goal.rb +5 -2
  25. data/lib/sportdb/models/ground.rb +6 -2
  26. data/lib/sportdb/models/group.rb +5 -3
  27. data/lib/sportdb/models/group_team.rb +4 -3
  28. data/lib/sportdb/models/league.rb +4 -2
  29. data/lib/sportdb/models/person.rb +5 -2
  30. data/lib/sportdb/models/race.rb +6 -2
  31. data/lib/sportdb/models/record.rb +6 -2
  32. data/lib/sportdb/models/roster.rb +6 -2
  33. data/lib/sportdb/models/round.rb +7 -3
  34. data/lib/sportdb/models/run.rb +6 -2
  35. data/lib/sportdb/models/season.rb +5 -2
  36. data/lib/sportdb/models/team.rb +5 -2
  37. data/lib/sportdb/models/track.rb +5 -2
  38. data/lib/sportdb/models/world/city.rb +4 -2
  39. data/lib/sportdb/models/world/continent.rb +5 -2
  40. data/lib/sportdb/models/world/country.rb +4 -3
  41. data/lib/sportdb/models/world/region.rb +4 -2
  42. data/lib/sportdb/reader.rb +9 -28
  43. data/lib/sportdb/updater.rb +2 -2
  44. data/lib/sportdb/version.rb +1 -1
  45. data/test/helper.rb +6 -0
  46. metadata +115 -28
  47. data/data/setups/all.yml +0 -5
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e0653d4fa44c978d188c969c7ed90ad85fb086c4
4
+ data.tar.gz: 5aed7d909b52fc30921b0b1e8de525454624ce6b
5
+ SHA512:
6
+ metadata.gz: 12b2e6d68db5c2f17e60ee047e6d7402ed4b4f8baa32a65544a8de681c3d475668a8f62ff90731ff2d04df2b06a27ae5b188f21e037a66058481b25baac8af55
7
+ data.tar.gz: f0eed981f109218c6f23fc26a3148dddb3413d66a5ce3955bdc2cb88d6168f728b16efc2c8bde5b05b3a6e4981b75863202dd0276bf96ea229d0fe990e09342c
File without changes
@@ -1,4 +1,4 @@
1
- History.md
1
+ HISTORY.md
2
2
  Manifest.txt
3
3
  README.md
4
4
  Rakefile
@@ -6,9 +6,12 @@ bin/sportdb
6
6
  config/fixtures/de.yml
7
7
  config/fixtures/en.yml
8
8
  config/fixtures/es.yml
9
+ config/fixtures/fr.yml
10
+ config/fixtures/it.yml
9
11
  config/fixtures/pt.yml
12
+ config/fixtures/ro.yml
10
13
  data/seasons.txt
11
- data/setups/all.yml
14
+ data/setups/all.txt
12
15
  lib/sportdb.rb
13
16
  lib/sportdb/cli/main.rb
14
17
  lib/sportdb/cli/opts.rb
@@ -17,6 +20,7 @@ lib/sportdb/data/keys.rb
17
20
  lib/sportdb/data/models.rb
18
21
  lib/sportdb/deleter.rb
19
22
  lib/sportdb/lang.rb
23
+ lib/sportdb/matcher.rb
20
24
  lib/sportdb/models/badge.rb
21
25
  lib/sportdb/models/event.rb
22
26
  lib/sportdb/models/event_ground.rb
data/Rakefile CHANGED
@@ -13,25 +13,29 @@ Hoe.spec 'sportdb' do
13
13
  self.description = summary
14
14
 
15
15
  self.urls = ['https://github.com/geraldb/sport.db.ruby']
16
-
16
+
17
17
  self.author = 'Gerald Bauer'
18
18
  self.email = 'opensport@googlegroups.com'
19
-
19
+
20
20
  # switch extension to .markdown for gihub formatting
21
21
  # -- NB: auto-changed when included in manifest
22
- # self.readme_file = 'README.md'
23
- # self.history_file = 'History.md'
24
-
22
+ self.readme_file = 'README.md'
23
+ self.history_file = 'HISTORY.md'
24
+
25
25
  self.extra_deps = [
26
- ['worlddb', '>= 1.7'], # NB: worlddb already includes
26
+ ['props' ],
27
+ ['logutils'],
28
+ ['textutils'],
29
+ ['worlddb', '>= 2.0.2'], # NB: worlddb already includes
27
30
  # - logutils
28
31
  # - textutils
32
+ ['tagutils'], # tags n tagging tables
29
33
  ['fetcher', '>= 0.3'],
30
34
 
31
35
  ## 3rd party
32
- ['gli', '>= 2.5.6']
36
+ ['gli', '>= 2.5.6'],
33
37
 
34
- ## ['activerecord', '~> 3.2'], # NB: will include activesupport,etc.
38
+ ['activerecord'] # NB: will include activesupport,etc.
35
39
  ### ['sqlite3', '~> 1.3'] # NB: install on your own; remove dependency
36
40
  ]
37
41
 
@@ -3,8 +3,11 @@
3
3
 
4
4
 
5
5
  group: Gruppe
6
+
7
+ ## roll into one (matchday+round) ???
6
8
  matchday: Spieltag
7
9
  round: Runde
10
+
8
11
  stage: Gruppenphase|Qualifikation|Play-off|Finalrunde|K.-o.-Phase
9
12
 
10
13
 
@@ -3,6 +3,9 @@
3
3
 
4
4
 
5
5
  group: Group
6
+
7
+ ## roll into one (matchday+round) ???
8
+
6
9
  matchday: Matchday
7
10
  round: Round
8
11
 
@@ -3,9 +3,12 @@
3
3
 
4
4
 
5
5
  group: Grupo
6
+
7
+ ## roll into one (matchday+round) ???
6
8
  matchday: Jornada
7
9
  round: Fecha
8
10
 
11
+
9
12
  stage: Primera fase|Segunda fase|Fase de grupos|Fase final
10
13
 
11
14
 
@@ -0,0 +1,53 @@
1
+ ###########################
2
+ # known keywords for fixtures
3
+
4
+
5
+ group: Groupe
6
+
7
+ ## roll into one (matchday+round) ???
8
+
9
+ matchday: Journée
10
+ round: Journée
11
+
12
+ stage: Phase de groupes|Phase à élimination directe|Phase finale
13
+ # e.g.
14
+ # Group stage
15
+ # Play off stage|Play-off stage
16
+ # Knockout stage|Knockout stages
17
+ # First stage
18
+ # Second stage
19
+ # Qualifying rounds
20
+
21
+
22
+
23
+
24
+ ### Knockout rounds
25
+
26
+ round32: Seizièmes de finale
27
+ round16: Huitièmes de finale
28
+ quarterfinals: Quarts de finale
29
+ semifinals: Demi-finales
30
+ thirdplace: Match pour la troisième place
31
+ final: Finale
32
+
33
+ ### Pair matches/games if marked with leg1 n leg2
34
+
35
+ leg1: Match aller
36
+ leg2: Match retour
37
+
38
+
39
+ #######################
40
+ # months of year
41
+
42
+ january: janvier
43
+ february: février
44
+ march: mars
45
+ april: avril
46
+ may: mai
47
+ june: juin
48
+ july: juillet
49
+ august: août
50
+ september: septembre
51
+ october: octobre
52
+ november: novembre
53
+ december: décembre
@@ -0,0 +1,55 @@
1
+ ###########################
2
+ # known keywords for fixtures
3
+
4
+
5
+ group: Gruppo
6
+
7
+
8
+ ## roll into one (matchday+round) ???
9
+
10
+ matchday: Giornata
11
+ round: Giornata
12
+
13
+ stage: Fase a gironi|Fase a eliminazione diretta
14
+ # e.g.
15
+ # Group stage
16
+ # Play off stage|Play-off stage
17
+ # Knockout stage|Knockout stages
18
+ # First stage
19
+ # Second stage
20
+ # Qualifying rounds
21
+
22
+
23
+
24
+
25
+ ### Knockout rounds
26
+
27
+ round32: Sedicesimi di finale
28
+ round16: Ottavi di finale
29
+ quarterfinals: Quarti di finale
30
+ semifinals: Semifinali
31
+ thirdplace: Finale 3º posto
32
+ final: Finale
33
+
34
+ ### Pair matches/games if marked with leg1 n leg2
35
+
36
+ leg1: Andata
37
+ leg2: Ritorno
38
+
39
+
40
+ #######################
41
+ # months of year
42
+
43
+ january: gennaio
44
+ february: febbraio
45
+ march: marzo
46
+ april: aprile
47
+ may: maggio
48
+ june: giugno
49
+ july: luglio
50
+ august: agosto
51
+ september: settembre
52
+ october: ottobre
53
+ november: novembre
54
+ december: dicembre
55
+
@@ -2,43 +2,46 @@
2
2
  # known keywords for fixtures
3
3
 
4
4
 
5
- group: Grupo # Grupo
6
- matchday: # Jornada
7
- round: # Fecha
5
+ group: Grupo
8
6
 
9
- stage: Primeira Fase|Segunda Fase # Primera fase|Segunda fase|Fase de grupos|Fase final
7
+ ## roll into one (matchday+round) ???
8
+
9
+ matchday: Rodada
10
+ round: Rodada
11
+
12
+ stage: Fase de grupos|Fase final|Primeira Fase|Segunda Fase
10
13
 
11
14
 
12
15
  ### Knock out rounds
13
16
 
14
- round32: # Dieciseisavos de final|16vos de final
15
- round16: Oitavas-de-final # Octavos|Octavos de final|8vos de final
16
- quarterfinals: Quartas-de-final # Cuartos|Cuartos de final|4tos de final
17
- semifinals: Semifinais # Semifinales|Semifinal
18
- thirdplace: # Tercer lugar
19
- final: Final # Final
17
+ round32: 16-avos de final
18
+ round16: Oitavos de final|Oitavas-de-final
19
+ quarterfinals: Quartos de final|Quartas-de-final
20
+ semifinals: Semifinais
21
+ thirdplace: Terceiro lugar
22
+ final: Final
23
+
20
24
 
21
25
  ### Pair matches/games if marked with leg1 n leg2
22
26
 
23
- leg1: Ida # Ida
24
- leg2: Volta # Vuelta
27
+ leg1: 1º jogo # Ida -- exists ??
28
+ leg2: 2º jogo # Volta -- exists ??
25
29
 
26
30
 
27
31
 
28
32
  #######################
29
33
  # months of year
30
34
 
31
- january: janeiro # enero
32
- february: fevereiro # febrero
33
- march: março # marzo
34
- april: abril # abril
35
- may: maio # mayo
36
- june: junho # junio
37
- july: julho # julio
38
- august: # agosto
39
- september: # septiembre
40
- october: # octubre
41
- november: # noviembre
42
- december: # diciembre
43
-
35
+ january: janeiro
36
+ february: fevereiro
37
+ march: março
38
+ april: abril
39
+ may: maio
40
+ june: junho
41
+ july: julho
42
+ august: agosto
43
+ september: setembro
44
+ october: outubro
45
+ november: novembro
46
+ december: dezembro
44
47
 
@@ -0,0 +1,55 @@
1
+ ###########################
2
+ # known keywords for fixtures
3
+
4
+
5
+ group: Grupa
6
+
7
+ ## roll into one (matchday+round) ???
8
+
9
+ matchday: Etapa
10
+ round: Runda
11
+
12
+
13
+ stage: Faza grupelor|Faza eliminatorie
14
+ # e.g.
15
+ # Group stage
16
+ # Play off stage|Play-off stage
17
+ # Knockout stage|Knockout stages
18
+ # First stage
19
+ # Second stage
20
+ # Qualifying rounds
21
+
22
+
23
+
24
+
25
+ ### Knockout rounds
26
+
27
+ round32: 1/16 de finală
28
+ round16: Optimi de finală
29
+ quarterfinals: Sferturi de finală
30
+ semifinals: Semifinale
31
+ thirdplace: Meciul pentru locul 3
32
+ final: Finala
33
+
34
+ ### Pair matches/games if marked with leg1 n leg2
35
+
36
+ leg1: Tur ## Prima manșă - use too ??
37
+ leg2: Retur ## Manșa secundă - use too ??
38
+
39
+
40
+ #######################
41
+ # months of year
42
+
43
+ january: ianuarie
44
+ february: februarie
45
+ march: martie
46
+ april: aprilie
47
+ may: mai
48
+ june: iunie
49
+ july: iulie
50
+ august: august
51
+ september: septembrie
52
+ october: octombrie
53
+ november: noiembrie
54
+ december: decembrie
55
+
@@ -2,15 +2,40 @@
2
2
  # use period for season? why? why not?
3
3
  # - semantic hairsplitting? make it an alias? why? why not? who cares?
4
4
 
5
+
6
+ ###
7
+ # use 2012-13 or 2012_13 or 2012.13 or 2012+13 why? why not ???
8
+
9
+ 2020/21
10
+ 2019/20
11
+ 2018/19
12
+ 2017/18
13
+ 2016/17
14
+ 2015/16
5
15
  2014/15
6
16
  2013/14
7
- 2012/13 # use 2012-13 or 2012_13 or 2012.13 or 2012+13 ???
17
+ 2012/13
8
18
  2011/12
9
19
  2010/11
10
20
  2009/10
11
21
  2008/09
12
22
  2007/08
13
- 2015 # years only
23
+ 2006/07
24
+ 2005/06
25
+ 2004/05
26
+ 2003/04
27
+ 2002/03
28
+ 2001/02
29
+ 2000/01
30
+
31
+ # -- years only --
32
+
33
+ 2020
34
+ 2019
35
+ 2018
36
+ 2017
37
+ 2016
38
+ 2015
14
39
  2014
15
40
  2013
16
41
  2012
@@ -18,11 +43,24 @@
18
43
  2010
19
44
  2009
20
45
  2008
46
+ 2007
47
+ 2006
48
+ 2005
49
+ 2004
50
+ 2003
51
+ 2002
52
+ 2001
53
+ 2000
54
+
55
+
56
+ # e.g. Liga MX has two (complete) seasons in *one* year e.g. Clausura 2013 n Apertura 2013
57
+ ### for 2013.1 use 2013_I 2013-I 2013.I n 2013-II 2013.II or 2013.A n 2013.B - why? why not??
58
+
59
+ 2015.1
60
+ 2015.2
21
61
  2014.1
22
62
  2014.2
23
- 2013.1 # e.g. Liga MX has two (complete) seasons in *one* year e.g. Clausura 2013 n Apertura 2013
63
+ 2013.1
24
64
  2013.2
25
65
  2012.1
26
66
  2012.2
27
-
28
- ### for 2013.1 use 2013_I 2013-I 2013.I n 2013-II 2013.II or 2013.A n 2013.B
@@ -0,0 +1,5 @@
1
+ ######################
2
+ # builtin seed data
3
+
4
+ seasons
5
+
@@ -71,6 +71,7 @@ require 'sportdb/utils_record'
71
71
  require 'sportdb/utils_round'
72
72
  require 'sportdb/utils_scores'
73
73
  require 'sportdb/utils_teams'
74
+ require 'sportdb/matcher'
74
75
  require 'sportdb/reader'
75
76
  require 'sportdb/lang'
76
77
 
@@ -128,7 +129,7 @@ module SportDb
128
129
 
129
130
  def self.create
130
131
  CreateDb.new.up
131
- WorldDb::Model::Prop.create!( key: 'db.schema.sport.version', value: VERSION )
132
+ ConfDb::Model::Prop.create!( key: 'db.schema.sport.version', value: VERSION )
132
133
  end
133
134
 
134
135
  def self.read_setup( setup, include_path )
@@ -95,6 +95,8 @@ command [:create] do |c|
95
95
  connect_to_db( opts )
96
96
 
97
97
  LogDb.create
98
+ ConfDb.create
99
+ TagDb.create
98
100
  WorldDb.create
99
101
  SportDb.create
100
102
 
@@ -126,6 +128,8 @@ command [:setup,:s] do |c|
126
128
  setup = args[0] || 'all'
127
129
 
128
130
  LogDb.create
131
+ ConfDb.create
132
+ TagDb.create
129
133
  WorldDb.create
130
134
  SportDb.create
131
135
 
@@ -18,12 +18,17 @@ class Lang
18
18
  builtin_words = {
19
19
  'en' => 'fixtures/en',
20
20
  'de' => 'fixtures/de',
21
- 'es' => 'fixtures/es'
21
+ 'es' => 'fixtures/es',
22
+ 'fr' => 'fixtures/fr',
23
+ 'it' => 'fixtures/it',
24
+ 'pt' => 'fixtures/pt',
25
+ 'ro' => 'fixtures/ro'
22
26
  }
23
27
 
24
28
  load_words( builtin_words, SportDb.config_path )
25
29
  end
26
30
 
31
+
27
32
  def load_words( h, include_path )
28
33
  @lang = 'en' # make default lang english/en
29
34
  @words = {} # resets fixtures
@@ -0,0 +1,31 @@
1
+ # encoding: utf-8
2
+
3
+ module SportDb
4
+
5
+ module Matcher
6
+
7
+ include WorldDb::Matcher
8
+
9
+ def match_leagues_for_country( name, &blk )
10
+ match_xxx_for_country( name, 'leagues', &blk )
11
+ end
12
+
13
+ def match_teams_for_country( name, &blk )
14
+ match_xxx_for_country( name, 'teams', &blk )
15
+ end
16
+
17
+ def match_tracks_for_country( name, &blk )
18
+ match_xxx_for_country( name, 'tracks', &blk )
19
+ end
20
+
21
+ def match_skiers_for_country( name, &blk )
22
+ match_xxx_for_country( name, 'skiers', &blk )
23
+ end
24
+
25
+ def match_stadiums_for_country( name, &blk )
26
+ match_xxx_for_country( name, 'stadiums', &blk )
27
+ end
28
+
29
+ end # module Matcher
30
+
31
+ end # module SportDb
@@ -1,4 +1,5 @@
1
- module SportDb::Model
1
+ module SportDb
2
+ module Model
2
3
 
3
4
  class Badge < ActiveRecord::Base
4
5
 
@@ -9,5 +10,5 @@ class Badge < ActiveRecord::Base
9
10
  end # class Badge
10
11
 
11
12
 
12
- end # module SportDb::Model
13
-
13
+ end # module Model
14
+ end # module SportDb
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
- module SportDb::Model
3
+ module SportDb
4
+ module Model
4
5
 
5
6
  class Event < ActiveRecord::Base
6
7
 
@@ -58,4 +59,5 @@ class Event < ActiveRecord::Base
58
59
 
59
60
  end # class Event
60
61
 
61
- end # module SportDb::Model
62
+ end # module Model
63
+ end # module SportDb
@@ -1,4 +1,6 @@
1
- module SportDb::Model
1
+
2
+ module SportDb
3
+ module Model
2
4
 
3
5
 
4
6
  class EventGround < ActiveRecord::Base
@@ -9,4 +11,5 @@ class EventGround < ActiveRecord::Base
9
11
  end # class EventGround
10
12
 
11
13
 
12
- end # module SportDb::Model
14
+ end # module Model
15
+ end # module SportDb
@@ -1,4 +1,6 @@
1
- module SportDb::Model
1
+
2
+ module SportDb
3
+ module Model
2
4
 
3
5
 
4
6
  class EventTeam < ActiveRecord::Base
@@ -9,4 +11,6 @@ class EventTeam < ActiveRecord::Base
9
11
  end # class EventTeam
10
12
 
11
13
 
12
- end # module SportDb::Model
14
+ end # module Model
15
+ end # module SportDb
16
+
@@ -2,7 +2,8 @@
2
2
  ### forward references
3
3
  ## require first to resolve circular references
4
4
 
5
- module SportDb::Model
5
+ module SportDb
6
+ module Model
6
7
 
7
8
  ## todo: why? why not use include WorldDb::Models here???
8
9
 
@@ -10,7 +11,8 @@ module SportDb::Model
10
11
  Country = WorldDb::Model::Country
11
12
  Region = WorldDb::Model::Region
12
13
  City = WorldDb::Model::City
13
- Prop = WorldDb::Model::Prop
14
+
15
+ Prop = ConfDb::Model::Prop
14
16
 
15
17
  ## nb: for now only team and league use worlddb tables
16
18
  # e.g. with belongs_to assoc (country,region)
@@ -19,10 +21,12 @@ module SportDb::Model
19
21
  class League < ActiveRecord::Base ; end
20
22
  class Ground < ActiveRecord::Base ; end
21
23
 
24
+ end
22
25
  end
23
26
 
24
27
 
25
- module WorldDb::Model
28
+ module WorldDb
29
+ module Model
26
30
 
27
31
  # add alias? why? why not? # is there a better way?
28
32
  # - just include SportDb::Models - why? why not?
@@ -31,4 +35,6 @@ module WorldDb::Model
31
35
  League = SportDb::Model::League
32
36
  Ground = SportDb::Model::Ground
33
37
 
38
+ end
34
39
  end
40
+
@@ -1,4 +1,6 @@
1
- module SportDb::Model
1
+
2
+ module SportDb
3
+ module Model
2
4
 
3
5
 
4
6
  class Game < ActiveRecord::Base
@@ -361,4 +363,5 @@ class Game < ActiveRecord::Base
361
363
  end # class Game
362
364
 
363
365
 
364
- end # module SportDb::Model
366
+ end # module Model
367
+ end # module SportDb
@@ -1,4 +1,6 @@
1
- module SportDb::Model
1
+
2
+ module SportDb
3
+ module Model
2
4
 
3
5
 
4
6
  class Goal < ActiveRecord::Base
@@ -9,4 +11,5 @@ class Goal < ActiveRecord::Base
9
11
  end # class Goal
10
12
 
11
13
 
12
- end # module SportDb::Model
14
+ end # module Model
15
+ end # module SportDb
@@ -1,4 +1,6 @@
1
- module SportDb::Model
1
+
2
+ module SportDb
3
+ module Model
2
4
 
3
5
  class Ground < ActiveRecord::Base
4
6
 
@@ -93,4 +95,6 @@ class Ground < ActiveRecord::Base
93
95
 
94
96
  end # class Ground
95
97
 
96
- end # module SportDb::Model
98
+ end # module Model
99
+ end # module SportDb
100
+
@@ -1,4 +1,6 @@
1
- module SportDb::Model
1
+
2
+ module SportDb
3
+ module Model
2
4
 
3
5
 
4
6
  class Group < ActiveRecord::Base
@@ -19,5 +21,5 @@ class Group < ActiveRecord::Base
19
21
  end # class Group
20
22
 
21
23
 
22
- end # module SportDb::Model
23
-
24
+ end # module Model
25
+ end # module SportDb
@@ -1,4 +1,5 @@
1
- module SportDb::Model
1
+ module SportDb
2
+ module Model
2
3
 
3
4
 
4
5
  class GroupTeam < ActiveRecord::Base
@@ -9,5 +10,5 @@ class GroupTeam < ActiveRecord::Base
9
10
  end # class GroupTeam
10
11
 
11
12
 
12
- end # module SportDb::Model
13
-
13
+ end # module Model
14
+ end # module SportDb
@@ -1,4 +1,5 @@
1
- module SportDb::Model
1
+ module SportDb
2
+ module Model
2
3
 
3
4
 
4
5
  class League < ActiveRecord::Base
@@ -78,4 +79,5 @@ class League < ActiveRecord::Base
78
79
  end # class League
79
80
 
80
81
 
81
- end # module SportDb::Model
82
+ end # module Model
83
+ end # module SportDb
@@ -1,4 +1,6 @@
1
- module SportDb::Model
1
+
2
+ module SportDb
3
+ module Model
2
4
 
3
5
 
4
6
  class Person < ActiveRecord::Base
@@ -62,5 +64,6 @@ class Person < ActiveRecord::Base
62
64
  end # class Person
63
65
 
64
66
 
65
- end # module SportDb::Model
67
+ end # module Model
68
+ end # module SportDb
66
69
 
@@ -1,4 +1,6 @@
1
- module SportDb::Model
1
+
2
+ module SportDb
3
+ module Model
2
4
 
3
5
 
4
6
  class Race < ActiveRecord::Base
@@ -13,4 +15,6 @@ class Race < ActiveRecord::Base
13
15
  end # class Race
14
16
 
15
17
 
16
- end # module SportDb::Model
18
+ end # module Model
19
+ end # module SportDb
20
+
@@ -1,4 +1,6 @@
1
- module SportDb::Model
1
+
2
+ module SportDb
3
+ module Model
2
4
 
3
5
 
4
6
  class Record < ActiveRecord::Base
@@ -10,4 +12,6 @@ class Record < ActiveRecord::Base
10
12
  end # class Record
11
13
 
12
14
 
13
- end # module SportDb::Model
15
+ end # module Model
16
+ end # module SportDb
17
+
@@ -1,4 +1,6 @@
1
- module SportDb::Model
1
+
2
+ module SportDb
3
+ module Model
2
4
 
3
5
  ### use LineUp, Squad for name? - alias??
4
6
 
@@ -11,4 +13,6 @@ class Roster < ActiveRecord::Base
11
13
  end # class Roster
12
14
 
13
15
 
14
- end # module SportDb::Model
16
+ end # module Model
17
+ end # module SportDb
18
+
@@ -1,4 +1,6 @@
1
- module SportDb::Model
1
+
2
+ module SportDb
3
+ module Model
2
4
 
3
5
 
4
6
  class Round < ActiveRecord::Base
@@ -8,6 +10,8 @@ class Round < ActiveRecord::Base
8
10
 
9
11
  end # class Round
10
12
 
11
-
12
- end # module SportDb::Model
13
+
14
+ end # module Model
15
+ end # module SportDb
16
+
13
17
 
@@ -1,4 +1,6 @@
1
- module SportDb::Model
1
+
2
+ module SportDb
3
+ module Model
2
4
 
3
5
 
4
6
  class Run < ActiveRecord::Base
@@ -8,4 +10,6 @@ class Run < ActiveRecord::Base
8
10
  end # class Run
9
11
 
10
12
 
11
- end # module SportDb::Model
13
+ end # module Model
14
+ end # module SportDb
15
+
@@ -1,4 +1,6 @@
1
- module SportDb::Model
1
+
2
+ module SportDb
3
+ module Model
2
4
 
3
5
 
4
6
  class Season < ActiveRecord::Base
@@ -8,4 +10,5 @@ class Season < ActiveRecord::Base
8
10
  end # class Season
9
11
 
10
12
 
11
- end # module SportDb::Model
13
+ end # module Model
14
+ end # module SportDb
@@ -1,4 +1,6 @@
1
- module SportDb::Model
1
+
2
+ module SportDb
3
+ module Model
2
4
 
3
5
  ##################
4
6
  # FIX: add ?
@@ -154,4 +156,5 @@ class Team < ActiveRecord::Base
154
156
  end # class Team
155
157
 
156
158
 
157
- end # module SportDb::Model
159
+ end # module Model
160
+ end # module SportDb
@@ -1,4 +1,5 @@
1
- module SportDb::Model
1
+ module SportDb
2
+ module Model
2
3
 
3
4
  class Track < ActiveRecord::Base
4
5
 
@@ -55,4 +56,6 @@ class Track < ActiveRecord::Base
55
56
  end # class Track
56
57
 
57
58
 
58
- end # module SportDb::Model
59
+ end # module Model
60
+ end # module SportDb
61
+
@@ -1,7 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
3
 
4
- module WorldDb::Model
4
+ module WorldDb
5
+ module Model
5
6
 
6
7
  class City
7
8
  has_many :teams, class_name: 'SportDb::Model::Team', foreign_key: 'city_id'
@@ -15,5 +16,6 @@ module WorldDb::Model
15
16
  has_many :games, :through => :grounds
16
17
  end
17
18
 
18
- end # module WorldDb::Model
19
+ end # module Model
20
+ end # module WorldDb
19
21
 
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
- module WorldDb::Model
3
+ module WorldDb
4
+ module Model
4
5
 
5
6
  class Continent
6
7
  has_many :teams, :through => :countries
@@ -14,4 +15,6 @@ module WorldDb::Model
14
15
  has_many :grounds, :through => :countries
15
16
  end # class Continent
16
17
 
17
- end # module WorldDb::Model
18
+ end # module Model
19
+ end # module WorldDb
20
+
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
- module WorldDb::Model
3
+ module WorldDb
4
+ module Model
4
5
 
5
6
  class Country
6
7
  has_many :teams, class_name: 'SportDb::Model::Team', foreign_key: 'country_id'
@@ -13,5 +14,5 @@ module WorldDb::Model
13
14
  has_many :grounds, class_name: 'SportDb::Model::Ground', foreign_key: 'country_id'
14
15
  end # class Country
15
16
 
16
- end # module WorldDb::Model
17
-
17
+ end # module Model
18
+ end # module WorldDb
@@ -1,7 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
3
 
4
- module WorldDb::Model
4
+ module WorldDb
5
+ module Model
5
6
 
6
7
  class Region
7
8
  has_many :teams, class_name: 'SportDb::Model::Team', :through => :cities
@@ -13,5 +14,6 @@ module WorldDb::Model
13
14
  has_many :grounds, class_name: 'SportDb::Model::Ground', :through => :cities
14
15
  end # class Region
15
16
 
16
- end # module WorldDb::Model
17
+ end # module Model
18
+ end # module WorldDb
17
19
 
@@ -2,33 +2,6 @@
2
2
 
3
3
  module SportDb
4
4
 
5
- module Matcher
6
-
7
- include WorldDb::Matcher
8
-
9
- def match_leagues_for_country( name, &blk )
10
- match_xxx_for_country( name, 'leagues', &blk )
11
- end
12
-
13
- def match_teams_for_country( name, &blk )
14
- match_xxx_for_country( name, 'teams', &blk )
15
- end
16
-
17
- def match_tracks_for_country( name, &blk )
18
- match_xxx_for_country( name, 'tracks', &blk )
19
- end
20
-
21
- def match_skiers_for_country( name, &blk )
22
- match_xxx_for_country( name, 'skiers', &blk )
23
- end
24
-
25
- def match_stadiums_for_country( name, &blk )
26
- match_xxx_for_country( name, 'stadiums', &blk )
27
- end
28
-
29
- end # module Matcher
30
-
31
-
32
5
  class Reader
33
6
 
34
7
  include LogUtils::Logging
@@ -47,7 +20,15 @@ class Reader
47
20
  end
48
21
 
49
22
  def load_setup( name )
50
- path = "#{include_path}/#{name}.yml"
23
+ path = "#{include_path}/#{name}.txt"
24
+
25
+ ## depcrecated - for now check if "new" format exsits
26
+ ## - if not fall back to old format
27
+ unless File.exists?( path )
28
+ puts " deprecated manifest/setup format [SportDb.Reader]; use new plain text format"
29
+ ## try old yml format
30
+ path = "#{include_path}/#{name}.yml"
31
+ end
51
32
 
52
33
  logger.info "parsing data '#{name}' (#{path})..."
53
34
 
@@ -44,8 +44,8 @@ module SportDb
44
44
  [ 'it', 'it-italy' ],
45
45
  [ 'be', 'europe', 'be-belgium' ], # NB: europe/be-belgium
46
46
  [ 'ro', 'europe', 'ro-romania' ],
47
- [ 'cl', 'europe' ],
48
- [ 'el', 'europe' ],
47
+ [ 'cl', 'europe-champions-league' ],
48
+ [ 'el', 'europe-champions-league' ],
49
49
  [ 'br', 'br-brazil' ],
50
50
  [ 'mx', 'mx-mexico' ], # todo: add mx.* for clausura etc ??
51
51
  [ 'euro', 'euro-cup', ],
@@ -1,6 +1,6 @@
1
1
 
2
2
  module SportDb
3
- VERSION = '1.8.6'
3
+ VERSION = '1.8.7'
4
4
  end
5
5
 
6
6
 
@@ -19,6 +19,8 @@ require 'active_record'
19
19
  require 'worlddb'
20
20
  require 'logutils'
21
21
  require 'logutils/db' # NB: explict require required for LogDb (not automatic)
22
+ require 'props/db' ## fix: use textutils/db in the future too ??
23
+
22
24
 
23
25
  ## our own code
24
26
 
@@ -54,8 +56,12 @@ def setup_in_memory_db
54
56
  ## build schema
55
57
 
56
58
  LogDb.create
59
+ ConfDb.create
60
+ TagDb.create
57
61
  WorldDb.create
58
62
  SportDb.create
63
+
64
+ SportDb.read_builtin
59
65
  end
60
66
 
61
67
  ####
metadata CHANGED
@@ -1,82 +1,166 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.6
5
- prerelease:
4
+ version: 1.8.7
6
5
  platform: ruby
7
6
  authors:
8
7
  - Gerald Bauer
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-02-18 00:00:00.000000000 Z
11
+ date: 2014-04-03 00:00:00.000000000 Z
13
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: props
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: logutils
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: textutils
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
14
55
  - !ruby/object:Gem::Dependency
15
56
  name: worlddb
16
- requirement: &20428068 !ruby/object:Gem::Requirement
17
- none: false
57
+ requirement: !ruby/object:Gem::Requirement
18
58
  requirements:
19
59
  - - ! '>='
20
60
  - !ruby/object:Gem::Version
21
- version: '1.7'
61
+ version: 2.0.2
22
62
  type: :runtime
23
63
  prerelease: false
24
- version_requirements: *20428068
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: 2.0.2
69
+ - !ruby/object:Gem::Dependency
70
+ name: tagutils
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
25
83
  - !ruby/object:Gem::Dependency
26
84
  name: fetcher
27
- requirement: &20427156 !ruby/object:Gem::Requirement
28
- none: false
85
+ requirement: !ruby/object:Gem::Requirement
29
86
  requirements:
30
87
  - - ! '>='
31
88
  - !ruby/object:Gem::Version
32
89
  version: '0.3'
33
90
  type: :runtime
34
91
  prerelease: false
35
- version_requirements: *20427156
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0.3'
36
97
  - !ruby/object:Gem::Dependency
37
98
  name: gli
38
- requirement: &20426016 !ruby/object:Gem::Requirement
39
- none: false
99
+ requirement: !ruby/object:Gem::Requirement
40
100
  requirements:
41
101
  - - ! '>='
42
102
  - !ruby/object:Gem::Version
43
103
  version: 2.5.6
44
104
  type: :runtime
45
105
  prerelease: false
46
- version_requirements: *20426016
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: 2.5.6
111
+ - !ruby/object:Gem::Dependency
112
+ name: activerecord
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
47
125
  - !ruby/object:Gem::Dependency
48
126
  name: rdoc
49
- requirement: &20424108 !ruby/object:Gem::Requirement
50
- none: false
127
+ requirement: !ruby/object:Gem::Requirement
51
128
  requirements:
52
129
  - - ~>
53
130
  - !ruby/object:Gem::Version
54
131
  version: '4.0'
55
132
  type: :development
56
133
  prerelease: false
57
- version_requirements: *20424108
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ~>
137
+ - !ruby/object:Gem::Version
138
+ version: '4.0'
58
139
  - !ruby/object:Gem::Dependency
59
140
  name: hoe
60
- requirement: &20455920 !ruby/object:Gem::Requirement
61
- none: false
141
+ requirement: !ruby/object:Gem::Requirement
62
142
  requirements:
63
143
  - - ~>
64
144
  - !ruby/object:Gem::Version
65
- version: '3.7'
145
+ version: '3.10'
66
146
  type: :development
67
147
  prerelease: false
68
- version_requirements: *20455920
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ~>
151
+ - !ruby/object:Gem::Version
152
+ version: '3.10'
69
153
  description: sportdb - sport.db command line tool
70
154
  email: opensport@googlegroups.com
71
155
  executables:
72
156
  - sportdb
73
157
  extensions: []
74
158
  extra_rdoc_files:
75
- - History.md
159
+ - HISTORY.md
76
160
  - Manifest.txt
77
161
  - README.md
78
162
  files:
79
- - History.md
163
+ - HISTORY.md
80
164
  - Manifest.txt
81
165
  - README.md
82
166
  - Rakefile
@@ -84,9 +168,12 @@ files:
84
168
  - config/fixtures/de.yml
85
169
  - config/fixtures/en.yml
86
170
  - config/fixtures/es.yml
171
+ - config/fixtures/fr.yml
172
+ - config/fixtures/it.yml
87
173
  - config/fixtures/pt.yml
174
+ - config/fixtures/ro.yml
88
175
  - data/seasons.txt
89
- - data/setups/all.yml
176
+ - data/setups/all.txt
90
177
  - lib/sportdb.rb
91
178
  - lib/sportdb/cli/main.rb
92
179
  - lib/sportdb/cli/opts.rb
@@ -95,6 +182,7 @@ files:
95
182
  - lib/sportdb/data/models.rb
96
183
  - lib/sportdb/deleter.rb
97
184
  - lib/sportdb/lang.rb
185
+ - lib/sportdb/matcher.rb
98
186
  - lib/sportdb/models/badge.rb
99
187
  - lib/sportdb/models/event.rb
100
188
  - lib/sportdb/models/event_ground.rb
@@ -176,6 +264,7 @@ files:
176
264
  homepage: https://github.com/geraldb/sport.db.ruby
177
265
  licenses:
178
266
  - Public Domain
267
+ metadata: {}
179
268
  post_install_message: ! '******************************************************************************
180
269
 
181
270
 
@@ -193,22 +282,20 @@ rdoc_options:
193
282
  require_paths:
194
283
  - lib
195
284
  required_ruby_version: !ruby/object:Gem::Requirement
196
- none: false
197
285
  requirements:
198
286
  - - ! '>='
199
287
  - !ruby/object:Gem::Version
200
288
  version: 1.9.2
201
289
  required_rubygems_version: !ruby/object:Gem::Requirement
202
- none: false
203
290
  requirements:
204
291
  - - ! '>='
205
292
  - !ruby/object:Gem::Version
206
293
  version: '0'
207
294
  requirements: []
208
- rubyforge_project: sportdb
209
- rubygems_version: 1.8.16
295
+ rubyforge_project:
296
+ rubygems_version: 2.1.10
210
297
  signing_key:
211
- specification_version: 3
298
+ specification_version: 4
212
299
  summary: sportdb - sport.db command line tool
213
300
  test_files:
214
301
  - test/test_changes.rb
@@ -1,5 +0,0 @@
1
- ############################
2
- # builtin seed data
3
-
4
- data:
5
- - seasons