footballdb-clubs 2020.4.14 → 2020.5.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  ##########################################
2
2
  # auto-generated all-in-one single datafile clubs.wiki.txt bundle
3
- # on 2020-04-14 16:45:09 +0200 from 5 datafile(s)
3
+ # on 2020-05-10 19:34:14 +0200 from 5 datafile(s)
4
4
  # please, do NOT edit here; use the source
5
5
  # see https://github.com/openfootball/clubs - updates welcome!
6
6
 
@@ -53,6 +53,8 @@ Urawa Red Diamonds
53
53
  Vegalta Sendai
54
54
  Vissel Kobe
55
55
  Yokohama F. Marinos
56
+
57
+
56
58
  ===================================
57
59
  = Albania
58
60
 
@@ -585,6 +587,8 @@ Yeni Malatyaspor
585
587
  Cardiff City F.C.
586
588
  Swansea City A.F.C.
587
589
  Newport County A.F.C.
590
+
591
+
588
592
  =================================
589
593
  = Israel
590
594
 
@@ -602,6 +606,8 @@ Maccabi Haifa F.C.
602
606
  Maccabi Netanya F.C.
603
607
  Maccabi Petah Tikva F.C.
604
608
  Maccabi Tel Aviv F.C.
609
+
610
+
605
611
  ============================
606
612
  = Canada
607
613
 
@@ -662,6 +668,8 @@ Sporting Kansas City
662
668
  Chivas USA
663
669
  Miami Fusion
664
670
  Tampa Bay Mutiny
671
+
672
+
665
673
  ===========================
666
674
  = Argentina
667
675
 
@@ -736,3 +744,5 @@ Cuiabá Esporte Clube
736
744
  América Futebol Clube (MG)
737
745
  Sport Club do Recife
738
746
  Grêmio Esportivo Brasil
747
+
748
+
@@ -1,10 +1,6 @@
1
- # encoding: utf-8
2
-
3
-
4
1
  ###
5
- # sport.db gems / libraries
2
+ # sport.db gems / libraries via fifa
6
3
  require 'fifa'
7
- require 'sportdb/clubs'
8
4
 
9
5
 
10
6
  ###
@@ -13,66 +9,20 @@ require 'footballdb/clubs/version' # let version always go first
13
9
 
14
10
 
15
11
  module FootballDb
16
- module Import
17
-
18
- ## add "fake" configuration for stand-alone usage
19
- class Configuration
20
- def initialize
21
- recs = Fifa.countries
22
- @countries = SportDb::Import::CountryIndex.new( recs )
23
- end
24
-
25
- def countries() @countries; end
26
- end
27
-
28
-
29
-
30
-
31
- class Club ## todo/check: use a module instead of class - why? why not?
32
- def self.clubs() club_index.clubs; end ## return all clubs (struct-like) records
33
- def self.all() clubs; end ## use ActiveRecord-like alias for clubs
34
-
35
- def self.mappings() club_index.mappings; end
12
+ module Import
36
13
 
37
- def self.[]( name ) club_index[ name ]; end ## lookup by canoncial name only
38
- def self.match( name ) club_index.match( name ); end
39
- def self.match_by( name:, country: ) club_index.match_by( name: name, country: country ); end
40
-
41
-
42
- def self.club_index
43
- @club_index ||= build_club_index
44
- @club_index
45
- end
46
-
47
- private
48
14
  def self.build_club_index
49
- if defined?( SportDb::Import::Configuration )
50
- # assume running "inside" sportdb - (re)use sportdb configuration
51
- else
52
- # assume running "stand-alone" - setup configuration for countries / country mapping
53
- config = Configuration.new
54
- SportDb::Import::ClubReader.config = config
55
- SportDb::Import::ClubIndex.config = config
56
- SportDb::Import::WikiReader.config = config
57
- end
58
-
59
- recs = SportDb::Import::ClubReader.read( "#{FootballDb::Clubs.data_dir}/clubs.txt" )
15
+ recs = SportDb::Import::Club.read( "#{FootballDb::Clubs.data_dir}/clubs.txt" )
60
16
  club_index = SportDb::Import::ClubIndex.new
61
17
  club_index.add( recs )
62
18
  recs = SportDb::Import::WikiReader.read( "#{FootballDb::Clubs.data_dir}/clubs.wiki.txt" )
63
19
  club_index.add_wiki( recs )
64
20
  club_index
65
21
  end
66
- end # class Club
67
22
 
68
- end # module Import
23
+ end # module Import
69
24
  end # module FootballDb
70
25
 
71
26
 
72
-
73
- ### add top-level (global) convenience alias
74
- Club = FootballDb::Import::Club
75
-
76
-
77
-
78
27
  puts FootballDb::Clubs.banner # say hello
28
+
@@ -0,0 +1,29 @@
1
+
2
+ ## our own code (without "top-level" shortcuts e.g. "modular version")
3
+ require 'footballdb/clubs'
4
+
5
+
6
+ ###
7
+ # add convenience top-level shortcuts / aliases
8
+
9
+ module SportDb
10
+ module Import
11
+
12
+ class Catalog
13
+ def build_country_index() CountryIndex.new( Fifa.countries ); end
14
+ def build_club_index() FootballDb::Import.build_club_index; end
15
+
16
+ def countries() @countries ||= build_country_index; end
17
+ def clubs() @clubs ||= build_club_index; end
18
+ end
19
+
20
+ configure do |config|
21
+ config.catalog = Catalog.new
22
+ end
23
+
24
+ end # module Import
25
+ end # module SportDb
26
+
27
+
28
+ ### add top-level (global) convenience alias
29
+ Club = SportDb::Import.catalog.clubs
@@ -5,8 +5,8 @@ module FootballDb
5
5
  module Clubs
6
6
 
7
7
  MAJOR = 2020 ## todo: namespace inside version or something - why? why not??
8
- MINOR = 4
9
- PATCH = 14
8
+ MINOR = 5
9
+ PATCH = 10
10
10
  VERSION = [MAJOR,MINOR,PATCH].join('.')
11
11
 
12
12
  def self.version
@@ -1,10 +1,7 @@
1
- ## $:.unshift(File.dirname(__FILE__))
2
-
3
1
  ## minitest setup
4
2
 
5
3
  require 'minitest/autorun'
6
4
 
7
5
 
8
6
  ## our own code
9
-
10
- require 'footballdb/clubs'
7
+ require 'footballdb/clubs/auto'
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: footballdb-clubs
3
3
  version: !ruby/object:Gem::Version
4
- version: 2020.4.14
4
+ version: 2020.5.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-14 00:00:00.000000000 Z
11
+ date: 2020-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: sportdb-clubs
14
+ name: sportdb-formats
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.4.5
19
+ version: 1.0.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.4.5
26
+ version: 1.0.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: fifa
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 2019.11.27
33
+ version: 2020.5.10
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 2019.11.27
40
+ version: 2020.5.10
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rdoc
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -84,10 +84,11 @@ files:
84
84
  - config/clubs.txt
85
85
  - config/clubs.wiki.txt
86
86
  - lib/footballdb/clubs.rb
87
+ - lib/footballdb/clubs/auto.rb
87
88
  - lib/footballdb/clubs/version.rb
88
89
  - test/helper.rb
89
90
  - test/test_club.rb
90
- homepage: https://github.com/sportdb/sport.db
91
+ homepage: https://github.com/sportdb/football.db
91
92
  licenses:
92
93
  - Public Domain
93
94
  metadata: {}