sportdb-sync 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/lib/sportdb/sync.rb +12 -1
- data/lib/sportdb/sync/country.rb +2 -2
- data/lib/sportdb/sync/version.rb +3 -1
- data/test/test_country.rb +6 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 348a66cb30ccc072d2f6e0a82f61af6234e193d2
|
4
|
+
data.tar.gz: cae64f1ab5a09c9b0cd930d49a62f4b3a565eceb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a864409290725d1ed3d6cf529ae7bf30c6091f28e76ce01fe427b1ff0cf31349d049a07e7de39c599f8e8db1b0136c2e2d7e1750aac1eab90b43e78a4153d4b4
|
7
|
+
data.tar.gz: b28d7dd3b5202cb3d58e1afb7e24c21f45e6b74c19391717257e16332c93470f17a78810314252bd4ce24758bc50af1d6d533ccbc41d712bb6d1282943533797
|
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@ require './lib/sportdb/sync/version.rb'
|
|
3
3
|
|
4
4
|
Hoe.spec 'sportdb-sync' do
|
5
5
|
|
6
|
-
self.version = SportDb::Sync::VERSION
|
6
|
+
self.version = SportDb::Module::Sync::VERSION
|
7
7
|
|
8
8
|
self.summary = "sportdb-sync - sport.db sync helpers for leagues, seasons, clubs, match schedules and results, and more"
|
9
9
|
self.description = summary
|
@@ -20,7 +20,7 @@ Hoe.spec 'sportdb-sync' do
|
|
20
20
|
self.licenses = ['Public Domain']
|
21
21
|
|
22
22
|
self.extra_deps = [
|
23
|
-
['sportdb-config', '>= 1.0.
|
23
|
+
['sportdb-config', '>= 1.0.4'],
|
24
24
|
['sportdb-models', '>= 1.19.0'],
|
25
25
|
]
|
26
26
|
|
data/lib/sportdb/sync.rb
CHANGED
@@ -4,6 +4,17 @@ require 'sportdb/config'
|
|
4
4
|
require 'sportdb/models' ## add sql database support
|
5
5
|
|
6
6
|
|
7
|
+
##
|
8
|
+
# fix!!!
|
9
|
+
# patches for worlddb/models - move upstream!!!!
|
10
|
+
module WorldDb
|
11
|
+
COUNTRY_KEY_PATTERN = '\A[a-z]{2,}\z' # allow two AND three letter keys e.g. at, mx, eng, sco, etc.
|
12
|
+
COUNTRY_KEY_PATTERN_MESSAGE = "expected two or more lowercase letters a-z /#{COUNTRY_KEY_PATTERN}/"
|
13
|
+
|
14
|
+
COUNTRY_CODE_PATTERN = '\A[A-Z_]{2,}\z'
|
15
|
+
COUNTRY_CODE_PATTERN_MESSAGE = "expected two or more uppercase letters A-Z (and _) /#{COUNTRY_CODE_PATTERN}/"
|
16
|
+
end # module WorldDb
|
17
|
+
|
7
18
|
|
8
19
|
###
|
9
20
|
# our own code
|
@@ -16,4 +27,4 @@ require 'sportdb/sync/club'
|
|
16
27
|
require 'sportdb/sync/sync'
|
17
28
|
|
18
29
|
|
19
|
-
puts SportDb::Sync.banner # say hello
|
30
|
+
puts SportDb::Module::Sync.banner # say hello
|
data/lib/sportdb/sync/country.rb
CHANGED
@@ -57,8 +57,8 @@ module SportDb
|
|
57
57
|
attribs = {
|
58
58
|
key: country.key,
|
59
59
|
name: country.name,
|
60
|
-
code: country.
|
61
|
-
fifa: country.fifa,
|
60
|
+
code: country.code, ## fix: uses fifa code now (should be iso-alpha3 if available)
|
61
|
+
## fifa: country.fifa,
|
62
62
|
area: 1,
|
63
63
|
pop: 1
|
64
64
|
}
|
data/lib/sportdb/sync/version.rb
CHANGED
@@ -2,11 +2,12 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
module SportDb
|
5
|
+
module Module
|
5
6
|
module Sync
|
6
7
|
|
7
8
|
MAJOR = 1 ## todo: namespace inside version or something - why? why not??
|
8
9
|
MINOR = 0
|
9
|
-
PATCH =
|
10
|
+
PATCH = 1
|
10
11
|
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
11
12
|
|
12
13
|
def self.version
|
@@ -22,4 +23,5 @@ module Sync
|
|
22
23
|
end
|
23
24
|
|
24
25
|
end # module Sync
|
26
|
+
end # module Module
|
25
27
|
end # module SportDb
|
data/test/test_country.rb
CHANGED
@@ -13,8 +13,8 @@ class TestCountry < MiniTest::Test
|
|
13
13
|
Country = SportDb::Sync::Country
|
14
14
|
|
15
15
|
def test_find # note: find uses "data" structs
|
16
|
-
at = SportDb::Import::Country.new( key: 'at', name: 'Austria',
|
17
|
-
eng = SportDb::Import::Country.new( key: 'eng', name: 'England',
|
16
|
+
at = SportDb::Import::Country.new( key: 'at', name: 'Austria', code: 'AUT' )
|
17
|
+
eng = SportDb::Import::Country.new( key: 'eng', name: 'England', code: 'ENG' )
|
18
18
|
|
19
19
|
rec = Country.find_or_create( at )
|
20
20
|
rec2 = Country.find_or_create( at )
|
@@ -28,23 +28,23 @@ class TestCountry < MiniTest::Test
|
|
28
28
|
rec = Country.search_or_create!( 'at' ) ## try (iso-alpha2) key
|
29
29
|
assert_equal 'Austria', rec.name
|
30
30
|
assert_equal 'at', rec.key
|
31
|
-
assert_equal 'AUT', rec.
|
31
|
+
assert_equal 'AUT', rec.code
|
32
32
|
|
33
33
|
rec = Country.search_or_create!( 'aut' ) ## try fifa code
|
34
34
|
assert_equal 'Austria', rec.name
|
35
35
|
assert_equal 'at', rec.key
|
36
|
-
assert_equal 'AUT', rec.
|
36
|
+
assert_equal 'AUT', rec.code
|
37
37
|
|
38
38
|
|
39
39
|
rec = Country.search_or_create!( 'eng' )
|
40
40
|
assert_equal 'England', rec.name
|
41
41
|
assert_equal 'eng', rec.key
|
42
|
-
assert_equal 'ENG', rec.
|
42
|
+
assert_equal 'ENG', rec.code
|
43
43
|
|
44
44
|
rec = Country.search_or_create!( 'eng' )
|
45
45
|
assert_equal 'England', rec.name
|
46
46
|
assert_equal 'eng', rec.key
|
47
|
-
assert_equal 'ENG', rec.
|
47
|
+
assert_equal 'ENG', rec.code
|
48
48
|
end
|
49
49
|
|
50
50
|
end # class TestCountry
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sportdb-sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
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-05-
|
11
|
+
date: 2020-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sportdb-config
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.0.
|
19
|
+
version: 1.0.4
|
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: 1.0.
|
26
|
+
version: 1.0.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sportdb-models
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|