sportdb 1.7.7 → 1.7.8
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/sportdb +0 -0
- data/lib/sportdb/utils.rb +30 -0
- data/lib/sportdb/version.rb +1 -1
- data/test/test_date.rb +11 -0
- metadata +20 -18
data/bin/sportdb
CHANGED
File without changes
|
data/lib/sportdb/utils.rb
CHANGED
@@ -200,6 +200,10 @@ module SportDb::FixtureHelpers
|
|
200
200
|
# e.g. 12 May 2013 14:00 => D|DD.MMM.YYYY H|HH:MM
|
201
201
|
regex_en = /\b(\d{1,2})\s(#{month_abbrev_en})\s(\d{4})\s+(\d{1,2}):(\d{2})\b/
|
202
202
|
|
203
|
+
## todo: add version w/ hours
|
204
|
+
# e.g. Jun/12 w/ implied year and implied hours (set to 12:00)
|
205
|
+
regex_en2 = /\b(#{month_abbrev_en})\/(\d{1,2})\b/
|
206
|
+
|
203
207
|
|
204
208
|
if line =~ regex_db
|
205
209
|
value = '%d-%02d-%02d %02d:%02d' % [$1.to_i, $2.to_i, $3.to_i, $4.to_i, $5.to_i]
|
@@ -276,6 +280,32 @@ module SportDb::FixtureHelpers
|
|
276
280
|
line.sub!( regex_en, '[DATE.EN]' )
|
277
281
|
|
278
282
|
return DateTime.strptime( value, '%Y-%b-%d %H:%M' ) ## %b - abbreviated month name (e.g. Jan,Feb, etc.)
|
283
|
+
elsif line =~ regex_en2
|
284
|
+
# todo: make more generic for reuse
|
285
|
+
month_abbrev_en_to_i = {
|
286
|
+
'Jan' => 1,
|
287
|
+
'Feb' => 2,
|
288
|
+
'Mar' => 3,
|
289
|
+
'Apr' => 4,
|
290
|
+
'May' => 5,
|
291
|
+
'Jun' => 6,
|
292
|
+
'Jul' => 7,
|
293
|
+
'Aug' => 8,
|
294
|
+
'Sep' => 9,
|
295
|
+
'Oct' => 10,
|
296
|
+
'Nov' => 11,
|
297
|
+
'Dec' => 12 }
|
298
|
+
|
299
|
+
day = $2.to_i
|
300
|
+
month = month_abbrev_en_to_i[ $1 ]
|
301
|
+
year = calculate_year( day, month, opts[:start_at] )
|
302
|
+
|
303
|
+
value = '%d-%02d-%02d 12:00' % [year, month, day]
|
304
|
+
logger.debug " date: >#{value}<"
|
305
|
+
|
306
|
+
line.sub!( regex_en2, '[DATE.EN2] ' )
|
307
|
+
|
308
|
+
return DateTime.strptime( value, '%Y-%m-%d %H:%M' )
|
279
309
|
else
|
280
310
|
return nil
|
281
311
|
end
|
data/lib/sportdb/version.rb
CHANGED
data/test/test_date.rb
CHANGED
@@ -11,6 +11,17 @@ class TestDate < MiniTest::Unit::TestCase
|
|
11
11
|
assert_date DateTime.new( 2013, 1, 26 ), parse_date( '26.01.2013' )
|
12
12
|
end
|
13
13
|
|
14
|
+
def test_date_en
|
15
|
+
start_at = DateTime.new( 2013, 1, 25 )
|
16
|
+
|
17
|
+
assert_date DateTime.new( 2013, 1, 26 ), parse_date( 'Jan/26', start_at: start_at )
|
18
|
+
assert_datetime DateTime.new( 2013, 1, 26, 12, 00 ), parse_date( 'Jan/26', start_at: start_at )
|
19
|
+
|
20
|
+
assert_date DateTime.new( 2013, 6, 13 ), parse_date( 'Jun/13', start_at: start_at )
|
21
|
+
assert_datetime DateTime.new( 2013, 6, 13, 12, 00 ), parse_date( 'Jun/13', start_at: start_at )
|
22
|
+
end
|
23
|
+
|
24
|
+
|
14
25
|
private
|
15
26
|
|
16
27
|
## todo: check if assert_datetime or assert_date exist already? what is the best practice to check dates ???
|
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.7.
|
4
|
+
version: 1.7.8
|
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-
|
12
|
+
date: 2013-12-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: worlddb
|
16
|
-
requirement: &
|
16
|
+
requirement: &22578024 !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: *
|
24
|
+
version_requirements: *22578024
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: fetcher
|
27
|
-
requirement: &
|
27
|
+
requirement: &22577724 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0.3'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *22577724
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: gli
|
38
|
-
requirement: &
|
38
|
+
requirement: &22577412 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,36 +43,38 @@ dependencies:
|
|
43
43
|
version: 2.5.6
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *22577412
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rdoc
|
49
|
-
requirement: &
|
49
|
+
requirement: &22577124 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '4.0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *22577124
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: hoe
|
60
|
-
requirement: &
|
60
|
+
requirement: &22576836 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version: '3.
|
65
|
+
version: '3.7'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *22576836
|
69
69
|
description: sportdb - sport.db command line tool
|
70
70
|
email: opensport@googlegroups.com
|
71
71
|
executables:
|
72
72
|
- sportdb
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files:
|
75
|
+
- History.md
|
75
76
|
- Manifest.txt
|
77
|
+
- README.md
|
76
78
|
files:
|
77
79
|
- History.md
|
78
80
|
- Manifest.txt
|
@@ -199,16 +201,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
201
|
version: '0'
|
200
202
|
requirements: []
|
201
203
|
rubyforge_project: sportdb
|
202
|
-
rubygems_version: 1.8.
|
204
|
+
rubygems_version: 1.8.16
|
203
205
|
signing_key:
|
204
206
|
specification_version: 3
|
205
207
|
summary: sportdb - sport.db command line tool
|
206
208
|
test_files:
|
209
|
+
- test/test_changes.rb
|
210
|
+
- test/test_cursor.rb
|
207
211
|
- test/test_date.rb
|
208
212
|
- test/test_lang.rb
|
209
|
-
- test/test_cursor.rb
|
210
213
|
- test/test_round.rb
|
211
214
|
- test/test_scores.rb
|
212
|
-
- test/test_winner.rb
|
213
215
|
- test/test_utils.rb
|
214
|
-
- test/
|
216
|
+
- test/test_winner.rb
|