gooby 0.9.3 → 0.9.4
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.
- data/README +96 -43
- data/bin/example_usage.rb +15 -6
- data/bin/tcx_ex.rb +35 -0
- data/data/2007_03_04.tcx +16751 -0
- data/data/activity_2007_03_04_15_22_36.xml +10545 -0
- data/lib/gooby/cls_gooby_command.rb +14 -3
- data/lib/gooby/cls_training_center_parser.rb +183 -0
- data/lib/gooby/cls_training_center_splitter.rb +109 -0
- data/lib/gooby/mod_project_info.rb +1 -1
- data/lib/gooby.rb +303 -5
- data/pkg/pkg.rb +2 -0
- data/tests/tc_mod_project_info.rb +1 -1
- data/tests/ts_gooby.rb +2 -2
- metadata +7 -21
- data/data/20051119_dowd_ymca_hm.csv +0 -251
- data/data/20051119_dowd_ymca_hm.xml +0 -2210
- data/data/run_2007_01_06_15_27_31.xml +0 -2020
- data/data/run_2007_01_10_12_25_47.xml +0 -820
- data/data/run_2007_01_10_22_44_54.csv +0 -112
- data/data/run_2007_01_10_22_44_54.xml +0 -908
- data/data/run_2007_01_11_10_48_45.xml +0 -1292
- data/data/run_2007_01_13_15_37_06.xml +0 -1964
- data/data/run_2007_01_14_15_46_02.xml +0 -1368
- data/data/run_2007_01_15_14_01_48.xml +0 -1868
- data/data/run_2007_01_20_16_22_05.xml +0 -1702
- data/data/run_2007_01_27_17_32_13.xml +0 -3626
- data/data/run_2007_01_28_19_14_52.xml +0 -2538
- data/data/run_2007_02_03_14_30_20.xml +0 -2016
- data/data/run_2007_02_04_18_02_30.xml +0 -1476
- data/data/run_2007_02_17_16_29_35.xml +0 -1236
- data/data/run_2007_02_19_14_44_33.xml +0 -1816
- data/data/run_2007_02_23_15_53_55.xml +0 -36
- data/data/run_2007_02_23_15_55_20.xml +0 -1296
    
        data/README
    CHANGED
    
    | @@ -1,19 +1,29 @@ | |
| 1 1 | 
             
            = Gooby -- Google APIs + Ruby 
         | 
| 2 2 |  | 
| 3 | 
            -
            Version: 0.9. | 
| 3 | 
            +
            Version: 0.9.4
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            RubyForge Release Notes:
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            Gooby = Google APIs + Ruby.
         | 
| 8 | 
            +
            This release adds support for Garmin TrainingCenter TCX XML files, created by 
         | 
| 9 | 
            +
            the newer Garmin devices such as models 205 and 305.  For an example of a Google Map
         | 
| 10 | 
            +
            created with Gooby, see http://www.joakimsoftware.com/gmap/phoenix_marathon.html
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            ---
         | 
| 4 13 |  | 
| 5 14 | 
             
            This package contains 'Gooby', a set of Ruby code to assist you with using and
         | 
| 6 | 
            -
            producing content for the various Google APIs.  The initial focus of  | 
| 7 | 
            -
             | 
| 15 | 
            +
            producing content for the various Google APIs.  The initial focus of Gooby is 
         | 
| 16 | 
            +
            on the Google Maps API, version 2.0.  
         | 
| 8 17 |  | 
| 9 | 
            -
            Google Maps can be produced using Gooby from  | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 18 | 
            +
            Google Maps can be produced using Gooby from your data in CSV format, 
         | 
| 19 | 
            +
            as created in one of the following three ways.
         | 
| 20 | 
            +
            1)  From exported and parsed Garmin ForerunnerLogbook XML files.
         | 
| 21 | 
            +
            2)  From exported and parsed Garmin TrainingCenter TCX(XML) files.
         | 
| 22 | 
            +
            3)  From your own manually edited Global Positioning System (GPS) data.
         | 
| 23 | 
            +
                See any of the 'data/*.csv' files in the distribution for an example
         | 
| 24 | 
            +
                of the CSV format. 
         | 
| 12 25 |  | 
| 13 | 
            -
            Support for Garmin TrainingCenter *.tcx files  | 
| 14 | 
            -
            The exported XML file formats from Garmin ForerunnerLogbook and Garmin
         | 
| 15 | 
            -
            TrainingCenter are different, yet altering the Gooby parsing code shouldn't
         | 
