sportdb 1.6.14 → 1.6.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -173,6 +173,9 @@ module SportDb::FixtureHelpers
173
173
  # nb: allow hour as 20.30
174
174
  regex_de2 = /\b(\d{1,2})\.(\d{1,2})\.(\d{4})\s+(\d{1,2})[:.](\d{2})\b/
175
175
 
176
+ # e.g. 14.09.2012 => DD.MM.YYYY w/ implied hours (set to 12:00)
177
+ regex_de3 = /\b(\d{1,2})\.(\d{1,2})\.(\d{4})\b/
178
+
176
179
 
177
180
  month_abbrev_en = "Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec"
178
181
 
@@ -181,7 +184,7 @@ module SportDb::FixtureHelpers
181
184
 
182
185
 
183
186
  if line =~ regex_db
184
- value = '%d-%02d-%02d %02d:%02d' % [$1, $2, $3, $4, $5]
187
+ value = '%d-%02d-%02d %02d:%02d' % [$1.to_i, $2.to_i, $3.to_i, $4.to_i, $5.to_i]
185
188
  logger.debug " date: >#{value}<"
186
189
 
187
190
  ## todo: lets you configure year
@@ -191,14 +194,14 @@ module SportDb::FixtureHelpers
191
194
 
192
195
  return DateTime.strptime( value, '%Y-%m-%d %H:%M' )
193
196
  elsif line =~ regex_db2
194
- value = '%d-%02d-%02d 12:00' % [$1, $2, $3]
197
+ value = '%d-%02d-%02d 12:00' % [$1.to_i, $2.to_i, $3.to_i]
195
198
  logger.debug " date: >#{value}<"
196
199
 
197
200
  line.sub!( regex_db2, '[DATE.DB2]' )
198
201
 
199
202
  return DateTime.strptime( value, '%Y-%m-%d %H:%M' )
200
203
  elsif line =~ regex_de2
201
- value = '%d-%02d-%02d %02d:%02d' % [$3, $2, $1, $4, $5]
204
+ value = '%d-%02d-%02d %02d:%02d' % [$3.to_i, $2.to_i, $1.to_i, $4.to_i, $5.to_i]
202
205
  logger.debug " date: >#{value}<"
203
206
 
204
207
  ## todo: lets you configure year
@@ -213,7 +216,7 @@ module SportDb::FixtureHelpers
213
216
  # get year from event start date!!!!
214
217
  # do NOT hard code!!!!
215
218
 
216
- value = '2012-%02d-%02d %02d:%02d' % [$2, $1, $3, $4]
219
+ value = '2012-%02d-%02d %02d:%02d' % [$2.to_i, $1.to_i, $3.to_i, $4.to_i]
217
220
  logger.debug " date: >#{value}<"
218
221
 
219
222
  ## todo: lets you configure year
@@ -221,9 +224,19 @@ module SportDb::FixtureHelpers
221
224
 
222
225
  line.sub!( regex_de, '[DATE.DE]' )
223
226
 
227
+ return DateTime.strptime( value, '%Y-%m-%d %H:%M' )
228
+ elsif line =~ regex_de3
229
+ value = '%d-%02d-%02d 12:00' % [$3.to_i, $2.to_i, $1.to_i]
230
+ logger.debug " date: >#{value}<"
231
+
232
+ ## todo: lets you configure year
233
+ ## and time zone (e.g. cet, eet, utc, etc.)
234
+
235
+ line.sub!( regex_de3, '[DATE.DE3]' )
236
+
224
237
  return DateTime.strptime( value, '%Y-%m-%d %H:%M' )
225
238
  elsif line =~ regex_en
226
- value = '%d-%s-%02d %02d:%02d' % [$3, $2, $1, $4, $5]
239
+ value = '%d-%s-%02d %02d:%02d' % [$3.to_i, $2, $1.to_i, $4.to_i, $5.to_i]
227
240
  logger.debug " date: >#{value}<"
228
241
 
229
242
  line.sub!( regex_en, '[DATE.EN]' )
@@ -1,6 +1,6 @@
1
1
 
2
2
  module SportDb
3
- VERSION = '1.6.14'
3
+ VERSION = '1.6.15'
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.14
4
+ version: 1.6.15
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2013-06-24 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: worlddb
16
- requirement: &18220920 !ruby/object:Gem::Requirement
16
+ requirement: &16592544 !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: *18220920
24
+ version_requirements: *16592544
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: commander
27
- requirement: &18220452 !ruby/object:Gem::Requirement
27
+ requirement: &16591860 !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: *18220452
35
+ version_requirements: *16591860
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rdoc
38
- requirement: &18219588 !ruby/object:Gem::Requirement
38
+ requirement: &16582848 !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: *18219588
46
+ version_requirements: *16582848
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: hoe
49
- requirement: &18219000 !ruby/object:Gem::Requirement
49
+ requirement: &16581960 !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: *18219000
57
+ version_requirements: *16581960
58
58
  description: sportdb - sport.db command line tool
59
59
  email: opensport@googlegroups.com
60
60
  executables: