gooby 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README +242 -0
- data/bin/example_usage.rb +38 -0
- data/bin/tests_gen.rb +16 -0
- data/data/20050305_corporate_cup_hm.csv +251 -0
- data/data/20050305_corporate_cup_hm.xml +2208 -0
- data/data/20050430_nashville_marathon.csv +1208 -0
- data/data/20050430_nashville_marathon.xml +10043 -0
- data/data/20051119_dowd_ymca_hm.csv +251 -0
- data/data/20051119_dowd_ymca_hm.xml +2210 -0
- data/data/20051124_hyatt_turkey_trot_8K.csv +321 -0
- data/data/20051124_hyatt_turkey_trot_8K.xml +2651 -0
- data/data/2007_03_03.tcx +6207 -0
- data/data/forerunner_2007.xml +259014 -0
- data/data/geo_data.txt +171 -0
- data/data/phx.csv +1280 -0
- data/data/phx.xml +10620 -0
- data/data/run_2007_01_01_16_38_27.xml +2020 -0
- data/data/run_2007_01_06_15_27_31.xml +2020 -0
- data/data/run_2007_01_10_12_25_47.xml +820 -0
- data/data/run_2007_01_10_22_44_54.csv +112 -0
- data/data/run_2007_01_10_22_44_54.xml +908 -0
- data/data/run_2007_01_11_10_48_45.xml +1292 -0
- data/data/run_2007_01_13_15_37_06.xml +1964 -0
- data/data/run_2007_01_14_15_46_02.xml +1368 -0
- data/data/run_2007_01_15_14_01_48.xml +1868 -0
- data/data/run_2007_01_20_16_22_05.xml +1702 -0
- data/data/run_2007_01_27_17_32_13.xml +3626 -0
- data/data/run_2007_01_28_19_14_52.xml +2538 -0
- data/data/run_2007_02_03_14_30_20.xml +2016 -0
- data/data/run_2007_02_04_18_02_30.xml +1476 -0
- data/data/run_2007_02_17_16_29_35.xml +1236 -0
- data/data/run_2007_02_19_14_44_33.xml +1816 -0
- data/data/run_2007_02_23_15_53_55.xml +36 -0
- data/data/run_2007_02_23_15_55_20.xml +1296 -0
- data/data/run_2007_02_24_15_01_35.csv +484 -0
- data/data/run_2007_02_24_15_01_35.xml +3884 -0
- data/data/test1.txt +4 -0
- data/img/gicons/blank.png +0 -0
- data/img/gicons/dd-end.png +0 -0
- data/img/gicons/dd-start.png +0 -0
- data/img/gicons/marker.png +0 -0
- data/img/gicons/marker0.png +0 -0
- data/img/gicons/marker00.png +0 -0
- data/img/gicons/marker01.png +0 -0
- data/img/gicons/marker02.png +0 -0
- data/img/gicons/marker03.png +0 -0
- data/img/gicons/marker04.png +0 -0
- data/img/gicons/marker05.png +0 -0
- data/img/gicons/marker06.png +0 -0
- data/img/gicons/marker07.png +0 -0
- data/img/gicons/marker08.png +0 -0
- data/img/gicons/marker09.png +0 -0
- data/img/gicons/marker1.png +0 -0
- data/img/gicons/marker10.png +0 -0
- data/img/gicons/marker11.png +0 -0
- data/img/gicons/marker12.png +0 -0
- data/img/gicons/marker13.png +0 -0
- data/img/gicons/marker14.png +0 -0
- data/img/gicons/marker15.png +0 -0
- data/img/gicons/marker16.png +0 -0
- data/img/gicons/marker17.png +0 -0
- data/img/gicons/marker18.png +0 -0
- data/img/gicons/marker19.png +0 -0
- data/img/gicons/marker2.png +0 -0
- data/img/gicons/marker20.png +0 -0
- data/img/gicons/marker21.png +0 -0
- data/img/gicons/marker22.png +0 -0
- data/img/gicons/marker23.png +0 -0
- data/img/gicons/marker24.png +0 -0
- data/img/gicons/marker25.png +0 -0
- data/img/gicons/marker26.png +0 -0
- data/img/gicons/marker27.png +0 -0
- data/img/gicons/marker28.png +0 -0
- data/img/gicons/marker29.png +0 -0
- data/img/gicons/marker3.png +0 -0
- data/img/gicons/marker30.png +0 -0
- data/img/gicons/marker31.png +0 -0
- data/img/gicons/marker32.png +0 -0
- data/img/gicons/marker33.png +0 -0
- data/img/gicons/marker34.png +0 -0
- data/img/gicons/marker35.png +0 -0
- data/img/gicons/marker36.png +0 -0
- data/img/gicons/marker37.png +0 -0
- data/img/gicons/marker38.png +0 -0
- data/img/gicons/marker39.png +0 -0
- data/img/gicons/marker4.png +0 -0
- data/img/gicons/marker40.png +0 -0
- data/img/gicons/marker41.png +0 -0
- data/img/gicons/marker42.png +0 -0
- data/img/gicons/marker43.png +0 -0
- data/img/gicons/marker44.png +0 -0
- data/img/gicons/marker45.png +0 -0
- data/img/gicons/marker46.png +0 -0
- data/img/gicons/marker47.png +0 -0
- data/img/gicons/marker48.png +0 -0
- data/img/gicons/marker49.png +0 -0
- data/img/gicons/marker5.png +0 -0
- data/img/gicons/marker50.png +0 -0
- data/img/gicons/marker51.png +0 -0
- data/img/gicons/marker52.png +0 -0
- data/img/gicons/marker53.png +0 -0
- data/img/gicons/marker54.png +0 -0
- data/img/gicons/marker55.png +0 -0
- data/img/gicons/marker56.png +0 -0
- data/img/gicons/marker57.png +0 -0
- data/img/gicons/marker58.png +0 -0
- data/img/gicons/marker59.png +0 -0
- data/img/gicons/marker6.png +0 -0
- data/img/gicons/marker60.png +0 -0
- data/img/gicons/marker61.png +0 -0
- data/img/gicons/marker62.png +0 -0
- data/img/gicons/marker63.png +0 -0
- data/img/gicons/marker64.png +0 -0
- data/img/gicons/marker65.png +0 -0
- data/img/gicons/marker66.png +0 -0
- data/img/gicons/marker67.png +0 -0
- data/img/gicons/marker68.png +0 -0
- data/img/gicons/marker69.png +0 -0
- data/img/gicons/marker7.png +0 -0
- data/img/gicons/marker70.png +0 -0
- data/img/gicons/marker71.png +0 -0
- data/img/gicons/marker72.png +0 -0
- data/img/gicons/marker73.png +0 -0
- data/img/gicons/marker74.png +0 -0
- data/img/gicons/marker75.png +0 -0
- data/img/gicons/marker76.png +0 -0
- data/img/gicons/marker77.png +0 -0
- data/img/gicons/marker78.png +0 -0
- data/img/gicons/marker79.png +0 -0
- data/img/gicons/marker8.png +0 -0
- data/img/gicons/marker80.png +0 -0
- data/img/gicons/marker81.png +0 -0
- data/img/gicons/marker82.png +0 -0
- data/img/gicons/marker83.png +0 -0
- data/img/gicons/marker84.png +0 -0
- data/img/gicons/marker85.png +0 -0
- data/img/gicons/marker86.png +0 -0
- data/img/gicons/marker87.png +0 -0
- data/img/gicons/marker88.png +0 -0
- data/img/gicons/marker89.png +0 -0
- data/img/gicons/marker9.png +0 -0
- data/img/gicons/marker90.png +0 -0
- data/img/gicons/marker91.png +0 -0
- data/img/gicons/marker92.png +0 -0
- data/img/gicons/marker93.png +0 -0
- data/img/gicons/marker94.png +0 -0
- data/img/gicons/marker95.png +0 -0
- data/img/gicons/marker96.png +0 -0
- data/img/gicons/marker97.png +0 -0
- data/img/gicons/marker98.png +0 -0
- data/img/gicons/marker99.png +0 -0
- data/img/gicons/markerA.png +0 -0
- data/img/gicons/markerB.png +0 -0
- data/img/gicons/markerC.png +0 -0
- data/img/gicons/markerD.png +0 -0
- data/img/gicons/markerE.png +0 -0
- data/img/gicons/markerF.png +0 -0
- data/img/gicons/markerG.png +0 -0
- data/img/gicons/markerH.png +0 -0
- data/img/gicons/markerI.png +0 -0
- data/img/gicons/markerJ.png +0 -0
- data/img/gicons/mm_20_red.png +0 -0
- data/img/gicons/mm_20_shadow.png +0 -0
- data/img/gicons/readme.txt +11 -0
- data/img/gicons/shadow50.png +0 -0
- data/lib/gooby/cls_counter_hash.rb +78 -0
- data/lib/gooby/cls_delim_line.rb +35 -0
- data/lib/gooby/cls_dttm.rb +79 -0
- data/lib/gooby/cls_duration.rb +79 -0
- data/lib/gooby/cls_forerunner_xml_parser.rb +178 -0
- data/lib/gooby/cls_forerunner_xml_splitter.rb +109 -0
- data/lib/gooby/cls_geo_data.rb +181 -0
- data/lib/gooby/cls_gooby_command.rb +35 -0
- data/lib/gooby/cls_gooby_object.rb +18 -0
- data/lib/gooby/cls_google_map_generator.rb +363 -0
- data/lib/gooby/cls_history.rb +33 -0
- data/lib/gooby/cls_lap.rb +22 -0
- data/lib/gooby/cls_line.rb +75 -0
- data/lib/gooby/cls_options.rb +67 -0
- data/lib/gooby/cls_position.rb +44 -0
- data/lib/gooby/cls_run.rb +194 -0
- data/lib/gooby/cls_simple_xml_parser.rb +41 -0
- data/lib/gooby/cls_test_regen.rb +182 -0
- data/lib/gooby/cls_track.rb +47 -0
- data/lib/gooby/cls_trackpoint.rb +200 -0
- data/lib/gooby/mod_introspect.rb +26 -0
- data/lib/gooby/mod_io.rb +58 -0
- data/lib/gooby/mod_project_info.rb +80 -0
- data/lib/gooby/mod_string.rb +19 -0
- data/lib/gooby/mod_test_helper.rb +15 -0
- data/lib/gooby.rb +2265 -0
- data/pkg/code_header.txt +21 -0
- data/pkg/pkg.rb +236 -0
- data/pkg/test_header.txt +19 -0
- data/samples/20041113_richmond_marathon.html +532 -0
- data/samples/20050305_corporate_cup_hm.html +448 -0
- data/samples/20050430_nashville_marathon.html +530 -0
- data/samples/gps_point_capture.html +54 -0
- data/samples/phoenix_marathon.html +542 -0
- data/samples/run_2007_01_10_22_44_54.html +201 -0
- data/samples/run_2007_02_24_15_01_35.html +298 -0
- data/tests/tc_cls_counter_hash.rb +107 -0
- data/tests/tc_cls_delim_line.rb +74 -0
- data/tests/tc_cls_dttm.rb +131 -0
- data/tests/tc_cls_duration.rb +51 -0
- data/tests/tc_cls_forerunner_xml_parser.rb +70 -0
- data/tests/tc_cls_geo_data.xxx +71 -0
- data/tests/tc_cls_gooby_object.rb +26 -0
- data/tests/tc_cls_google_map_generator.rb +109 -0
- data/tests/tc_cls_history.rb +46 -0
- data/tests/tc_cls_lap.rb +38 -0
- data/tests/tc_cls_line.rb +110 -0
- data/tests/tc_cls_options.rb +79 -0
- data/tests/tc_cls_position.rb +66 -0
- data/tests/tc_cls_run.rb +142 -0
- data/tests/tc_cls_simple_xml_parser.rb +50 -0
- data/tests/tc_cls_track.rb +70 -0
- data/tests/tc_cls_trackpoint.rb +145 -0
- data/tests/tc_mod_introspect.rb +32 -0
- data/tests/tc_mod_io.rb +53 -0
- data/tests/tc_mod_project_info.rb +79 -0
- data/tests/tc_mod_string.rb +58 -0
- data/tests/ts_gooby.rb +1237 -0
- metadata +270 -0
data/pkg/code_header.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
This file contains the classes and modules for the Gooby project.
|
4
|
+
Gooby = Google APIs + Ruby
|
5
|
+
|
6
|
+
See file 'tests/ts_gooby.rb' for the regression test suite.
|
7
|
+
|
8
|
+
Gooby - Copyright 2007 by Chris Joakim.
|
9
|
+
Gooby is available under GNU General Public License (GPL) license.
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'find'
|
15
|
+
require 'rbconfig'
|
16
|
+
require 'rexml/document'
|
17
|
+
require 'rexml/streamlistener'
|
18
|
+
require 'time'
|
19
|
+
require 'yaml'
|
20
|
+
|
21
|
+
module Gooby
|
data/pkg/pkg.rb
ADDED
@@ -0,0 +1,236 @@
|
|
1
|
+
=begin rdoc
|
2
|
+
|
3
|
+
This class is used to merge/bundle the source code and test code for a ruby
|
4
|
+
project to enable it to packaged as a "simplified" gem with few *.rb files
|
5
|
+
and no LOAD_PATH subdirectory dependencies.
|
6
|
+
|
7
|
+
One source code file, 'lib/[project_name].rb' will be created from the
|
8
|
+
concatinated contents of the 'cls_*.rb' and 'mod_*.rb' files in the
|
9
|
+
'lib/[project_name]' directory beneath your project root directory.
|
10
|
+
The contents of file 'pkg/code_header.txt' will be prepended to this merged
|
11
|
+
code content.
|
12
|
+
|
13
|
+
Likewise, one source code file, 'tests/ts_[project_name].rb' will be created
|
14
|
+
from the concatinated contents of the 'tc_*.rb' files in the 'tests'
|
15
|
+
directory beneath your project root directory. The contents of file
|
16
|
+
'pkg/test_header.txt' will be prepended to this merged test content.
|
17
|
+
|
18
|
+
Credit to DHH and others who popularized the concept of "convention over
|
19
|
+
configuration".
|
20
|
+
|
21
|
+
Command line:
|
22
|
+
> ruby pkg/pkg.rb [project_name]
|
23
|
+
|
24
|
+
[project_name] is an optional arg, as the current implementation deduces the
|
25
|
+
project name by identifying the first directory not named 'CVS' beneath the
|
26
|
+
'lib' directory.
|
27
|
+
|
28
|
+
Gooby - Copyright 2007 by Chris Joakim.
|
29
|
+
Gooby is available under GNU General Public License (GPL) license.
|
30
|
+
|
31
|
+
=end
|
32
|
+
|
33
|
+
module Gooby
|
34
|
+
|
35
|
+
class Pkg
|
36
|
+
|
37
|
+
def initialize
|
38
|
+
|
39
|
+
if ARGV.size > 0
|
40
|
+
@proj_name = ARGV[0]
|
41
|
+
else
|
42
|
+
@proj_name = deduce_proj_name
|
43
|
+
end
|
44
|
+
puts "project name is: #{@proj_name}"
|
45
|
+
|
46
|
+
@code_lines = IO.readlines('pkg/code_header.txt')
|
47
|
+
puts "code_header.txt lines = #{@code_lines.size}"
|
48
|
+
@code_files = code_files_list
|
49
|
+
puts "code file count: #{@code_files.size}"
|
50
|
+
@code_files.each do |name|
|
51
|
+
file_lines = read_file("lib/#{@proj_name}/#{name}")
|
52
|
+
@code_lines << file_lines
|
53
|
+
end
|
54
|
+
@code_lines << "end # end of module"
|
55
|
+
|
56
|
+
@test_lines = IO.readlines('pkg/test_header.txt')
|
57
|
+
@test_files = test_files_list
|
58
|
+
puts "test file count: #{@test_files.size}"
|
59
|
+
@test_files.each do |name|
|
60
|
+
file_lines = read_file("tests/#{name}")
|
61
|
+
@test_lines << file_lines
|
62
|
+
end
|
63
|
+
|
64
|
+
write_file("lib/#{@proj_name}.rb", @code_lines)
|
65
|
+
write_file("tests/ts_#{@proj_name}.rb", @test_lines)
|
66
|
+
end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
def deduce_proj_name
|
71
|
+
list = Dir.glob("lib/*")
|
72
|
+
list.each do |name|
|
73
|
+
if name =~ /CVS/
|
74
|
+
elsif
|
75
|
+
name =~ /\./
|
76
|
+
else
|
77
|
+
name.gsub!('/', ' ')
|
78
|
+
tokens = name.split
|
79
|
+
return tokens[-1]
|
80
|
+
end
|
81
|
+
end
|
82
|
+
return 'unable_to_deduce_project_name'
|
83
|
+
end
|
84
|
+
|
85
|
+
def list_files(dir_name, type)
|
86
|
+
subset = Array.new
|
87
|
+
list = Dir.glob(dir_name)
|
88
|
+
list.each do |name|
|
89
|
+
matched = false
|
90
|
+
matched = true if ((type == 'code') && (name =~ /\/cls_/) && (name =~ /.rb$/))
|
91
|
+
matched = true if ((type == 'code') && (name =~ /\/mod_/) && (name =~ /.rb$/))
|
92
|
+
matched = true if ((type == 'test') && (name =~ /\/tc_/) && (name =~ /.rb$/))
|
93
|
+
#puts "#{name} #{matched}"
|
94
|
+
if matched
|
95
|
+
name.gsub!('/', ' ')
|
96
|
+
tokens = name.split
|
97
|
+
subset << tokens[-1]
|
98
|
+
end
|
99
|
+
end
|
100
|
+
subset
|
101
|
+
end
|
102
|
+
|
103
|
+
def read_file(filename)
|
104
|
+
raw_array = IO.readlines(filename)
|
105
|
+
filtered_array = Array.new
|
106
|
+
in_zone = false
|
107
|
+
raw_array.each { |line|
|
108
|
+
if line =~ /^end # end of module/
|
109
|
+
in_zone = false
|
110
|
+
end
|
111
|
+
if line =~ /^end # end of class/
|
112
|
+
in_zone = false
|
113
|
+
end
|
114
|
+
if in_zone
|
115
|
+
filtered_array << line
|
116
|
+
end
|
117
|
+
if line =~ /^module Gooby/
|
118
|
+
in_zone = true
|
119
|
+
end
|
120
|
+
if line =~ /Test::Unit::TestCase/
|
121
|
+
filtered_array << "\n"
|
122
|
+
filtered_array << line
|
123
|
+
in_zone = true
|
124
|
+
end
|
125
|
+
|
126
|
+
}
|
127
|
+
filtered_array
|
128
|
+
end
|
129
|
+
|
130
|
+
def write_file(name, lines)
|
131
|
+
out = File.new name, "w+"
|
132
|
+
out.write "# Packaged on #{Time.now} \n\n"
|
133
|
+
lines.each { |line| out.write line }
|
134
|
+
out.flush
|
135
|
+
out.close
|
136
|
+
puts "File written: #{name}"
|
137
|
+
end
|
138
|
+
|
139
|
+
def code_files_list
|
140
|
+
%w(
|
141
|
+
mod_project_info.rb
|
142
|
+
mod_constants.rb
|
143
|
+
mod_introspect.rb
|
144
|
+
mod_io.rb
|
145
|
+
mod_string.rb
|
146
|
+
mod_test_helper.rb
|
147
|
+
|
148
|
+
cls_gooby_object.rb
|
149
|
+
cls_counter_hash.rb
|
150
|
+
cls_delim_line.rb
|
151
|
+
cls_dttm.rb
|
152
|
+
cls_duration.rb
|
153
|
+
cls_forerunner_xml_parser.rb
|
154
|
+
cls_forerunner_xml_splitter.rb
|
155
|
+
cls_geo_data.rb
|
156
|
+
cls_google_map_generator.rb
|
157
|
+
cls_history.rb
|
158
|
+
cls_lap.rb
|
159
|
+
cls_line.rb
|
160
|
+
cls_options.rb
|
161
|
+
cls_position.rb
|
162
|
+
cls_run.rb
|
163
|
+
cls_simple_xml_parser.rb
|
164
|
+
cls_test_regen.rb
|
165
|
+
cls_track.rb
|
166
|
+
cls_trackpoint.rb
|
167
|
+
cls_gooby_command.rb
|
168
|
+
)
|
169
|
+
end
|
170
|
+
|
171
|
+
def test_files_list
|
172
|
+
|
173
|
+
%w(
|
174
|
+
tc_mod_constants.rb
|
175
|
+
tc_mod_introspect.rb
|
176
|
+
tc_mod_project_info.rb
|
177
|
+
tc_mod_string.rb
|
178
|
+
tc_mod_io.rb
|
179
|
+
|
180
|
+
tc_cls_counter_hash.rb
|
181
|
+
tc_cls_delim_line.rb
|
182
|
+
tc_cls_dttm.rb
|
183
|
+
|
184
|
+
tc_cls_duration.rb
|
185
|
+
tc_cls_forerunner_xml_parser.rb
|
186
|
+
tc_cls_gooby_object.rb
|
187
|
+
|
188
|
+
tc_cls_history.rb
|
189
|
+
tc_cls_lap.rb
|
190
|
+
tc_cls_line.rb
|
191
|
+
|
192
|
+
tc_cls_position.rb
|
193
|
+
tc_cls_run.rb
|
194
|
+
tc_cls_simple_xml_parser.rb
|
195
|
+
tc_cls_track.rb
|
196
|
+
tc_cls_trackpoint.rb
|
197
|
+
)
|
198
|
+
end
|
199
|
+
|
200
|
+
|
201
|
+
def test_files_list_old
|
202
|
+
|
203
|
+
%w(
|
204
|
+
tc_mod_constants.rb
|
205
|
+
tc_mod_introspect.rb
|
206
|
+
|
207
|
+
tc_mod_project_info.rb
|
208
|
+
tc_mod_string.rb
|
209
|
+
|
210
|
+
tc_cls_counter_hash.rb
|
211
|
+
tc_cls_delim_line.rb
|
212
|
+
tc_cls_dttm.rb
|
213
|
+
|
214
|
+
tc_cls_duration.rb
|
215
|
+
tc_cls_forerunner_xml_parser.rb
|
216
|
+
tc_cls_gooby_object.rb
|
217
|
+
|
218
|
+
tc_cls_google_map_generator.rb
|
219
|
+
|
220
|
+
tc_cls_history.rb
|
221
|
+
tc_cls_lap.rb
|
222
|
+
tc_cls_line.rb
|
223
|
+
|
224
|
+
tc_cls_options.rb
|
225
|
+
tc_cls_position.rb
|
226
|
+
tc_cls_run.rb
|
227
|
+
tc_cls_simple_xml_parser.rb
|
228
|
+
tc_cls_track.rb
|
229
|
+
tc_cls_trackpoint.rb
|
230
|
+
)
|
231
|
+
end
|
232
|
+
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
merger = Gooby::Pkg.new
|
data/pkg/test_header.txt
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
This contains the regression test suite for the Gooby project.
|
4
|
+
|
5
|
+
See file 'lib/gooby.rb' which is the subject of this test suite.
|
6
|
+
|
7
|
+
Gooby - Copyright 2007 by Chris Joakim.
|
8
|
+
Gooby is available under GNU General Public License (GPL) license.
|
9
|
+
|
10
|
+
=end
|
11
|
+
|
12
|
+
# The following prefixes ../lib to the active ruby load path
|
13
|
+
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
14
|
+
puts '$LOAD_PATH is now:'
|
15
|
+
puts $LOAD_PATH
|
16
|
+
|
17
|
+
require 'gooby'
|
18
|
+
require 'test/unit'
|
19
|
+
|