sportdb-sync 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 942eecead4fedb4294a6d73db750063aa253ec14
4
- data.tar.gz: 30ba069b6309c65d8e8ba979d315e5c31d2ecbec
3
+ metadata.gz: 348a66cb30ccc072d2f6e0a82f61af6234e193d2
4
+ data.tar.gz: cae64f1ab5a09c9b0cd930d49a62f4b3a565eceb
5
5
  SHA512:
6
- metadata.gz: 5bd714ea1d982ba37ba6b5490e58894b16bd0ca0b81fa44e2d56fca4e772c1ca395a6423b24b40c243a9d124ac4bba38c76cdf0e739c5148109d0f7b533221b4
7
- data.tar.gz: fc54ed580b7a5ea80fd0c053343c5c2bd6c34b5e2d5744a09e018a708f6fef56badb53014751dd0043740acf37b005b9eb422f12f1ba18caca0ff40cf088a91d
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.1'],
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
@@ -57,8 +57,8 @@ module SportDb
57
57
  attribs = {
58
58
  key: country.key,
59
59
  name: country.name,
60
- code: country.fifa, ## fix: uses fifa code now (should be iso-alpha3 if available)
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
  }
@@ -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 = 0
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', fifa: 'AUT' )
17
- eng = SportDb::Import::Country.new( key: 'eng', name: 'England', fifa: 'ENG' )
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.fifa
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.fifa
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.fifa
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.fifa
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.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 00:00:00.000000000 Z
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.1
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.1
26
+ version: 1.0.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sportdb-models
29
29
  requirement: !ruby/object:Gem::Requirement