sportdb 1.6.18 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,6 +7,8 @@ config/fixtures.de.yml
7
7
  config/fixtures.en.yml
8
8
  config/fixtures.es.yml
9
9
  config/fixtures.pt.yml
10
+ data/seasons.txt
11
+ data/setups/all.yml
10
12
  lib/sportdb.rb
11
13
  lib/sportdb/cli/main.rb
12
14
  lib/sportdb/cli/opts.rb
@@ -0,0 +1,28 @@
1
+ ###
2
+ # use period for season? why? why not?
3
+ # - semantic hairsplitting? make it an alias? why? why not? who cares?
4
+
5
+ 2014/15
6
+ 2013/14
7
+ 2012/13 # use 2012-13 or 2012_13 or 2012.13 or 2012+13 ???
8
+ 2011/12
9
+ 2010/11
10
+ 2009/10
11
+ 2008/09
12
+ 2007/08
13
+ 2015 # years only
14
+ 2014
15
+ 2013
16
+ 2012
17
+ 2011
18
+ 2010
19
+ 2009
20
+ 2008
21
+ 2014.1
22
+ 2014.2
23
+ 2013.1 # e.g. Liga MX has two (complete) seasons in *one* year e.g. Clausura 2013 n Apertura 2013
24
+ 2013.2
25
+ 2012.1
26
+ 2012.2
27
+
28
+ ### for 2013.1 use 2013_I 2013-I 2013.I n 2013-II 2013.II or 2013.A n 2013.B
@@ -0,0 +1,5 @@
1
+ ############################
2
+ # builtin seed data
3
+
4
+ data:
5
+ - seasons
@@ -74,7 +74,7 @@ require 'sportdb/data/models' # add convenience finders for known fixtures
74
74
 
75
75
 
76
76
 
77
- module SportDB
77
+ module SportDb
78
78
 
79
79
  def self.banner
80
80
  "sportdb #{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
@@ -87,6 +87,10 @@ module SportDB
87
87
  def self.config_path
88
88
  "#{root}/config"
89
89
  end
90
+
91
+ def self.data_path
92
+ "#{root}/data"
93
+ end
90
94
 
91
95
  def self.lang
92
96
  # todo/fix: find a better way for single instance ??
@@ -116,6 +120,10 @@ module SportDB
116
120
  read_setup( 'setups/all', include_path )
117
121
  end
118
122
 
123
+ def self.read_builtin
124
+ read_setup( 'setups/all', data_path )
125
+ end
126
+
119
127
 
120
128
  # load built-in (that is, bundled within the gem) named plain text seeds
121
129
  # - pass in an array of pairs of event/seed names e.g.
@@ -97,6 +97,9 @@ command [:create] do |c|
97
97
  LogDb.create
98
98
  WorldDb.create
99
99
  SportDb.create
100
+
101
+ SportDb.read_builtin # e.g. seasons.txt etc
102
+
100
103
  puts 'Done.'
101
104
  end # action
102
105
  end # command create
@@ -125,6 +128,8 @@ command [:setup,:s] do |c|
125
128
  LogDb.create
126
129
  WorldDb.create
127
130
  SportDb.create
131
+
132
+ SportDb.read_builtin # e.g. seasons.txt etc
128
133
 
129
134
  WorldDb.read_all( opts.world_data_path )
130
135
  SportDb.read_setup( "setups/#{setup}", opts.data_path )
@@ -152,7 +157,10 @@ command [:update,:up,:u] do |c|
152
157
  ## todo: document optional setup profile arg (defaults to all)
153
158
  setup = args[0] || 'all'
154
159
 
155
- SportDb.delete! if o[:delete].present?
160
+ if o[:delete].present?
161
+ SportDb.delete!
162
+ SportDb.read_builtin # NB: reload builtins (e.g. seasons etc.)
163
+ end
156
164
 
157
165
  SportDb.read_setup( "setups/#{setup}", opts.data_path )
158
166
  puts 'Done.'
@@ -171,7 +179,10 @@ command [:load, :l] do |c|
171
179
 
172
180
  connect_to_db( opts )
173
181
 
174
- SportDb.delete! if o[:delete].present?
182
+ if o[:delete].present?
183
+ SportDb.delete!
184
+ SportDb.read_builtin # NB: reload builtins (e.g. seasons etc.)
185
+ end
175
186
 
176
187
  reader = SportDb::Reader.new( opts.data_path )
177
188
 
@@ -106,78 +106,78 @@ module SportDb
106
106
  BR_TEAMS +
107
107
  MX_TEAMS +
108
108
  [
109
- 'club/america/teams_c',
110
- 'club/america/teams_n',
111
- 'club/america/teams_s',
109
+ 'america/teams_c',
110
+ 'america/teams_n',
111
+ 'america/teams_s',
112
112
  ]
113
113
 
114
114
  AR_FIXTURES = []
115
115
 
116
116
  ### todo: ? get event_key automatically from event_reader ?? why? why not??
117
117
  BR_FIXTURES = [
118
- ['br.2013', 'br/2013/cb' ]
118
+ 'br/2013/cb'
119
119
  ]
