footballdb-clubs 2019.12.16 → 2020.7.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +1 -0
- data/README.md +4 -4
- data/Rakefile +3 -3
- data/config/clubs.txt +4223 -754
- data/config/clubs.wiki.txt +18 -2
- data/lib/footballdb/clubs.rb +5 -55
- data/lib/footballdb/clubs/auto.rb +29 -0
- data/lib/footballdb/clubs/version.rb +3 -3
- data/test/helper.rb +1 -4
- metadata +9 -8
data/config/clubs.wiki.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
##########################################
|
2
2
|
# auto-generated all-in-one single datafile clubs.wiki.txt bundle
|
3
|
-
# on
|
3
|
+
# on 2020-07-07 21:39:24 +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
|
|
@@ -677,7 +685,13 @@ Defensa y Justicia
|
|
677
685
|
Estudiantes de La Plata
|
678
686
|
Club de Gimnasia y Esgrima La Plata
|
679
687
|
Godoy Cruz Antonio Tomba
|
680
|
-
|
688
|
+
|
689
|
+
# Club Atlético Huracán
|
690
|
+
## todo/fix: add city!!!! e.g. Club Atlético Huracán, Tres Arroyos or Club Atlético Huracán › Tres Arroyos
|
691
|
+
# todo/fix: ERROR !!! - too many (greater than one) matching clubs found for wiki(pedia) name >Club Atlético Huracán, Argentina (ar)
|
692
|
+
# - Huracán de Tres Arroyos
|
693
|
+
# - Huracán de Buenos Aires
|
694
|
+
|
681
695
|
Club Atlético Independiente
|
682
696
|
Club Atlético Lanús
|
683
697
|
Newell's Old Boys
|
@@ -736,3 +750,5 @@ Cuiabá Esporte Clube
|
|
736
750
|
América Futebol Clube (MG)
|
737
751
|
Sport Club do Recife
|
738
752
|
Grêmio Esportivo Brasil
|
753
|
+
|
754
|
+
|
data/lib/footballdb/clubs.rb
CHANGED
@@ -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
|
-
|
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
|
@@ -4,9 +4,9 @@
|
|
4
4
|
module FootballDb
|
5
5
|
module Clubs
|
6
6
|
|
7
|
-
MAJOR =
|
8
|
-
MINOR =
|
9
|
-
PATCH =
|
7
|
+
MAJOR = 2020 ## todo: namespace inside version or something - why? why not??
|
8
|
+
MINOR = 7
|
9
|
+
PATCH = 7
|
10
10
|
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
11
11
|
|
12
12
|
def self.version
|
data/test/helper.rb
CHANGED
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:
|
4
|
+
version: 2020.7.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: sportdb-
|
14
|
+
name: sportdb-formats
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.1.2
|
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:
|
26
|
+
version: 1.1.2
|
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:
|
33
|
+
version: 2020.5.18
|
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:
|
40
|
+
version: 2020.5.18
|
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/
|
91
|
+
homepage: https://github.com/sportdb/football.db
|
91
92
|
licenses:
|
92
93
|
- Public Domain
|
93
94
|
metadata: {}
|