Gooby 0.9.0

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.
Files changed (98) hide show
  1. data/README +218 -0
  2. data/bin/forerunner_xml_parser.rb +28 -0
  3. data/bin/forerunner_xml_parser.sh +16 -0
  4. data/bin/forerunner_xml_splitter.rb +60 -0
  5. data/bin/gen_gmap.rb +30 -0
  6. data/bin/gen_gmap.sh +19 -0
  7. data/bin/tests_gen.rb +13 -0
  8. data/data/20041113_richmond_marathon.csv +1036 -0
  9. data/data/20041113_richmond_marathon.xml +8663 -0
  10. data/data/20050305_corporate_cup_hm.csv +251 -0
  11. data/data/20050305_corporate_cup_hm.xml +2208 -0
  12. data/data/20050430_nashville_marathon.csv +1208 -0
  13. data/data/20050430_nashville_marathon.xml +10043 -0
  14. data/data/20051119_dowd_ymca_hm.csv +251 -0
  15. data/data/20051119_dowd_ymca_hm.xml +2210 -0
  16. data/data/20051124_hyatt_turkey_trot_8K.csv +321 -0
  17. data/data/20051124_hyatt_turkey_trot_8K.xml +2651 -0
  18. data/data/forerunner_2005.xml +259620 -0
  19. data/data/forerunner_2006.xml +190853 -0
  20. data/data/forerunner_2007.xml +259014 -0
  21. data/data/geo_data.txt +171 -0
  22. data/data/phx.csv +1280 -0
  23. data/data/phx.xml +10620 -0
  24. data/data/run_2007_01_01_16_38_27.xml +2020 -0
  25. data/data/run_2007_01_06_15_27_31.xml +2020 -0
  26. data/data/run_2007_01_10_12_25_47.xml +820 -0
  27. data/data/run_2007_01_10_22_44_54.csv +112 -0
  28. data/data/run_2007_01_10_22_44_54.xml +908 -0
  29. data/data/run_2007_01_11_10_48_45.xml +1292 -0
  30. data/data/run_2007_01_13_15_37_06.xml +1964 -0
  31. data/data/run_2007_01_14_15_46_02.xml +1368 -0
  32. data/data/run_2007_01_15_14_01_48.xml +1868 -0
  33. data/data/run_2007_01_20_16_22_05.xml +1702 -0
  34. data/data/run_2007_01_27_17_32_13.xml +3626 -0
  35. data/data/run_2007_01_28_19_14_52.xml +2538 -0
  36. data/data/run_2007_02_03_14_30_20.xml +2016 -0
  37. data/data/run_2007_02_04_18_02_30.xml +1476 -0
  38. data/data/run_2007_02_17_16_29_35.xml +1236 -0
  39. data/data/run_2007_02_19_14_44_33.xml +1816 -0
  40. data/data/run_2007_02_23_15_53_55.xml +36 -0
  41. data/data/run_2007_02_23_15_55_20.xml +1296 -0
  42. data/data/run_2007_02_24_15_01_35.csv +484 -0
  43. data/data/run_2007_02_24_15_01_35.xml +3884 -0
  44. data/data/test1.txt +4 -0
  45. data/lib/cls_counter_hash.rb +83 -0
  46. data/lib/cls_delim_line.rb +40 -0
  47. data/lib/cls_dttm.rb +84 -0
  48. data/lib/cls_duration.rb +87 -0
  49. data/lib/cls_forerunner_xml_parser.rb +183 -0
  50. data/lib/cls_forerunner_xml_splitter.rb +113 -0
  51. data/lib/cls_geo_data.rb +186 -0
  52. data/lib/cls_gooby_object.rb +23 -0
  53. data/lib/cls_google_map_generator.rb +368 -0
  54. data/lib/cls_history.rb +38 -0
  55. data/lib/cls_lap.rb +27 -0
  56. data/lib/cls_line.rb +78 -0
  57. data/lib/cls_options.rb +74 -0
  58. data/lib/cls_position.rb +49 -0
  59. data/lib/cls_run.rb +199 -0
  60. data/lib/cls_simple_xml_parser.rb +46 -0
  61. data/lib/cls_test_regen.rb +187 -0
  62. data/lib/cls_track.rb +52 -0
  63. data/lib/cls_trackpoint.rb +205 -0
  64. data/lib/mod_introspect.rb +33 -0
  65. data/lib/mod_io.rb +65 -0
  66. data/lib/mod_project_info.rb +81 -0
  67. data/lib/mod_string.rb +26 -0
  68. data/lib/mod_test_helper.rb +22 -0
  69. data/samples/20041113_richmond_marathon.html +532 -0
  70. data/samples/20050305_corporate_cup_hm.html +448 -0
  71. data/samples/20050430_nashville_marathon.html +530 -0
  72. data/samples/gps_point_capture.html +54 -0
  73. data/samples/phoenix_marathon.html +542 -0
  74. data/samples/run_2007_01_10_22_44_54.html +146 -0
  75. data/samples/run_2007_02_24_15_01_35.html +298 -0
  76. data/tests/tst_cls_counter_hash.rb +105 -0
  77. data/tests/tst_cls_delim_line.rb +72 -0
  78. data/tests/tst_cls_dttm.rb +129 -0
  79. data/tests/tst_cls_duration.rb +49 -0
  80. data/tests/tst_cls_forerunner_xml_parser.rb +68 -0
  81. data/tests/tst_cls_geo_data.rb +69 -0
  82. data/tests/tst_cls_gooby_object.rb +24 -0
  83. data/tests/tst_cls_google_map_generator.rb +107 -0
  84. data/tests/tst_cls_history.rb +44 -0
  85. data/tests/tst_cls_lap.rb +36 -0
  86. data/tests/tst_cls_line.rb +108 -0
  87. data/tests/tst_cls_options.rb +77 -0
  88. data/tests/tst_cls_position.rb +64 -0
  89. data/tests/tst_cls_run.rb +140 -0
  90. data/tests/tst_cls_simple_xml_parser.rb +48 -0
  91. data/tests/tst_cls_track.rb +68 -0
  92. data/tests/tst_cls_trackpoint.rb +143 -0
  93. data/tests/tst_gooby.rb +28 -0
  94. data/tests/tst_mod_introspect.rb +30 -0
  95. data/tests/tst_mod_io.rb +51 -0
  96. data/tests/tst_mod_project_info.rb +77 -0
  97. data/tests/tst_mod_string.rb +56 -0
  98. metadata +142 -0
@@ -0,0 +1,72 @@
1
+ =begin rdoc
2
+
3
+ Gooby - Copyright 2007 by Chris Joakim.
4
+ Gooby is available under GNU General Public License (GPL) license.
5
+
6
+ =end
7
+
8
+ require 'gooby'
9
+ require 'test/unit'
10
+
11
+ class TestClassDelimLine < Test::Unit::TestCase
12
+
13
+ include Gooby::TestHelper
14
+
15
+ @debug = false
16
+
17
+ ### Start of tests. Keep this line - see class TestGenerator.
18
+
19
+ def test_class_DelimLine
20
+
21
+ line = '1 | 2007-01-01 | 16:38:43 | 1167669523 | 2 | 35.49532 | -80.83167 | 242.870 | 0.0313362638280469 '
22
+ dline = Gooby::DelimLine.new(line)
23
+
24
+ expected = 'DelimLine: length: 101 trim: true delim: | tokens: 9'
25
+ actual = dline.to_s
26
+ assert_equal(expected, actual, "to_xml value is not as expected; #{actual} vs #{expected}")
27
+
28
+ expected = '1'
29
+ actual = dline.tokens[0]
30
+ assert_equal(expected, actual, "to_xml value is not as expected; #{actual} vs #{expected}")
31
+
32
+ expected = '16:38:43'
33
+ actual = dline.tokens[2]
34
+ assert_equal(expected, actual, "to_xml value is not as expected; #{actual} vs #{expected}")
35
+
36
+ expected = '0.0313362638280469'
37
+ actual = dline.tokens[-1]
38
+ assert_equal(expected, actual, "to_xml value is not as expected; #{actual} vs #{expected}")
39
+ end
40
+
41
+ def test_class_DelimLine_as_trackpoint
42
+
43
+ line = '6 | 2007-01-13T16:35:53Z | 243 | 35.49517 | -80.83215 | 237.583 | 6.51627221396902 '
44
+ dline = Gooby::DelimLine.new(line)
45
+ tkpt = dline.as_trackpoint(0, 3, 4, 5, 1) # (numIdx, latIdx, lngIdx, altIdx, timeIdx)
46
+ end
47
+
48
+ def test_class_DelimLine_initialize
49
+
50
+ # This method is tested in the other test methods.
51
+ end
52
+
53
+ def test_class_DelimLine_is_comment?
54
+
55
+ dline = Gooby::DelimLine.new('# this is a comment line')
56
+ bool1 = dline.is_comment?
57
+
58
+ dline = Gooby::DelimLine.new('this is not a comment line')
59
+ bool2 = dline.is_comment?
60
+
61
+ dline = Gooby::DelimLine.new(' # this is a comment line')
62
+ bool3 = dline.is_comment?
63
+
64
+ assert(bool1 == true, "line 1 should be a comment")
65
+ assert(bool2 == false, "line 2 not should be a comment")
66
+ assert(bool3 == true, "line 3 should be a comment")
67
+ end
68
+
69
+ def test_class_DelimLine_to_s
70
+
71
+ end
72
+ end
@@ -0,0 +1,129 @@
1
+ =begin rdoc
2
+
3
+ Gooby - Copyright 2007 by Chris Joakim.
4
+ Gooby is available under GNU General Public License (GPL) license.
5
+
6
+ =end
7
+
8
+ require 'gooby'
9
+ require 'test/unit'
10
+
11
+ class TestClassDtTm < Test::Unit::TestCase
12
+
13
+ include Gooby::TestHelper
14
+ include Gooby::Constants
15
+
16
+ @debug = false
17
+
18
+ ### Start of tests. Keep this line - see class TestGenerator.
19
+
20
+ def test_class_DtTm
21
+
22
+ # This class is tested in the methods below.
23
+ end
24
+
25
+ def test_class_DtTm_hh_mm_ss
26
+
27
+ s = '2006-01-15T01:02:00Z'
28
+ dt = Gooby::DtTm.new(s)
29
+ actual = dt.hh_mm_ss
30
+ expected = '01:02:00'
31
+ assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
32
+
33
+ s = '2006-01-15T03:41:40Z'
34
+ dt = Gooby::DtTm.new(s)
35
+ actual = dt.hh_mm_ss
36
+ expected = '03:41:40'
37
+ assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
38
+ end
39
+
40
+ def test_class_DtTm_hhmmss_diff
41
+
42
+ s1 = '2006-01-15T02:39:37Z'
43
+ dt1 = Gooby::DtTm.new(s1)
44
+ s2 = '2006-01-15T03:41:40Z'
45
+ dt2 = Gooby::DtTm.new(s2)
46
+ actual = dt2.hhmmss_diff(dt1)
47
+ expected = '01:02:03'
48
+ assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
49
+ end
50
+
51
+ def test_class_DtTm_initialize
52
+
53
+ dt1 = Gooby::DtTm.new(nil)
54
+ dt2 = Gooby::DtTm.new('too short')
55
+ dt3 = Gooby::DtTm.new('2006-01-15T03:41:40Z')
56
+
57
+ assert(dt1.valid == false, "dt1 should not be valid.")
58
+ assert(dt2.valid == false, "dt2 should not be valid.")
59
+ assert(dt3.valid == true, "dt3 should not be valid.")
60
+ assert(dt1.to_i == invalid_time, "dt1 to_i should be #{invalid_time}.")
61
+
62
+ end
63
+
64
+ # Warning: possible obsolete test method - test_class_DtTm_parse
65
+
66
+ def test_class_DtTm_parse
67
+
68
+ # This method is tested in the other test methods.
69
+ end
70
+
71
+ def test_class_DtTm_print_string
72
+
73
+ dt = Gooby::DtTm.new('2007-02-01T02:13:52Z')
74
+ actual = dt.print_string
75
+ expected = "DtTm: 2007-02-01 02:13:52 1170296032 2007-02-01T02:13:52Z"
76
+ assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
77
+ end
78
+
79
+ def test_class_DtTm_seconds_diff
80
+
81
+ dt1 = Gooby::DtTm.new('2007-02-01T11:59:59Z')
82
+ dt2 = Gooby::DtTm.new('2007-02-01T12:00:00Z')
83
+ dt3 = Gooby::DtTm.new('2007-02-01T13:01:02')
84
+
85
+ actual = dt2.seconds_diff(dt1)
86
+ expected = 1
87
+ assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
88
+
89
+ actual = dt3.seconds_diff(dt1)
90
+ expected = 3663
91
+ assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
92
+
93
+ actual = dt1.seconds_diff(dt3)
94
+ expected = -3663
95
+ assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
96
+ end
97
+
98
+ def test_class_DtTm_to_i
99
+
100
+ dt = Gooby::DtTm.new('2007-02-01T02:13:52Z')
101
+ actual = dt.to_i
102
+ expected = 1170296032
103
+ assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
104
+ end
105
+
106
+ def test_class_DtTm_to_s
107
+
108
+ dt = Gooby::DtTm.new('2007-02-01T02:13:52Z')
109
+ actual = dt.to_s
110
+ expected = "2007-02-01T02:13:52Z"
111
+ assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
112
+ end
113
+
114
+ def test_class_DtTm_yyyy_mm_dd
115
+
116
+ dt = Gooby::DtTm.new('2007-02-01T02:13:52Z')
117
+ actual = dt.yyyy_mm_dd
118
+ expected = "2007-02-01"
119
+ assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
120
+ end
121
+
122
+ def test_class_DtTm_yyyy_mm_dd_hh_mm_ss
123
+
124
+ dt = Gooby::DtTm.new('2007-02-01T02:13:52Z')
125
+ actual = dt.yyyy_mm_dd_hh_mm_ss
126
+ expected = "2007-02-01 02:13:52"
127
+ assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
128
+ end
129
+ end
@@ -0,0 +1,49 @@
1
+ =begin rdoc
2
+
3
+ Gooby - Copyright 2007 by Chris Joakim.
4
+ Gooby is available under GNU General Public License (GPL) license.
5
+
6
+ =end
7
+
8
+ require 'gooby'
9
+ require 'test/unit'
10
+
11
+ class TestClassDuration < Test::Unit::TestCase
12
+
13
+ include Gooby::TestHelper
14
+ include Gooby::Constants
15
+
16
+ @debug = false
17
+
18
+ ### Start of tests. Keep this line - see class TestGenerator.
19
+
20
+ def test_class_Duration
21
+
22
+ d1 = Gooby::Duration.new('PT507.870S')
23
+ s1a = d1.to_s
24
+ s1b = d1.print_string
25
+ actual = s1a
26
+ expected = '08:27.87'
27
+ assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
28
+
29
+ actual = s1b
30
+ expected = 'Duration: 507.870 sec: 507.87 min: 8.4645 mmss: 08:27.87 bm: 8 fm: 0.464499999999999 fs: 27.87'
31
+ assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
32
+ end
33
+
34
+ def test_class_Duration_initialize
35
+
36
+ end
37
+
38
+ def test_class_Duration_print_string
39
+
40
+ end
41
+
42
+ def test_class_Duration_scrub
43
+
44
+ end
45
+
46
+ def test_class_Duration_to_s
47
+
48
+ end
49
+ end
@@ -0,0 +1,68 @@
1
+ =begin rdoc
2
+
3
+ Gooby - Copyright 2007 by Chris Joakim.
4
+ Gooby is available under GNU General Public License (GPL) license.
5
+
6
+ =end
7
+
8
+ require 'gooby'
9
+ require 'test/unit'
10
+
11
+ class TestClassForerunnerXmlParser < Test::Unit::TestCase
12
+
13
+ include Gooby::TestHelper
14
+
15
+ @debug = false
16
+
17
+ ### Start of tests. Keep this line - see class TestGenerator.
18
+
19
+ def test_class_ForerunnerXmlParser
20
+
21
+ end
22
+
23
+ def test_class_ForerunnerXmlParser_detail_tag?
24
+
25
+ end
26
+
27
+ def test_class_ForerunnerXmlParser_dump
28
+
29
+ end
30
+
31
+ def test_class_ForerunnerXmlParser_gdump
32
+
33
+ end
34
+
35
+ def test_class_ForerunnerXmlParser_initialize
36
+
37
+ end
38
+
39
+ def test_class_ForerunnerXmlParser_is_tag?
40
+
41
+ end
42
+
43
+ def test_class_ForerunnerXmlParser_put_all_run_tkpt_csv
44
+
45
+ end
46
+
47
+ def test_class_ForerunnerXmlParser_put_run_csv
48
+
49
+ end
50
+
51
+ def test_class_ForerunnerXmlParser_tag_end
52
+
53
+ end
54
+
55
+ def test_class_ForerunnerXmlParser_tag_start
56
+
57
+ end
58
+
59
+ def test_class_ForerunnerXmlParser_text
60
+
61
+ end
62
+
63
+ # Warning: possible obsolete test method - test_stub
64
+
65
+ def test_stub
66
+
67
+ end
68
+ end
@@ -0,0 +1,69 @@
1
+ =begin rdoc
2
+
3
+ Gooby - Copyright 2007 by Chris Joakim.
4
+ Gooby is available under GNU General Public License (GPL) license.
5
+
6
+ =end
7
+
8
+ require 'gooby'
9
+ require 'test/unit'
10
+
11
+ class TestClassGeoData < Test::Unit::TestCase
12
+
13
+ include Gooby::TestHelper
14
+
15
+ @debug = false
16
+
17
+ ### Start of tests. Keep this line - see class TestGenerator.
18
+
19
+ def test_class_GeoData
20
+
21
+ end
22
+
23
+ def test_class_GeoData_add_poi
24
+
25
+ end
26
+
27
+ def test_class_GeoData_add_route
28
+
29
+ end
30
+
31
+ def test_class_GeoData_add_track
32
+
33
+ end
34
+
35
+ def test_class_GeoData_dump
36
+
37
+ geo = Gooby::GeoData.new(nil)
38
+ geo.dump
39
+ end
40
+
41
+ def test_class_GeoData_initialize
42
+
43
+ geo = Gooby::GeoData.new(nil)
44
+ puts geo.to_s
45
+
46
+ end
47
+
48
+ # Warning: possible obsolete test method - test_class_GeoData_parse
49
+
50
+ def test_class_GeoData_parse
51
+
52
+ end
53
+
54
+ def test_class_GeoData_parse_poi
55
+
56
+ end
57
+
58
+ def test_class_GeoData_parse_routes
59
+
60
+ end
61
+
62
+ def test_class_GeoData_parse_tracks
63
+
64
+ end
65
+
66
+ def test_class_GeoData_to_s
67
+
68
+ end
69
+ end
@@ -0,0 +1,24 @@
1
+ =begin rdoc
2
+
3
+ Gooby - Copyright 2007 by Chris Joakim.
4
+ Gooby is available under GNU General Public License (GPL) license.
5
+
6
+ =end
7
+
8
+ require 'gooby'
9
+ require 'test/unit'
10
+
11
+ class TestClassGoobyObject < Test::Unit::TestCase
12
+
13
+ include Gooby::TestHelper
14
+
15
+ @debug = false
16
+
17
+ ### Start of tests. Keep this line - see class TestGenerator.
18
+
19
+ # Warning: possible obsolete test method - test_stub
20
+
21
+ def test_stub
22
+
23
+ end
24
+ end
@@ -0,0 +1,107 @@
1
+ =begin rdoc
2
+
3
+ Gooby - Copyright 2007 by Chris Joakim.
4
+ Gooby is available under GNU General Public License (GPL) license.
5
+
6
+ =end
7
+
8
+ require 'gooby'
9
+ require 'test/unit'
10
+
11
+ class TestClassGoogleMapGenerator < Test::Unit::TestCase
12
+
13
+ include Gooby::TestHelper
14
+
15
+ @debug = false
16
+
17
+ ### Start of tests. Keep this line - see class TestGenerator.
18
+
19
+ def test_class_GoogleMapGenerator
20
+
21
+ end
22
+
23
+ def test_class_GoogleMapGenerator_compute_center_point
24
+
25
+ end
26
+
27
+ def test_class_GoogleMapGenerator_filter_trackpoints
28
+
29
+ end
30
+
31
+ def test_class_GoogleMapGenerator_generate
32
+
33
+ gen = Gooby::GoogleMapGenerator.new('data/phx.csv')
34
+ content_hash = gen.generate(nil)
35
+ #content_hash.keys.sort.each { | key | puts key }
36
+
37
+ s = <<HERE
38
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
39
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
40
+ <html xmlns="http://www.w3.org/1999/xhtml">
41
+ <head>
42
+ <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
43
+ <title> Google Map by Gooby </title>
44
+ #{content_hash['key_js']}
45
+ #{content_hash['main_js_start']}
46
+ #{content_hash['main_js_route_overlay']}
47
+ #{content_hash['main_js_checkpoint_overlays']}
48
+ #{content_hash['main_js_map_clicked_listeners']}
49
+ #{content_hash['main_js_end']}
50
+ </head>
51
+ <body onload="load()" onunload="GUnload()">
52
+ <center>
53
+ <h3> #{content_hash['title']} </h3>
54
+ <h5> Generated by Gooby #{content_hash['when_generated']} <br> Gooby = Google APIs + Ruby </h5>
55
+ #{content_hash['map_div']}
56
+ #{content_hash['messages_div']}
57
+ </center>
58
+ </body>
59
+ </html>
60
+ HERE
61
+
62
+ html_file = File.new("zgen_gmap.html", "w")
63
+ html_file.write(s)
64
+ html_file.flush
65
+ html_file.close
66
+ end
67
+
68
+ def test_class_GoogleMapGenerator_generate_key_js
69
+
70
+ end
71
+
72
+ def test_class_GoogleMapGenerator_generate_main_js_checkpoint_overlays
73
+
74
+ end
75
+
76
+ def test_class_GoogleMapGenerator_generate_main_js_end
77
+
78
+ end
79
+
80
+ def test_class_GoogleMapGenerator_generate_main_js_map_clicked_listeners
81
+
82
+ end
83
+
84
+ def test_class_GoogleMapGenerator_generate_main_js_route_overlay
85
+
86
+ end
87
+
88
+ def test_class_GoogleMapGenerator_generate_main_js_start
89
+
90
+ end
91
+
92
+ def test_class_GoogleMapGenerator_generate_map_div
93
+
94
+ end
95
+
96
+ def test_class_GoogleMapGenerator_generate_messages_div
97
+
98
+ end
99
+
100
+ def test_class_GoogleMapGenerator_generate_page
101
+
102
+ end
103
+
104
+ def test_class_GoogleMapGenerator_initialize
105
+
106
+ end
107
+ end