120
120
 
121
121
  MX_FIXTURES = [
122
- ['mx.apertura.2012.2', 'mx/2012/apertura' ],
123
- ['mx.clausura.2013.1', 'mx/2013/clausura' ]
122
+ 'mx/2012/apertura',
123
+ 'mx/2013/clausura'
124
124
  ]
125
125
 
126
126
 
127
127
  AT_FIXTURES = [
128
- ['at.2011/12', 'at/2011_12/bl' ],
129
- ['at.cup.2011/12', 'at/2011_12/cup' ],
130
- ['at.2012/13', 'at/2012_13/bl', 'at/2012_13/bl2'],
131
- ['at.cup.2012/13', 'at/2012_13/cup']
128
+ 'at/2011_12/bl',
129
+ 'at/2011_12/cup',
130
+ 'at/2012_13/bl',
131
+ 'at/2012_13/cup'
132
132
  ]
133
133
 
134
134
  DE_FIXTURES = [
135
- ['de.2012/13', 'de/2012_13/bl' ]
135
+ 'de/2012_13/bl'
136
136
  ]
137
137
 
138
138
  EN_FIXTURES = [
139
- ['en.2012/13', 'en/2012_13/pl' ]
139
+ 'en/2012_13/pl'
140
140
  ]
141
141
 
142
142
  RO_FIXTURES = [
143
- ['ro.2012/13', 'ro/2012_13/l1' ]
143
+ 'ro/2012_13/l1'
144
144
  ]
145
145
 
146
146
 
147
147
  EUROPE_FIXTURES = [
148
- ['euro.2008', 'europe/2008/euro'],
149
- ['euro.2012', 'europe/2012/euro'],
148
+ 'euro-cup!/2008/euro',
149
+ 'euro-cup!/2012/euro'
150
150
  ]
151
151
 
152
152
  AMERICA_FIXTURES = [
153
- ['america.copa.2011', 'america/2011/copa'],
154
- ['america.gold.2011', 'america/2011/gold'],
155
- ['america.gold.2013', 'america/2013/gold'],
156
- ['america.copa.2015', 'america/2015/copa'],
153
+ 'america/2011/copa',
154
+ 'america/2011/gold',
155
+ 'america/2013/gold',
156
+ 'america/2015/copa'
157
157
  ]
158
158
 
159
159
  WORLD_FIXTURES = [
160
- ['world.conf.2009', 'world/2009/conf'],
161
- ['world.2010', 'world/2010/cup'],
162
- ['world.quali.america.2014', 'world/2014/quali_america'],
163
- ['world.quali.europe.c.2014', 'world/2014/quali_europe_c'],
164
- ['world.quali.europe.2014', 'world/2014/quali_europe', 'world/2014/quali_europe_c', 'world/2014/quali_europe_i'],
165
- ['world.2014', 'world/2014/cup'],
160
+ 'world/2009/conf',
161
+ 'world/2010/cup',
162
+ 'world/2014/quali_america',
163
+ 'world/2014/quali_europe_c',
164
+ 'world/2014/quali_europe',
165
+ 'world/2014/cup'
166
166
  ]
167
167
 
168
168
  CLUB_EUROPE_FIXTURES = [
169
- ['cl.2011/12', 'club/europe/2011_12/cl'],
170
- ['el.2011/12', 'club/europe/2011_12/el'],
171
- ['cl.2012/13', 'club/europe/2012_13/cl'],
172
- ['el.2012/13', 'club/europe/2012_13/el'],
169
+ 'club/europe/2011_12/cl',
170
+ 'club/europe/2011_12/el',
171
+ 'club/europe/2012_13/cl',
172
+ 'club/europe/2012_13/el'
173
173
  ]
174
174
 
175
175
  CLUB_AMERICA_FIXTURES = [
176
- ['america.cl.2011/12', 'club/america/2011_12/cl'],
177
- ['copa.libertadores.2012', 'club/america/2012/libertadores' ],
178
- ['copa.sud.2012', 'club/america/2012/sud'],
179
- ['america.cl.2012/13', 'club/america/2012_13/cl'],
180
- ['copa.libertadores.2013', 'club/america/2013/libertadores' ]
176
+ 'club/america/2011_12/cl',
177
+ 'club/america/2012/libertadores',
178
+ 'club/america/2012/sud',
179
+ 'club/america/2012_13/cl',
180
+ 'club/america/2013/libertadores'
181
181
  ]
182
182
 
183
183
  def self.all
@@ -12,9 +12,9 @@ class Lang
12
12
 
13
13
  # load word lists
14
14
 
15
- @fixtures_en = YAML.load( File.read_utf8( "#{SportDB.config_path}/fixtures.en.yml" ))
16
- @fixtures_de = YAML.load( File.read_utf8( "#{SportDB.config_path}/fixtures.de.yml" ))
17
- @fixtures_es = YAML.load( File.read_utf8( "#{SportDB.config_path}/fixtures.es.yml" ))
15
+ @fixtures_en = YAML.load( File.read_utf8( "#{SportDb.config_path}/fixtures.en.yml" ))
16
+ @fixtures_de = YAML.load( File.read_utf8( "#{SportDb.config_path}/fixtures.de.yml" ))
17
+ @fixtures_es = YAML.load( File.read_utf8( "#{SportDb.config_path}/fixtures.es.yml" ))
18
18
 
19
19
  @fixtures = {
20
20
  'en' => @fixtures_en,
@@ -214,9 +214,9 @@ class LangChecker
214
214
  ### todo/fix:
215
215
  # remove comment lines and end of line comments from text
216
216
 
217
- en = count_words_in_text( SportDB.lang.words_en, text )
218
- de = count_words_in_text( SportDB.lang.words_de, text )
219
- es = count_words_in_text( SportDB.lang.words_es, text )
217
+ en = count_words_in_text( SportDb.lang.words_en, text )
218
+ de = count_words_in_text( SportDb.lang.words_de, text )
219
+ es = count_words_in_text( SportDb.lang.words_es, text )
220
220
 
221
221
  lang_counts = [
222
222
  [ 'en', en ],
@@ -24,7 +24,7 @@ end
24
24
  module WorldDb::Models
25
25
 
26
26
  # add alias? why? why not? # is there a better way?
27
- # - just include SportDB::Models - why? why not?
27
+ # - just include SportDb::Models - why? why not?
28
28
  # - just include once in loader??
29
29
  Team = SportDb::Models::Team
30
30
  League = SportDb::Models::League
@@ -381,7 +381,7 @@ class Reader
381
381
 
382
382
  logger.info "parsing data '#{name}' (#{path})..."
383
383
 
384
- SportDB.lang.lang = LangChecker.new.analyze( path )
384
+ SportDb.lang.lang = LangChecker.new.analyze( path )
385
385
 
386
386
  reader = LineReader.new( path )
387
387
 
@@ -397,7 +397,7 @@ class Reader
397
397
 
398
398
  logger.info "parsing data '#{name}' (#{path})..."
399
399
 
400
- ### SportDB.lang.lang = LangChecker.new.analyze( name, include_path )
400
+ ### SportDb.lang.lang = LangChecker.new.analyze( name, include_path )
401
401
 
402
402
  reader = LineReader.new( path )
403
403
 
@@ -476,7 +476,7 @@ class Reader
476
476
 
477
477
  logger.info "parsing data '#{name}' (#{path})..."
478
478
 
479
- ### SportDB.lang.lang = LangChecker.new.analyze( name, include_path )
479
+ ### SportDb.lang.lang = LangChecker.new.analyze( name, include_path )
480
480
 
481
481
  reader = LineReader.new( path )
482
482
 
@@ -550,7 +550,7 @@ class Reader
550
550
 
551
551
  logger.info "parsing data '#{name}' (#{path})..."
552
552
 
553
- ### SportDB.lang.lang = LangChecker.new.analyze( name, include_path )
553
+ ### SportDb.lang.lang = LangChecker.new.analyze( name, include_path )
554
554
 
555
555
  reader = LineReader.new( path )
556
556
 
@@ -615,7 +615,7 @@ class Reader
615
615
 
616
616
  private
617
617
 
618
- include SportDB::FixtureHelpers
618
+ include SportDb::FixtureHelpers
619
619
 
620
620
  def load_fixtures_worker( event_key, reader )
621
621
 
@@ -1,9 +1,10 @@
1
1
 
2
2
  module SportDb
3
- VERSION = '1.6.18'
3
+ VERSION = '1.7.0'
4
4
  end
5
5
 
6
+
6
7
  ###########################################
7
- ## fix: remove old alias for SportDb
8
+ # fix: remove old alias for SportDb
8
9
 
9
10
  SportDB = SportDb
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.18
4
+ version: 1.7.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-27 00:00:00.000000000Z
12
+ date: 2013-08-06 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: worlddb
16
- requirement: &13812420 !ruby/object:Gem::Requirement
16
+ requirement: &19798968 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.7'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *13812420
24
+ version_requirements: *19798968
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: gli
27
- requirement: &13812156 !ruby/object:Gem::Requirement
27
+ requirement: &19798656 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.5.6
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *13812156
35
+ version_requirements: *19798656
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rdoc
38
- requirement: &13811748 !ruby/object:Gem::Requirement
38
+ requirement: &19798248 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '4.0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *13811748
46
+ version_requirements: *19798248
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: hoe
49
- requirement: &13811340 !ruby/object:Gem::Requirement
49
+ requirement: &19797936 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '3.6'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *13811340
57
+ version_requirements: *19797936
58
58
  description: sportdb - sport.db command line tool
59
59
  email: opensport@googlegroups.com
60
60
  executables:
@@ -74,6 +74,8 @@ files:
74
74
  - config/fixtures.en.yml
75
75
  - config/fixtures.es.yml
76
76
  - config/fixtures.pt.yml
77
+ - data/seasons.txt
78
+ - data/setups/all.yml
77
79
  - lib/sportdb.rb
78
80
  - lib/sportdb/cli/main.rb
79
81
  - lib/sportdb/cli/opts.rb