| 16 | 
            -
            require a major effort.
         | 
| 26 | 
            +
            Support for Garmin TrainingCenter *.tcx files was added in the 0.9.4 release.
         | 
| 17 27 |  | 
| 18 28 | 
             
            Google maps are applicable really to any outdoor activity for which GPS data 
         | 
| 19 29 | 
             
            can be obtained.  The focus of Gooby is on running, because the author is a 
         | 
| @@ -23,11 +33,11 @@ methods are running oriented (ex. - Run, Track, Trackpoint, pace, distance, | |
| 23 33 | 
             
            etc).
         | 
| 24 34 |  | 
| 25 35 | 
             
            Other activities, such as cycling, hiking, walking, driving, and even golfing
         | 
| 26 | 
            -
            are also well suited for Gooby.  Given a waterproof GPS receiver, sailing and 
         | 
| 36 | 
            +
            are also well suited for Gooby.  Given a waterproof GPS receiver, sailing, and 
         | 
| 27 37 | 
             
            swimming Google Maps can also be created with Gooby.  Please let me know how
         | 
| 28 38 | 
             
            you use Gooby!
         | 
| 29 39 |  | 
| 30 | 
            -
            All Gooby 0.9. | 
| 40 | 
            +
            All Gooby 0.9.4 functionality is intended to be invoked from a command line.  
         | 
| 31 41 | 
             
            Web and Rails integration may be done in a later release.
         | 
| 32 42 |  | 
| 33 43 | 
             
            See the Goals/Requirements and Usage sections below for the complete list of
         | 
| @@ -124,6 +134,12 @@ See file 'bin/example_usage.rb' in the gem distribution.  Most of this file | |
| 124 134 | 
             
            is shown below.  You will probably have to change the input filenames (yaml, 
         | 
| 125 135 | 
             
            xml, csv) to your own filenames on your computer.
         | 
| 126 136 |  | 
| 137 | 
            +
            Of course, you'll also have to obtain a Google Maps key for your web site.
         | 
| 138 | 
            +
            It's free, and has to be included in every page which displays a map.  See
         | 
| 139 | 
            +
            the 'gmap_key' entry in 'gooby_options.yaml', which embeds your key value 
         | 
| 140 | 
            +
            into the generated html page.  Also see the Google Maps API site - 
         | 
| 141 | 
            +
            http://www.google.com/apis/maps/
         | 
| 142 | 
            +
             | 
| 127 143 | 
             
            	require 'gooby'
         | 
| 128 144 |  | 
| 129 145 | 
             
            	include REXML
         | 
| @@ -141,66 +157,103 @@ xml, csv) to your own filenames on your computer. | |
| 141 157 | 
             
            	v = options.get(n)
         | 
| 142 158 | 
             
            	puts "option '#{n}' = #{v}"
         | 
| 143 159 |  | 
| 144 | 
            -
            	# Split a large ForerunnerLogbook XML file into individual  | 
| 160 | 
            +
            	# Split a large Garmin ForerunnerLogbook XML file into individual 'run' files.
         | 
| 145 161 | 
             
            	# In this example, '/temp' is the output directory.
         | 
| 146 | 
            -
            	gooby. | 
| 162 | 
            +
            	gooby.split_garmin_forerunner_logbook_xml('data/forerunner_2007.xml', '/temp') 
         | 
| 163 | 
            +
             | 
| 164 | 
            +
            	# Split a large Garmin TrainingCenter TCX(XML) file into individual 'activity' files.
         | 
| 165 | 
            +
            	gooby.split_garmin_training_center_xml('data/2007_03_04.tcx', '/temp') 
         | 
| 147 166 |  | 
| 148 | 
            -
            	# Parse a ForerunnerLogbook XML file, or 'split' subset, into CSV.
         | 
| 167 | 
            +
            	# Parse a Garmin ForerunnerLogbook XML file, or previously 'split' subset, into CSV.
         | 
| 149 168 | 
             
            	# You may want to redirect this output to a file.
         | 
| 150 | 
            -
            	gooby. | 
| 169 | 
            +
            	gooby.parse_garmin_forerunner_logbook_xml 'data/run_2007_01_01_16_38_27.xml' 
         | 
| 170 | 
            +
             | 
| 171 | 
            +
            	# Parse a TrainingCenter TCX(XML) file, or previously 'split' subset, into CSV.
         | 
| 172 | 
            +
            	gooby.parse_garmin_training_center_xml 'data/activity_2007_03_04_15_22_36.xml'  
         | 
| 151 173 |  | 
| 152 174 | 
             
            	# Generate a Google Map from your CSV file data, and the Options per
         | 
| 153 | 
            -
            	# your yaml file.  
         | 
| 154 | 
            -
            	gooby.generate_google_map('data/phx.csv', options)
         | 
| 175 | 
            +
            	# your yaml file.  You may also wish to redirect this output to a file.
         | 
| 176 | 
            +
            	gooby.generate_google_map('data/phx.csv', options)  
         | 
| 155 177 |  | 
| 156 178 |  | 
| 157 179 | 
             
            == Goals / Requirements 
         | 
| 158 180 |  | 
| 159 181 | 
             
            === Functional Requirements
         | 
| 160 182 |  | 
| 161 | 
            -
            f1.   Provide the ability to parse exported XML data from  | 
| 162 | 
            -
                   | 
| 163 | 
            -
                   | 
| 164 | 
            -
                  more | 
| 183 | 
            +
            f1.   Provide the ability to parse exported XML GPS data files from the Garmin
         | 
| 184 | 
            +
                  ForerunnerLogbook software.  ForerunnerLogbook is used in conjunction
         | 
| 185 | 
            +
                  with the Garmin Forerunner 201 GPS receiver.  Parse the XML into less-
         | 
| 186 | 
            +
                  verbose and more readable and editable CSV format.
         | 
| 187 | 
            +
             | 
| 188 | 
            +
                  status = complete
         | 
| 189 | 
            +
             | 
| 190 | 
            +
            f2.   Provide the ability to parse exported XML GPS data files from the Garmin
         | 
| 191 | 
            +
                  TrainingCenter software.  TrainingCenter is used in conjunction with
         | 
| 192 | 
            +
                  newer Garmin GPS receivers, such as model 205 and 305.  Parse the TCX
         | 
| 193 | 
            +
                  file (XML format) into less-verbose and more readable and editable CSV
         | 
| 194 | 
            +
                  format.
         | 
| 195 | 
            +
             | 
| 196 | 
            +
                  status = complete
         | 
| 197 | 
            +
            	
         | 
| 198 | 
            +
            f3.   Provide the ability to "split" a large Garmin ForerunnerLogbook XML file
         | 
| 199 | 
            +
                  containing many "runs" into individual "run_" files.  The individual 
         | 
| 200 | 
            +
                  files can then be processed separately, and can optionally be stored in 
         | 
| 201 | 
            +
                  your personal records directory or source control system.
         | 
| 165 202 |  | 
| 166 | 
            -
             | 
| 167 | 
            -
                  containing many "runs" into individual run files.  The individual files 
         | 
| 168 | 
            -
                  can then be processed separately, and can optionally be stored in your 
         | 
| 169 | 
            -
                  personal records directory or source control system.
         | 
| 203 | 
            +
                  status = complete
         | 
| 170 204 |  | 
| 171 | 
            -
             | 
| 172 | 
            -
                   | 
| 173 | 
            -
                   | 
| 174 | 
            -
                   | 
| 205 | 
            +
            f4.   Provide the ability to "split" a large Garmin TrainingCenter TCX/XML file
         | 
| 206 | 
            +
                  containing many "activities" into individual "activity_" files.  The 
         | 
| 207 | 
            +
                  individual files can then be processed separately, and can optionally be
         | 
| 208 | 
            +
                  stored in your personal records directory or source control system.
         | 
| 175 209 |  | 
| 176 | 
            -
             | 
| 210 | 
            +
                  status = complete
         | 
| 211 | 
            +
            	
         | 
| 212 | 
            +
            f5.   Provide the ability to generate Google Map HTML content from your GPS 
         | 
| 213 | 
            +
                  data in CSV text format, using the Google Map API v2.0.  The generated 
         | 
| 214 | 
            +
                  content should be viewable in most current web browsers, including Apple
         | 
| 215 | 
            +
                  Safari 2, Firefox 1.5, and Windows Internet Explorer 6.
         | 
| 216 | 
            +
             | 
| 217 | 
            +
                  status = complete
         | 
| 218 | 
            +
             | 
| 219 | 
            +
            f6.   Provide the ability to define your own points-of-interest (POI), route
         | 
| 177 220 | 
             
                  segments, and routes as a collection of GPS data in a simple text file.
         | 
| 178 221 | 
             
                  Allow "routes" to be composed from "reusable route segments", and 
         | 
| 179 222 | 
             
                  annotated with your own POI. 
         | 
| 180 223 |  | 
| 181 | 
            -
             | 
| 182 | 
            -
             | 
| 224 | 
            +
                  status = in-progress
         | 
| 225 | 
            +
             | 
| 226 | 
            +
            f7.   Provide the ability to generate Google Maps (requirement f5) from your
         | 
| 227 | 
            +
                  collection of GPS data (requirement f6).
         | 
| 183 228 |  | 
| 184 | 
            -
             | 
| 229 | 
            +
                  status = in-progress
         | 
| 230 | 
            +
             | 
| 231 | 
            +
            f8.   Provide the ability (i.e. - an Internet web page) for a user to easily
         | 
| 185 232 | 
             
                  obtain GPS coordinates for their particular POI, segments, and routes.
         | 
| 186 233 |  | 
| 187 | 
            -
             | 
| 234 | 
            +
                  status = complete.
         | 
| 235 | 
            +
             | 
| 236 | 
            +
            f9.   Provide the ability to alter appropriate Gooby behavior via a simple
         | 
| 188 237 | 
             
                  configuration file (i.e. - gooby_options.yaml) rather than modifying 
         | 
| 189 238 | 
             
                  the source code.  Specific configuration requirements are:
         | 
| 190 239 | 
             
                  a.  Allow the user to specify roughly how many points appear on a map.
         | 
| 191 240 | 
             
                  b.  Allow the user to specify a distance unit-of-measure in either
         | 
| 192 241 | 
             
                      miles, kilometers, or yards.
         | 
| 193 242 |  | 
| 194 | 
            -
             | 
| 243 | 
            +
                  status = in-progress
         | 
| 244 | 
            +
             | 
| 245 | 
            +
            f10   Provide adequate user documentation and scripts, so that someone other 
         | 
| 195 246 | 
             
                  than the author can actually use Gooby.
         | 
| 196 247 |  | 
| 197 | 
            -
             | 
| 248 | 
            +
                  status = in-progress
         | 
| 249 | 
            +
             | 
| 250 | 
            +
            f11.  Provide sample files - xml, csv, images.
         | 
| 251 | 
            +
             | 
| 252 | 
            +
                  status = complete
         | 
| 198 253 |  | 
| 199 254 | 
             
            Currently out-of-scope but intended for a future release:
         | 
| 200 255 | 
             
            ---------------------------------------------------------
         | 
| 201 256 |  | 
| 202 | 
            -
            f50.  Parsing of other XML GPS formats other than Garmin Forerunner.
         | 
| 203 | 
            -
             | 
| 204 257 | 
             
            f51.  Other Google APIs, such as Google Earth.
         | 
| 205 258 |  | 
| 206 259 | 
             
            f52.  Rails framework integration.
         | 
| @@ -213,7 +266,7 @@ t2.   Strive to implement the code in the "standard Ruby way", and to try to | |
| 213 266 | 
             
                  discover exactly what that is during the development of Gooby.
         | 
| 214 267 |  | 
| 215 268 | 
             
            t3.   Implement a reasonably complete set of regression tests using the 
         | 
| 216 | 
            -
                  'test/unit' framework.
         | 
| 269 | 
            +
                  'test/unit' framework.  80/20 rule.
         | 
| 217 270 |  | 
| 218 271 | 
             
            t4.   Implement a way to generate/regenerate regression tests so that as the
         | 
| 219 272 | 
             
                  tested classes/modules evolve, the corresponding test class will 
         | 
| @@ -229,11 +282,11 @@ t5.   Enable adequate runtime diagnostics; including: | |
| 229 282 | 
             
            t6.   Use the RubyForge CVS repository as the SCM after initial development;
         | 
| 230 283 | 
             
                  use local SCM during the initial development.
         | 
| 231 284 |  | 
| 232 | 
            -
            t7.   Implement a Ruby-standard directory structure -  | 
| 233 | 
            -
                   | 
| 285 | 
            +
            t7.   Implement a Ruby-standard directory structure - bin, data, lib, tests,
         | 
| 286 | 
            +
                  etc.
         | 
| 234 287 |  | 
| 235 288 | 
             
            t8.   Implement a Ruby-standard packaging mechanism, so that users can easily
         | 
| 236 | 
            -
                  download and install Gooby.
         | 
| 289 | 
            +
                  download and install Gooby (i.e. - package Gooby as a gem).
         | 
| 237 290 |  | 
| 238 291 | 
             
            == Warranty
         | 
| 239 292 |  | 
    
        data/bin/example_usage.rb
    CHANGED
    
    | @@ -7,6 +7,9 @@ to your own filenames on your computer. | |
| 7 7 |  | 
| 8 8 | 
             
            =end
         | 
| 9 9 |  | 
| 10 | 
            +
            # The following prefixes ../lib to the active ruby load path
         | 
| 11 | 
            +
            $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
         | 
| 12 | 
            +
             | 
| 10 13 | 
             
            require 'gooby'
         | 
| 11 14 |  | 
| 12 15 | 
             
            include REXML
         | 
| @@ -24,15 +27,21 @@ n = 'gmap_approx_max_points' | |
| 24 27 | 
             
            v = options.get(n)
         | 
| 25 28 | 
             
            puts "option '#{n}' = #{v}"
         | 
| 26 29 |  | 
| 27 | 
            -
            # Split a large ForerunnerLogbook XML file into individual  | 
| 30 | 
            +
            # Split a large Garmin ForerunnerLogbook XML file into individual 'run' files.
         | 
| 28 31 | 
             
            # In this example, '/temp' is the output directory.
         | 
| 29 | 
            -
            gooby. | 
| 32 | 
            +
            gooby.split_garmin_forerunner_logbook_xml('data/forerunner_2007.xml', '/temp') if true
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            # Split a large Garmin TrainingCenter TCX(XML) file into individual 'activity' files.
         | 
| 35 | 
            +
            gooby.split_garmin_training_center_xml('data/2007_03_04.tcx', '/temp') if true
         | 
| 30 36 |  | 
| 31 | 
            -
            # Parse a ForerunnerLogbook XML file, or 'split' subset, into CSV.
         | 
| 37 | 
            +
            # Parse a Garmin ForerunnerLogbook XML file, or previously 'split' subset, into CSV.
         | 
| 32 38 | 
             
            # You may want to redirect this output to a file.
         | 
| 33 | 
            -
            gooby. | 
| 39 | 
            +
            gooby.parse_garmin_forerunner_logbook_xml 'data/run_2007_01_01_16_38_27.xml'  if true
         | 
| 40 | 
            +
             | 
| 41 | 
            +
            # Parse a TrainingCenter TCX(XML) file, or previously 'split' subset, into CSV.
         | 
| 42 | 
            +
            gooby.parse_garmin_training_center_xml 'data/activity_2007_03_04_15_22_36.xml'  if true
         | 
| 34 43 |  | 
| 35 44 | 
             
            # Generate a Google Map from your CSV file data, and the Options per
         | 
| 36 | 
            -
            # your yaml file.  
         | 
| 37 | 
            -
            gooby.generate_google_map('data/phx.csv', options)
         | 
| 45 | 
            +
            # your yaml file.  You may also wish to redirect this output to a file.
         | 
| 46 | 
            +
            gooby.generate_google_map('data/phx.csv', options)  if false
         | 
| 38 47 |  | 
    
        data/bin/tcx_ex.rb
    ADDED
    
    | @@ -0,0 +1,35 @@ | |
| 1 | 
            +
            =begin rdoc
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            This file contains examples of how to use Gooby.
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            You will probably have to change the input filenames (yaml, xml, csv)
         | 
| 6 | 
            +
            to your own filenames on your computer.
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            =end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            # The following prefixes ../lib to the active ruby load path
         | 
| 11 | 
            +
            $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
         | 
| 12 | 
            +
            puts '$LOAD_PATH is now:'
         | 
| 13 | 
            +
            puts $LOAD_PATH
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            require 'gooby'
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            include REXML
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            # First, create a GoobyCommand object.
         | 
| 20 | 
            +
            gooby = Gooby::GoobyCommand.new
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            # Next, create an Options object from the given yaml file - see the sample 
         | 
| 23 | 
            +
            # 'gooby_options.yaml' file in the distribution.
         | 
| 24 | 
            +
            options_file = 'gooby_options.yaml'
         | 
| 25 | 
            +
            options = gooby.options(options_file)
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            # Optionally display some of its values.
         | 
| 28 | 
            +
            n = 'gmap_approx_max_points'
         | 
| 29 | 
            +
            v = options.get(n)
         | 
| 30 | 
            +
            puts "option '#{n}' = #{v}"
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            # Split a large ForerunnerLogbook XML file into individual 'run' files.
         | 
| 33 | 
            +
            # In this example, '/temp' is the output directory.
         | 
| 34 | 
            +
            gooby.split_garmin_training_center_xml('data/2007_03_04.tcx', '/temp')
         | 
| 35 | 
            +
             
         |