sportdb 1.6.15 → 1.6.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/sportdb/reader.rb +23 -33
  2. data/lib/sportdb/version.rb +1 -1
  3. metadata +10 -10
@@ -204,10 +204,9 @@ class Reader
204
204
  end # load_persons
205
205
 
206
206
 
207
-
208
207
  def load_seasons( name )
209
208
 
210
- reader = HashReaderV2.new( name, include_path )
209
+ reader = LineReaderV2.new( name, include_path )
211
210
 
212
211
  ####
213
212
  ## fix!!!!!
@@ -215,42 +214,33 @@ class Reader
215
214
  ## use Season.create_or_update_from_hash_reader?? or similar
216
215
  # move parsing code to model
217
216
 
218
- reader.each_typed do |key, value|
217
+ reader.each_line do |line|
219
218
 
220
- ## puts "processing event attrib >>#{key}<< >>#{value}<<..."
219
+ # for now assume single value
220
+ logger.debug ">#{line}<"
221
221
 
222
- if key == 'seasons'
223
-
224
- logger.debug "#{value.class.name}: >>#{value}<<"
225
-
226
- ## nb: assume value is an array
227
- value.each do |item|
228
- season_attribs = {}
229
-
230
- logger.debug " find season key: #{item.to_s.strip}"
231
- season = Season.find_by_key( item.to_s.strip )
222
+ key = line
232
223
 
233
- ## check if it exists
234
- if season.present?
235
- logger.debug "update season #{season.id}-#{season.key}:"
236
- else
237
- logger.debug "create season:"
238
- season = Season.new
239
- season_attribs[ :key ] = item.to_s.strip
240
- end
241
-
242
- season_attribs[:title] = item.to_s.strip
243
-
244
- logger.debug season_attribs.to_json
245
-
246
- season.update_attributes!( season_attribs )
247
- end
248
-
224
+ logger.debug " find season key: #{key}"
225
+ season = Season.find_by_key( key )
226
+
227
+ season_attribs = {}
228
+
229
+ ## check if it exists
230
+ if season.present?
231
+ logger.debug "update season #{season.id}-#{season.key}:"
249
232
  else
250
- logger.error "unknown seasons key; skipping"
233
+ logger.debug "create season:"
234
+ season = Season.new
235
+ season_attribs[ :key ] = key
251
236
  end
252
-
253
- end # each key,value
237
+
238
+ season_attribs[ :title ] = key # for now key n title are the same
239
+
240
+ logger.debug season_attribs.to_json
241
+
242
+ season.update_attributes!( season_attribs )
243
+ end # each line
254
244
 
255
245
  end # load_seasons
256
246
 
@@ -1,6 +1,6 @@
1
1
 
2
2
  module SportDb
3
- VERSION = '1.6.15'
3
+ VERSION = '1.6.16'
4
4
  end
5
5
 
6
6
  ###########################################
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.15
4
+ version: 1.6.16
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-24 00:00:00.000000000Z
12
+ date: 2013-06-25 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: worlddb
16
- requirement: &16592544 !ruby/object:Gem::Requirement
16
+ requirement: &15927624 !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: *16592544
24
+ version_requirements: *15927624
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: commander
27
- requirement: &16591860 !ruby/object:Gem::Requirement
27
+ requirement: &15926976 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 4.1.3
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *16591860
35
+ version_requirements: *15926976
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rdoc
38
- requirement: &16582848 !ruby/object:Gem::Requirement
38
+ requirement: &15926508 !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: *16582848
46
+ version_requirements: *15926508
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: hoe
49
- requirement: &16581960 !ruby/object:Gem::Requirement
49
+ requirement: &15926088 !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: *16581960
57
+ version_requirements: *15926088
58
58
  description: sportdb - sport.db command line tool
59
59
  email: opensport@googlegroups.com
60
60
  executables: