sportdb-models 2.0.3 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a2dca58496a25d977a305dabb59fb4068f6a27d0
4
- data.tar.gz: 454d482974847f5fee5d025e03449f9058c0b48f
2
+ SHA256:
3
+ metadata.gz: 4f4d65007750a5f87beb091e967c48e761908b79f736d8a919b165c8d8657616
4
+ data.tar.gz: 8ab5b00ce91188d10bbb8e915f0e6f3469d84ddb62528c47b6436db1eddbacf1
5
5
  SHA512:
6
- metadata.gz: 2588e9757f5277b9f2088cd4b2222cb2712372a25b8ab01cb8346ae908c6c2c8ea8e3a7b9dd3e93d2a69117d30158dfc92a1d914dcb638826d34ecbf90619ecb
7
- data.tar.gz: 517e715c5c132c1ae5e9c5794ec91f556a5b2bc56efe3b9429df1f4f50cdecc0bd3fcf48a3bae7c41e3407eeb2198a744a2aec1004ac6968d34e61aa3b36470a
6
+ metadata.gz: d315bc6659797ce8c9afc9bb0feedb8ac14e25766eb65caedf36da082666bc0f284f0def80d62fa8b04e3789bb7f7caecd6859ca38bed607e82ffcf6a70309bf
7
+ data.tar.gz: c0216968600f67c288576b73efbcce26706a949ffa8e4822d74541a904ba797a55f82a4ad604d86acf5c86806f4d4204a0b1af2d0b8ae15e840c0df050ee4228
data/CHANGELOG.md CHANGED
@@ -1,21 +1,23 @@
1
- ### 0.4.0 / 2012-10-16
2
-
3
- * Add plain text fixture reader/loader
4
- * Add --generate/g option for generating fixtures from the DB using templates
5
-
6
- ### 0.3.1 / 2012-10-14
7
-
8
- * Move models into its own namespace, that is, SportDB::Models
9
- * Add ActiveRecord logging for --verbose option
10
-
11
- ### 0.3.0 / 2012-10-07
12
-
13
- * Add --delete option to delete all records
14
-
15
- ### 0.2.0 / 2012-10-06
16
-
17
- * Add --load option for builtin fixtures
18
-
19
- ### 0.1.0 / 2012-10-06
20
-
1
+ ### 2.1.0
2
+
3
+ ### 0.4.0 / 2012-10-16
4
+
5
+ * Add plain text fixture reader/loader
6
+ * Add --generate/g option for generating fixtures from the DB using templates
7
+
8
+ ### 0.3.1 / 2012-10-14
9
+
10
+ * Move models into its own namespace, that is, SportDB::Models
11
+ * Add ActiveRecord logging for --verbose option
12
+
13
+ ### 0.3.0 / 2012-10-07
14
+
15
+ * Add --delete option to delete all records
16
+
17
+ ### 0.2.0 / 2012-10-06
18
+
19
+ * Add --load option for builtin fixtures
20
+
21
+ ### 0.1.0 / 2012-10-06
22
+
21
23
  * Everything is new. First release
data/Manifest.txt CHANGED
@@ -31,7 +31,3 @@ lib/sportdb/models/schema.rb
31
31
  lib/sportdb/models/stats.rb
32
32
  lib/sportdb/models/utils.rb
33
33
  lib/sportdb/models/version.rb
34
- test/helper.rb
35
- test/test_changes.rb
36
- test/test_cursor.rb
37
- test/test_winner.rb
data/README.md CHANGED
@@ -1,31 +1,28 @@
1
- # sportdb-models gem - sport.db schema 'n' models for easy (re)use
2
-
3
- <!--
4
- [![Build Status](https://secure.travis-ci.org/geraldb/sport.db.ruby.png?branch=master)](http://travis-ci.org/geraldb/sport.db.ruby)
5
- -->
6
-
7
- * home :: [github.com/sportdb/sport.db](https://github.com/sportdb/sport.db)
8
- * bugs :: [github.com/sportdb/sport.db/issues](https://github.com/sportdb/sport.db/issues)
9
- * gem :: [rubygems.org/gems/sportdb-models](https://rubygems.org/gems/sportdb-models)
10
- * rdoc :: [rubydoc.info/gems/sportdb-models](http://rubydoc.info/gems/sportdb-models)
11
- * forum :: [groups.google.com/group/opensport](https://groups.google.com/group/opensport)
12
-
13
-
14
- ## Usage Models
15
-
16
- ![](sportdb-models.png)
17
-
18
-
19
- ## License
20
-
21
- ![](https://publicdomainworks.github.io/buttons/zero88x31.png)
22
-
23
- The `sportdb-models` scripts are dedicated to the public domain.
24
- Use it as you please with no restrictions whatsoever.
25
-
26
-
27
- ## Questions? Comments?
28
-
29
- Send them along to the
30
- [Open Sports & Friends Forum/Mailing List](http://groups.google.com/group/opensport).
31
- Thanks!
1
+ # sportdb-models gem - sport.db schema 'n' models for easy (re)use
2
+
3
+
4
+
5
+ * home :: [github.com/sportdb/sport.db](https://github.com/sportdb/sport.db)
6
+ * bugs :: [github.com/sportdb/sport.db/issues](https://github.com/sportdb/sport.db/issues)
7
+ * gem :: [rubygems.org/gems/sportdb-models](https://rubygems.org/gems/sportdb-models)
8
+ * rdoc :: [rubydoc.info/gems/sportdb-models](http://rubydoc.info/gems/sportdb-models)
9
+
10
+
11
+
12
+ ## Usage Models
13
+
14
+ ![](sportdb-models.png)
15
+
16
+
17
+ ## License
18
+
19
+ The `sportdb-models` scripts are dedicated to the public domain.
20
+ Use it as you please with no restrictions whatsoever.
21
+
22
+
23
+ ## Questions? Comments?
24
+
25
+ Yes, you can. More than welcome.
26
+ See [Help & Support »](https://github.com/openfootball/help)
27
+
28
+
data/Rakefile CHANGED
@@ -1,32 +1,32 @@
1
- require 'hoe'
2
- require './lib/sportdb/models/version.rb'
3
-
4
-
5
- Hoe.spec 'sportdb-models' do
6
-
7
- self.version = SportDb::Module::Models::VERSION
8
-
9
- self.summary = "sportdb-models - sport.db schema 'n' models for easy (re)use"
10
- self.description = summary
11
-
12
- self.urls = { home: 'https://github.com/sportdb/sport.db' }
13
-
14
- self.author = 'Gerald Bauer'
15
- self.email = 'opensport@googlegroups.com'
16
-
17
- # switch extension to .markdown for gihub formatting
18
- # -- NB: auto-changed when included in manifest
19
- self.readme_file = 'README.md'
20
- self.history_file = 'CHANGELOG.md'
21
-
22
- self.extra_deps = [
23
- ['worlddb-models', '>= 2.4.0'], # Note: pull in all (extra) dependencies va worlddb-models
24
- ['persondb-models', '>= 0.5.0'], # persons (people) table
25
- ]
26
-
27
- self.licenses = ['Public Domain']
28
-
29
- self.spec_extras = {
30
- required_ruby_version: '>= 2.2.2'
31
- }
32
- end
1
+ require 'hoe'
2
+ require './lib/sportdb/models/version.rb'
3
+
4
+
5
+ Hoe.spec 'sportdb-models' do
6
+
7
+ self.version = SportDb::Module::Models::VERSION
8
+
9
+ self.summary = "sportdb-models - sport.db schema 'n' models for easy (re)use"
10
+ self.description = summary
11
+
12
+ self.urls = { home: 'https://github.com/sportdb/sport.db' }
13
+
14
+ self.author = 'Gerald Bauer'
15
+ self.email = 'opensport@googlegroups.com'
16
+
17
+ # switch extension to .markdown for gihub formatting
18
+ # -- NB: auto-changed when included in manifest
19
+ self.readme_file = 'README.md'
20
+ self.history_file = 'CHANGELOG.md'
21
+
22
+ self.extra_deps = [
23
+ ['worlddb-models', '>= 2.4.0'], # Note: pull in all (extra) dependencies va worlddb-models
24
+ ['persondb-models', '>= 0.5.0'], # persons (people) table
25
+ ]
26
+
27
+ self.licenses = ['Public Domain']
28
+
29
+ self.spec_extras = {
30
+ required_ruby_version: '>= 2.2.2'
31
+ }
32
+ end
@@ -1,23 +1,23 @@
1
- # encoding: utf-8
2
-
3
- module SportDb
4
-
5
- # collection of regex patterns for reuse (SportDb specific)
6
-
7
- ### todo: add a patterns.md page to github ??
8
- ## - add regexper pics??
9
-
10
- TEAM_KEY_RE = %r{ \A
11
- [a-z_][a-z0-9_]*
12
- \z}x
13
- TEAM_KEY_MESSAGE = "expected one or more lowercase letters a-z (or 0-9 or _; must start with a-z or _)"
14
-
15
-
16
- # must start w/ letter A-Z (2nd,3rd,4th or 5th can be number)
17
- TEAM_CODE_RE = %r{ \A
18
- [A-Z_][A-Z0-9_]*
19
- \z}x
20
- TEAM_CODE_MESSAGE = "expected one or more uppercase letters A-Z (or 0-9 or _; must start with A-Z or _)"
21
-
22
-
23
- end # module SportDb
1
+ # encoding: utf-8
2
+
3
+ module SportDb
4
+
5
+ # collection of regex patterns for reuse (SportDb specific)
6
+
7
+ ### todo: add a patterns.md page to github ??
8
+ ## - add regexper pics??
9
+
10
+ TEAM_KEY_RE = %r{ \A
11
+ [a-z_][a-z0-9_]*
12
+ \z}x
13
+ TEAM_KEY_MESSAGE = "expected one or more lowercase letters a-z (or 0-9 or _; must start with a-z or _)"
14
+
15
+
16
+ # must start w/ letter A-Z (2nd,3rd,4th or 5th can be number)
17
+ TEAM_CODE_RE = %r{ \A
18
+ [A-Z_][A-Z0-9_]*
19
+ \z}x
20
+ TEAM_CODE_MESSAGE = "expected one or more uppercase letters A-Z (or 0-9 or _; must start with A-Z or _)"
21
+
22
+
23
+ end # module SportDb
@@ -1,38 +1,38 @@
1
- module SportDb
2
- module Model
3
-
4
- class Assoc < ActiveRecord::Base
5
-
6
-
7
- has_many :parent_assoc_assocs, class_name: 'AssocAssoc', foreign_key: 'assoc2_id'
8
- ## child_assocs - use child_assocs? - (direct) member/child assocs instead of member?
9
- has_many :member_assoc_assocs, class_name: 'AssocAssoc', foreign_key: 'assoc1_id'
10
-
11
-
12
- ## note: split member_assocs into two sets (into national=true and national=false)
13
- # e.g. fifa has six member confederations (non-national) and 216 national assocs
14
- ## note: includes all member (sub assocs + national assocs) - rename to member_assocs?
15
- has_many :all_assocs, class_name: 'Assoc', :source => :assoc2, :through => :member_assoc_assocs
16
- ## use zone/region as name instead of sub ( for confederatons,zones,etc.)
17
- has_many :sub_assocs, -> { where( national: false ) }, class_name: 'Assoc', :source => :assoc2, :through => :member_assoc_assocs
18
- has_many :national_assocs, -> { where( national: true ) }, class_name: 'Assoc', :source => :assoc2, :through => :member_assoc_assocs
19
-
20
- ## for now can have more than one (direct) parent assoc
21
- ## e.g. Africa Fed and Arab League Fed
22
- has_many :parent_assocs, class_name: 'Assoc', :source => :assoc1, :through => :parent_assoc_assocs
23
-
24
- # assoc only can have one direct team for now (uses belongs_to on other side)
25
- # has_one :team
26
- end # class Assoc
27
-
28
-
29
- class AssocAssoc < ActiveRecord::Base
30
- self.table_name = 'assocs_assocs'
31
-
32
- belongs_to :assoc1, class_name: 'Assoc', foreign_key: 'assoc1_id' # parent assoc
33
- belongs_to :assoc2, class_name: 'Assoc', foreign_key: 'assoc2_id' # child assoc is_member_of parent assoc
34
-
35
- end # class AssocAssoc
36
-
37
- end # module Model
38
- end # module SportDb
1
+ module SportDb
2
+ module Model
3
+
4
+ class Assoc < ActiveRecord::Base
5
+
6
+
7
+ has_many :parent_assoc_assocs, class_name: 'AssocAssoc', foreign_key: 'assoc2_id'
8
+ ## child_assocs - use child_assocs? - (direct) member/child assocs instead of member?
9
+ has_many :member_assoc_assocs, class_name: 'AssocAssoc', foreign_key: 'assoc1_id'
10
+
11
+
12
+ ## note: split member_assocs into two sets (into national=true and national=false)
13
+ # e.g. fifa has six member confederations (non-national) and 216 national assocs
14
+ ## note: includes all member (sub assocs + national assocs) - rename to member_assocs?
15
+ has_many :all_assocs, class_name: 'Assoc', :source => :assoc2, :through => :member_assoc_assocs
16
+ ## use zone/region as name instead of sub ( for confederatons,zones,etc.)
17
+ has_many :sub_assocs, -> { where( national: false ) }, class_name: 'Assoc', :source => :assoc2, :through => :member_assoc_assocs
18
+ has_many :national_assocs, -> { where( national: true ) }, class_name: 'Assoc', :source => :assoc2, :through => :member_assoc_assocs
19
+
20
+ ## for now can have more than one (direct) parent assoc
21
+ ## e.g. Africa Fed and Arab League Fed
22
+ has_many :parent_assocs, class_name: 'Assoc', :source => :assoc1, :through => :parent_assoc_assocs
23
+
24
+ # assoc only can have one direct team for now (uses belongs_to on other side)
25
+ # has_one :team
26
+ end # class Assoc
27
+
28
+
29
+ class AssocAssoc < ActiveRecord::Base
30
+ self.table_name = 'assocs_assocs'
31
+
32
+ belongs_to :assoc1, class_name: 'Assoc', foreign_key: 'assoc1_id' # parent assoc
33
+ belongs_to :assoc2, class_name: 'Assoc', foreign_key: 'assoc2_id' # child assoc is_member_of parent assoc
34
+
35
+ end # class AssocAssoc
36
+
37
+ end # module Model
38
+ end # module SportDb
@@ -1,14 +1,14 @@
1
- module SportDb
2
- module Model
3
-
4
- class Badge < ActiveRecord::Base
5
-
6
- belongs_to :team
7
- belongs_to :league
8
- belongs_to :season
9
-
10
- end # class Badge
11
-
12
-
13
- end # module Model
14
- end # module SportDb
1
+ module SportDb
2
+ module Model
3
+
4
+ class Badge < ActiveRecord::Base
5
+
6
+ belongs_to :team
7
+ belongs_to :league
8
+ belongs_to :season
9
+
10
+ end # class Badge
11
+
12
+
13
+ end # module Model
14
+ end # module SportDb
@@ -1,55 +1,55 @@
1
-
2
- ### forward references
3
- ## require first to resolve circular references
4
-
5
- module SportDb
6
- module Model
7
-
8
- Prop = ConfDb::Model::Prop
9
-
10
- ## todo: why? why not use include WorldDb::Models here???
11
- Continent = WorldDb::Model::Continent
12
- Country = WorldDb::Model::Country
13
- State = WorldDb::Model::State
14
- City = WorldDb::Model::City
15
-
16
- Person = PersonDb::Model::Person
17
-
18
- ## note: for now only team and league use worlddb tables
19
- # e.g. with belongs_to assoc (country,region)
20
-
21
- class Assoc < ActiveRecord::Base ; end
22
- class Team < ActiveRecord::Base ; end
23
- class League < ActiveRecord::Base ; end
24
- class Ground < ActiveRecord::Base ; end
25
- class Goal < ActiveRecord::Base ; end
26
-
27
- end
28
-
29
- ## add backwards compatible n convenience namespace
30
- Models = Model
31
- end # module SportDb
32
-
33
-
34
- module WorldDb
35
- module Model
36
-
37
- # add alias? why? why not? # is there a better way?
38
- # - just include SportDb::Models - why? why not?
39
- # - just include once in loader??
40
- Assoc = SportDb::Model::Assoc
41
- Team = SportDb::Model::Team
42
- League = SportDb::Model::League
43
- Ground = SportDb::Model::Ground
44
-
45
- end
46
- end
47
-
48
-
49
- module PersonDb
50
- module Model
51
- Goal = SportDb::Model::Goal
52
- end
53
- end
54
-
55
-
1
+
2
+ ### forward references
3
+ ## require first to resolve circular references
4
+
5
+ module SportDb
6
+ module Model
7
+
8
+ Prop = ConfDb::Model::Prop
9
+
10
+ ## todo: why? why not use include WorldDb::Models here???
11
+ Continent = WorldDb::Model::Continent
12
+ Country = WorldDb::Model::Country
13
+ State = WorldDb::Model::State
14
+ City = WorldDb::Model::City
15
+
16
+ Person = PersonDb::Model::Person
17
+
18
+ ## note: for now only team and league use worlddb tables
19
+ # e.g. with belongs_to assoc (country,region)
20
+
21
+ class Assoc < ActiveRecord::Base ; end
22
+ class Team < ActiveRecord::Base ; end
23
+ class League < ActiveRecord::Base ; end
24
+ class Ground < ActiveRecord::Base ; end
25
+ class Goal < ActiveRecord::Base ; end
26
+
27
+ end
28
+
29
+ ## add backwards compatible n convenience namespace
30
+ Models = Model
31
+ end # module SportDb
32
+
33
+
34
+ module WorldDb
35
+ module Model
36
+
37
+ # add alias? why? why not? # is there a better way?
38
+ # - just include SportDb::Models - why? why not?
39
+ # - just include once in loader??
40
+ Assoc = SportDb::Model::Assoc
41
+ Team = SportDb::Model::Team
42
+ League = SportDb::Model::League
43
+ Ground = SportDb::Model::Ground
44
+
45
+ end
46
+ end
47
+
48
+
49
+ module PersonDb
50
+ module Model
51
+ Goal = SportDb::Model::Goal
52
+ end
53
+ end
54
+
55
+
@@ -1,15 +1,15 @@
1
-
2
- module SportDb
3
- module Model
4
-
5
-
6
- class Goal < ActiveRecord::Base
7
-
8
- belongs_to :match
9
- belongs_to :person, class_name: 'PersonDb::Model::Person', foreign_key: 'person_id'
10
-
11
- end # class Goal
12
-
13
-
14
- end # module Model
15
- end # module SportDb
1
+
2
+ module SportDb
3
+ module Model
4
+
5
+
6
+ class Goal < ActiveRecord::Base
7
+
8
+ belongs_to :match
9
+ belongs_to :person, class_name: 'PersonDb::Model::Person', foreign_key: 'person_id'
10
+
11
+ end # class Goal
12
+
13
+
14
+ end # module Model
15
+ end # module SportDb
@@ -1,20 +1,20 @@
1
- module SportDb
2
- module Model
3
-
4
-
5
- class League < ActiveRecord::Base
6
-
7
- ## leagues also used for conferences, world series, cups, etc.
8
- #
9
- ## league (or cup/conference/series/etc.) + season (or year) = event
10
-
11
- has_many :events
12
- has_many :seasons, :through => :events
13
-
14
- belongs_to :country, :class_name => 'WorldDb::Model::Country', :foreign_key => 'country_id'
15
-
16
- end # class League
17
-
18
-
19
- end # module Model
20
- end # module SportDb
1
+ module SportDb
2
+ module Model
3
+
4
+
5
+ class League < ActiveRecord::Base
6
+
7
+ ## leagues also used for conferences, world series, cups, etc.
8
+ #
9
+ ## league (or cup/conference/series/etc.) + season (or year) = event
10
+
11
+ has_many :events
12
+ has_many :seasons, :through => :events
13
+
14
+ belongs_to :country, :class_name => 'WorldDb::Model::Country', :foreign_key => 'country_id'
15
+
16
+ end # class League
17
+
18
+
19
+ end # module Model
20
+ end # module SportDb
@@ -1,17 +1,20 @@
1
-
2
- module SportDb
3
- module Model
4
-
5
- ### use Squad for name? - alias??
6
-
7
- class Lineup < ActiveRecord::Base
8
-
9
- belongs_to :event
10
- belongs_to :team
11
- belongs_to :person, class_name: 'PersonDb::Model::Person', foreign_key: 'person_id'
12
-
13
- end # class Lineup
14
-
15
- end # module Model
16
- end # module SportDb
17
-
1
+
2
+ module SportDb
3
+ module Model
4
+
5
+ ### todo/fix - yes, use Squad for name
6
+ ### use lineup table for match (specific) players lineup/formation
7
+ ## NOT league (all season) squad !!!!!
8
+
9
+
10
+ class Lineup < ActiveRecord::Base
11
+
12
+ belongs_to :event
13
+ belongs_to :team
14
+ belongs_to :person, class_name: 'PersonDb::Model::Person', foreign_key: 'person_id'
15
+
16
+ end # class Lineup
17
+
18
+ end # module Model
19
+ end # module SportDb
20
+
@@ -1,21 +1,21 @@
1
-
2
- #### note ---
3
- ## uses PersonDb namespace!!!!!
4
- #
5
- # move to models/person/person.rb - why? why not??
6
-
7
-
8
- module PersonDb
9
- module Model
10
-
11
- ### extends "basic" person model in PersonDb
12
- class Person
13
-
14
- has_many :goals
15
-
16
- end # class Person
17
-
18
-
19
- end # module Model
20
- end # module PersonDb
21
-
1
+
2
+ #### note ---
3
+ ## uses PersonDb namespace!!!!!
4
+ #
5
+ # move to models/person/person.rb - why? why not??
6
+
7
+
8
+ module PersonDb
9
+ module Model
10
+
11
+ ### extends "basic" person model in PersonDb
12
+ class Person
13
+
14
+ has_many :goals
15
+
16
+ end # class Person
17
+
18
+
19
+ end # module Model
20
+ end # module PersonDb
21
+
@@ -1,15 +1,15 @@
1
-
2
- module SportDb
3
- module Model
4
-
5
-
6
- class Season < ActiveRecord::Base
7
-
8
- has_many :events
9
- has_many :leagues, :through => :events
10
-
11
- end # class Season
12
-
13
-
14
- end # module Model
15
- end # module SportDb
1
+
2
+ module SportDb
3
+ module Model
4
+
5
+
6
+ class Season < ActiveRecord::Base
7
+
8
+ has_many :events
9
+ has_many :leagues, :through => :events
10
+
11
+ end # class Season
12
+
13
+
14
+ end # module Model
15
+ end # module SportDb