footballdb 0.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 +7 -0
- data/HISTORY.md +3 -0
- data/Manifest.txt +9 -0
- data/README.md +27 -0
- data/Rakefile +29 -0
- data/lib/footballdb.rb +52 -0
- data/lib/footballdb/models/person.rb +22 -0
- data/lib/footballdb/models/stats/player_stat.rb +46 -0
- data/lib/footballdb/schema.rb +65 -0
- data/lib/footballdb/version.rb +5 -0
- metadata +89 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 97a47d054b449e9ff7aaad33b252a5cd1e69d9b5
|
4
|
+
data.tar.gz: c657786c1315ac38d6471143e52bc67a0f56bffd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 28f975d5fc403dc3369e55492e9eb00a1f044c1fa087291d0d3af544c7cc7b662e37d79d5835f9ac4c84ba1343a1a9db79b409e6a621e5ab5e1cf697c9eb642b
|
7
|
+
data.tar.gz: 23e076c80c95510231f77c33a25fb96be6f5d2181c33ee549c44c18818a7f0d482ee3028f6a90a1d3592e35e820f989bc476566a947f3c36a166586fa47d9c78
|
data/HISTORY.md
ADDED
data/Manifest.txt
ADDED
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# footballdb - football.db.stats - add-on to sport.db for football stats
|
2
|
+
|
3
|
+
|
4
|
+
* home :: [github.com/sportdb/football.db.stats](https://github.com/sportdb/football.db.stats)
|
5
|
+
* bugs :: [github.com/sportdb/football.db.stats/issues](https://github.com/sportdb/football.db.stats/issues)
|
6
|
+
* gem :: [rubygems.org/gems/footballdb](https://rubygems.org/gems/footballdb)
|
7
|
+
* rdoc :: [rubydoc.info/gems/footballdb](http://rubydoc.info/gems/footballdb)
|
8
|
+
* forum :: [groups.google.com/group/opensport](https://groups.google.com/group/opensport)
|
9
|
+
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
TBD
|
14
|
+
|
15
|
+
|
16
|
+
## License
|
17
|
+
|
18
|
+
The `football.db.stats` scripts are dedicated to the public domain.
|
19
|
+
Use it as you please with no restrictions whatsoever.
|
20
|
+
|
21
|
+
|
22
|
+
## Questions? Comments?
|
23
|
+
|
24
|
+
Send them along to the
|
25
|
+
[Open Sports & Friends Forum/Mailing List](http://groups.google.com/group/opensport).
|
26
|
+
Thanks!
|
27
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'hoe'
|
2
|
+
require './lib/footballdb/version.rb'
|
3
|
+
|
4
|
+
Hoe.spec 'footballdb' do
|
5
|
+
|
6
|
+
self.version = FootballDb::VERSION
|
7
|
+
|
8
|
+
self.summary = 'footballdb - football.db.stats - add-on to sport.db for football stats etc.'
|
9
|
+
self.description = summary
|
10
|
+
|
11
|
+
self.urls = ['https://github.com/sportdb/football.db.stats']
|
12
|
+
|
13
|
+
## note: does not work - no authors defined? only author
|
14
|
+
## self.authors = [ 'Carl Svensson', 'Gerald Bauer' ]
|
15
|
+
## self.email = 'opensport@googlegroups.com'
|
16
|
+
|
17
|
+
developer 'Carl Svensson', 'opensport@googlegroups.com'
|
18
|
+
developer 'Gerald Bauer', 'opensport@googlegroups.com'
|
19
|
+
|
20
|
+
# switch extension to .markdown for gihub formatting
|
21
|
+
self.readme_file = 'README.md'
|
22
|
+
self.history_file = 'HISTORY.md'
|
23
|
+
|
24
|
+
self.licenses = ['Public Domain']
|
25
|
+
|
26
|
+
self.spec_extras = {
|
27
|
+
:required_ruby_version => '>= 1.9.2'
|
28
|
+
}
|
29
|
+
end
|
data/lib/footballdb.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
|
4
|
+
###
|
5
|
+
# note: footballdb is an addon/plugin for sportdb
|
6
|
+
## assume sportdb required
|
7
|
+
|
8
|
+
|
9
|
+
# our own code
|
10
|
+
|
11
|
+
require 'footballdb/version' # let version always go first
|
12
|
+
|
13
|
+
require 'footballdb/models/stats/player_stat'
|
14
|
+
|
15
|
+
require 'footballdb/models/person'
|
16
|
+
|
17
|
+
|
18
|
+
## add backwards compatible n convenience namespace
|
19
|
+
### move to forward.rb ?? - why? why not??
|
20
|
+
module FootballDb
|
21
|
+
Models = Model
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
require 'footballdb/schema' # NB: requires sportdb/models (include SportDB::Models)
|
26
|
+
|
27
|
+
|
28
|
+
module FootballDb
|
29
|
+
|
30
|
+
def self.banner
|
31
|
+
"footballdb/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.root
|
35
|
+
"#{File.expand_path( File.dirname(File.dirname(__FILE__)) )}"
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.test_data_path
|
39
|
+
"#{root}/test/data"
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.create
|
43
|
+
CreateDb.new.up
|
44
|
+
## ConfDb::Model::Prop.create!( key: 'db.schema.football.version', value: VERSION )
|
45
|
+
end
|
46
|
+
|
47
|
+
end # module FootballDb
|
48
|
+
|
49
|
+
|
50
|
+
## say hello
|
51
|
+
puts FootballDb.banner
|
52
|
+
|
@@ -0,0 +1,22 @@
|
|
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
|
+
## todo/check: make more specific - that is, use team_stats, all_time_stats etc. and use has_one!
|
15
|
+
has_many :stats, class_name: 'FootballDb::Model::PlayerStat'
|
16
|
+
|
17
|
+
end # class Person
|
18
|
+
|
19
|
+
|
20
|
+
end # module Model
|
21
|
+
end # module PersonDb
|
22
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
|
2
|
+
module FootballDb
|
3
|
+
module Model
|
4
|
+
|
5
|
+
# PlayerStat
|
6
|
+
#
|
7
|
+
# Contains the primary statistics for a player. Could be on a per-game
|
8
|
+
# basis, per event, per-team, or all-time (no game, no event, no team). A player will
|
9
|
+
# have many player_stats and can also have many generic StatData items
|
10
|
+
#
|
11
|
+
# redCards
|
12
|
+
# yellowCards
|
13
|
+
# totalGoals
|
14
|
+
# goalsConceded
|
15
|
+
# wins
|
16
|
+
# losses
|
17
|
+
# draws
|
18
|
+
# foulsSuffered
|
19
|
+
# foulsCommitted
|
20
|
+
# goalAssists
|
21
|
+
# shotsOnTarget
|
22
|
+
# totalShots
|
23
|
+
# totalGoals
|
24
|
+
# subIns
|
25
|
+
# subOuts
|
26
|
+
# starts
|
27
|
+
# saves
|
28
|
+
# minutesPlayed
|
29
|
+
# position
|
30
|
+
#
|
31
|
+
# See schema.rb for full definition
|
32
|
+
|
33
|
+
class PlayerStat < ActiveRecord::Base
|
34
|
+
|
35
|
+
belongs_to :person, class_name: 'PersonDb::Model::Person', foreign_key: 'person_id'
|
36
|
+
|
37
|
+
belongs_to :team
|
38
|
+
belongs_to :game
|
39
|
+
belongs_to :event
|
40
|
+
|
41
|
+
end # class PlayerStat
|
42
|
+
|
43
|
+
|
44
|
+
end # module Model
|
45
|
+
end # module FootballDb
|
46
|
+
|
@@ -0,0 +1,65 @@
|
|
1
|
+
|
2
|
+
module FootballDb
|
3
|
+
|
4
|
+
class CreateDb
|
5
|
+
|
6
|
+
def up
|
7
|
+
ActiveRecord::Schema.define do
|
8
|
+
|
9
|
+
# The following stat tables are specific to football (soccer)
|
10
|
+
# Sport-specific stats could be abstracted into their own
|
11
|
+
# extensions.
|
12
|
+
|
13
|
+
create_table :team_stats do |t|
|
14
|
+
t.references :team, null: false
|
15
|
+
t.references :game
|
16
|
+
t.references :event
|
17
|
+
|
18
|
+
t.integer :red_cards
|
19
|
+
t.integer :yellow_cards
|
20
|
+
t.integer :goals_for # was total_goals
|
21
|
+
t.integer :goals_against # was goals_conceded
|
22
|
+
t.integer :won # was wins
|
23
|
+
t.integer :lost # was losses
|
24
|
+
t.integer :drawn # was draws
|
25
|
+
|
26
|
+
t.timestamps
|
27
|
+
end
|
28
|
+
|
29
|
+
create_table :player_stats do |t|
|
30
|
+
t.references :person, null: false
|
31
|
+
t.references :team
|
32
|
+
t.references :game
|
33
|
+
t.references :event
|
34
|
+
|
35
|
+
t.integer :red_cards
|
36
|
+
t.integer :yellow_cards
|
37
|
+
t.integer :goals_for # was total_goals
|
38
|
+
t.integer :goals_against # was goals_conceded
|
39
|
+
t.integer :won # was wins
|
40
|
+
t.integer :lost # was losses
|
41
|
+
t.integer :drawn # was draws
|
42
|
+
t.integer :fouls_suffered
|
43
|
+
t.integer :fouls_committed
|
44
|
+
t.integer :goal_assists
|
45
|
+
t.integer :shots_on_target
|
46
|
+
t.integer :total_shots ## todo/check - use shots ??
|
47
|
+
t.integer :total_goals ## todo/check - duplicate ??
|
48
|
+
t.integer :sub_ins
|
49
|
+
t.integer :sub_outs
|
50
|
+
t.integer :starts
|
51
|
+
t.integer :saves
|
52
|
+
t.integer :minutes_played
|
53
|
+
t.string :position
|
54
|
+
|
55
|
+
t.timestamps
|
56
|
+
end
|
57
|
+
|
58
|
+
end # Schema.define
|
59
|
+
end # method up
|
60
|
+
|
61
|
+
|
62
|
+
end # class CreateDb
|
63
|
+
|
64
|
+
end # module FootballDb
|
65
|
+
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: footballdb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Carl Svensson
|
8
|
+
- Gerald Bauer
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-07-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rdoc
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ~>
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '4.0'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '4.0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: hoe
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ~>
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '3.10'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ~>
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '3.10'
|
42
|
+
description: footballdb - football.db.stats - add-on to sport.db for football stats
|
43
|
+
etc.
|
44
|
+
email:
|
45
|
+
- opensport@googlegroups.com
|
46
|
+
- opensport@googlegroups.com
|
47
|
+
executables: []
|
48
|
+
extensions: []
|
49
|
+
extra_rdoc_files:
|
50
|
+
- HISTORY.md
|
51
|
+
- Manifest.txt
|
52
|
+
- README.md
|
53
|
+
files:
|
54
|
+
- HISTORY.md
|
55
|
+
- Manifest.txt
|
56
|
+
- README.md
|
57
|
+
- Rakefile
|
58
|
+
- lib/footballdb.rb
|
59
|
+
- lib/footballdb/models/person.rb
|
60
|
+
- lib/footballdb/models/stats/player_stat.rb
|
61
|
+
- lib/footballdb/schema.rb
|
62
|
+
- lib/footballdb/version.rb
|
63
|
+
homepage: https://github.com/sportdb/football.db.stats
|
64
|
+
licenses:
|
65
|
+
- Public Domain
|
66
|
+
metadata: {}
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options:
|
69
|
+
- --main
|
70
|
+
- README.md
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.9.2
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 2.1.10
|
86
|
+
signing_key:
|
87
|
+
specification_version: 4
|
88
|
+
summary: footballdb - football.db.stats - add-on to sport.db for football stats etc.
|
89
|
+
test_files: []
|