postrunner 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49a5f5f39dfa3c4aa542ad58f086e6c6a193420274ef291c4a1f5b009665734b
4
- data.tar.gz: cccd8e865768fbbd7d7266e4579753ac8ee261f0a35b4551b291e03f4e4684ee
3
+ metadata.gz: a3573b66dc63e6e6e26ed20c4389a9c4da0ea2aa3a6bba64e5cce363ddbe1531
4
+ data.tar.gz: 26e721d0ddc3cae1852c7135de1f24d3dc03e32be871c0894c958591ec538f11
5
5
  SHA512:
6
- metadata.gz: 05b6cb51addbb4f366e9779e3d69c3307078b64a0256b82833a8016dcdee64ee4b2347038ba7f8921cd0a7fe530913d6d3eee1b48258935adf71f9ff06c7ec35
7
- data.tar.gz: 075c12e07e651813fa59fefb15d4702510679dba7cbe23aaed7f27400655c72e68f913343820b631b514e6a03e3dfde4b9269441fabfe75bdcd5d51f567907db
6
+ metadata.gz: eac508a3916d92e2843e3ff34a454fd357ad35dbcf798178e7bdb555ef9b25f9010d5f647567e1907982bf11adb24c71592d3e3e3af1b3fe46d9c921cb36ea31
7
+ data.tar.gz: 51994f58aefd6354123655260a45772cc4d7e301d236b76628d27ce2af5370297aecd3c669e2147f8bf0ae91ffcbd5c7c2fbd171bf4fa6eff0a4015f7705a2ef
@@ -0,0 +1,33 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ os: [ ubuntu]
23
+ ruby: [2.4, 2.5, 2.6, 2.7, 3.0, head]
24
+ continue-on-error: ${{ endsWith(matrix.ruby, 'head') }}
25
+ steps:
26
+ - uses: actions/checkout@v2
27
+ - uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: ${{ matrix.ruby }}
30
+ bundler-cache: true
31
+
32
+ - name: Test with RSpec
33
+ run: bundle exec rspec
data/README.md CHANGED
@@ -48,23 +48,47 @@ typing.
48
48
 
49
49
  ## Usage
50
50
 
51
+ ### Mounting the watch
52
+
53
+ Watches that expose their data as FAT file system. Typically after connecting
54
+ your garmin watch, they are mount automatically if you have installed the
55
+ udev package.
56
+
57
+ For watches that expose their data via MTP (Media Transfer Procotol). For
58
+ Debian buster running `sudo apt install jmtpfs mtp-tools` will install the
59
+ needed packages.
60
+
61
+ `mkdir /tmp/forerunner; jmtpfs /tmp/forerunner`
62
+
63
+ This has been tested with a Garmin Forerunner 945.
64
+
65
+ For more information about MTP under Windows have a look at the
66
+ [Garmin FAQ](https://support.garmin.com/?faq=Itl8M6ARrh4gBQMHFqdqK8)
67
+
51
68
  ### Importing FIT files
52
69
 
53
70
  To get started you need to connect your device to your computer and
54
- mount it as a disk drive. Only devices that expose their data as FAT file
71
+ mount it as a disk drive. Only devices that expose their data as FAT or MTP file
55
72
  system are supported. Older devices use proprietary drivers and are
56
73
  not supported by PostRunner. Once the device is mounted find out the
57
74
  full path to the directory that contains your FIT files. You can then
58
75
  import all files on the device.
59
76
 
77
+ * for USB-FAT
60
78
  ```
61
79
  $ postrunner import /run/media/$USER/GARMIN/GARMIN/ACTIVITY/
62
80
  ```
63
-
64
- The above command assumes that your device is mounted as
65
- /run/media/$USER. Please replace $USER with your login name and the
66
- path with the path to your device. Files that have been imported
67
- previously will not be imported again.
81
+ The above command assumes that your device is mounted as /run/media/$USER.
82
+ Please replace $USER with your login name and the path with the path to
83
+ your device.
84
+
85
+ * for MTP (assuming you mounted it as described above)
86
+ ```
87
+ $ postrunner import /tmp/forerunner/Primary/GARMIN/Activity
88
+ ```
89
+
90
+ * Note
91
+ Files that have been imported previously will not be imported again.
68
92
 
69
93
  ### Viewing FIT file data on the console
70
94
 
data/Rakefile CHANGED
@@ -1,24 +1,9 @@
1
- $:.unshift File.join(File.dirname(__FILE__))
2
-
3
- # Add the lib directory to the search path if it isn't included already
4
- lib = File.expand_path('../lib', __FILE__)
5
- $:.unshift lib unless $:.include?(lib)
6
-
1
+ #!/usr/bin/env ruby
2
+ require_relative 'lib/postrunner/version'
3
+ require 'rake'
4
+ require 'rspec'
7
5
  require "bundler/gem_tasks"
8
- require "rspec/core/rake_task"
9
- require 'rake/clean'
10
- require 'yard'
11
- YARD::Rake::YardocTask.new
12
-
13
- Dir.glob( 'tasks/*.rake').each do |fn|
14
- begin
15
- load fn;
16
- rescue LoadError
17
- puts "#{fn.split('/')[1]} tasks unavailable: #{$!}"
18
- end
19
- end
20
-
21
- task :default => :spec
22
- task :test => :spec
6
+ require 'rspec/core/rake_task'
23
7
 
24
- desc 'Run all unit and spec tests'
8
+ RSpec::Core::RakeTask.new(:spec)
9
+
@@ -65,6 +65,37 @@ module PostRunner
65
65
  'hiking' => 'Hiking',
66
66
  'multisport' => 'Multisport',
67
67
  'paddling' => 'Paddling',
68
+ 'training' => 'Training',
69
+ 'flying' => 'Flying',
70
+ 'e_biking' => 'E-Biking',
71
+ 'motorcycling' => 'Motor Cycling',
72
+ 'boating' => 'Boating',
73
+ 'driving' => 'Driving',
74
+ 'golf' => 'Golf',
75
+ 'hang_gliding' => 'Hang Gliding',
76
+ 'horseback_riding' => 'Horseback Riding',
77
+ 'hunting' => 'Hunting',
78
+ 'fishing' => 'Fishing',
79
+ 'inline_skating' => 'Inline Skating',
80
+ 'rock_climbing' => 'Rock Climbing',
81
+ 'sailing' => 'Sailing',
82
+ 'ice_skating' => 'Ice Skating',
83
+ 'sky_diving' => 'Sky Diving',
84
+ 'snowshoeing' => 'Snowshoeing',
85
+ 'snowmobiling' => 'Snowmobiling',
86
+ 'stand_up_paddleboarding' => 'Stand Up Paddleboarding',
87
+ 'surfing' => 'Surfing',
88
+ 'wakeboarding' => 'Wakeboarding',
89
+ 'water_skiing' => 'Water Skiing',
90
+ 'kayaking' => 'Kayaking',
91
+ 'rafting' => 'Rafting',
92
+ 'windsurfing' => 'Windsurfing',
93
+ 'kitesurfing' => 'Kitesurfing',
94
+ 'tactical' => 'Tactical',
95
+ 'jumpmaster' => 'Jumpmaster',
96
+ 'boxing' => 'Boxing',
97
+ 'floor_climbing' => 'Floor Climbing',
98
+ 'diving' => 'Diving',
68
99
  'all' => 'All'
69
100
  }
70
101
  ActivitySubTypes = {
@@ -95,7 +126,43 @@ module PostRunner
95
126
  'challenge' => 'Challenge',
96
127
  'indoor_skiing' => 'Indoor Skiing',
97
128
  'cardio_training' => 'Cardio Training',
129
+ 'e_bike_fitness' => 'E Bike Fittness',
130
+ 'bmx' => 'BMX',
131
+ 'casual_walking' => 'Casual Walking',
132
+ 'speed_walking' => 'Speed Walking',
133
+ 'bike_to_run_transition' => 'Bike to Run Transition',
134
+ 'run_to_bike_transition' => 'Run to Bike Transition',
135
+ 'swim_to_bike_transition' => 'Swim to Bike Transition',
136
+ 'atv' => 'ATV',
137
+ 'motocross' => 'Motocross',
138
+ 'backcountry' => 'Backcountry',
139
+ 'resort' => 'Resort',
140
+ 'rc_drone' => 'RC Drone',
141
+ 'wingsuit' => 'Wingsuite',
142
+ 'whitewater' => 'Whitemaster',
143
+ 'skate_skiing' => 'Skate Skiing',
144
+ 'yoga' => 'Yoga',
145
+ 'pilates' => 'Pilates',
146
+ 'indoor_running' => 'Indoor Running',
147
+ 'gravel_cycling' => 'Gravel Cycling',
148
+ 'e_bike_mountain' => 'E-Bike Mountain',
149
+ 'commuting' => 'Commuting',
150
+ 'mixed_surface' => 'Mixed Surface',
151
+ 'navigate' => 'Navigate',
152
+ 'track_me' => 'Track Me',
153
+ 'map' => 'Map',
154
+ 'single_gas_diving' => 'Single Gas Diving',
155
+ 'multi_gas_diving' => 'Multi Gas Diving',
156
+ 'gauge_diving' => 'Gauge Diving',
157
+ 'apnea_diving' => 'Apnea Diving',
158
+ 'apnea_hunting' => 'Apnea Hunting',
98
159
  'virtual_activity' => 'Virtual Activity',
160
+ 'obstacle' => 'Obstacle',
161
+ 'breathing' => 'Breating',
162
+ 'sail_race' => 'Sail Race',
163
+ 'ultra' => 'Ultra',
164
+ 'indoor_climbing' => 'Indoor Climbing',
165
+ 'bouldering' => 'Bouldering',
99
166
  'all' => 'All'
100
167
  }
101
168
 
@@ -310,6 +310,7 @@ EOT
310
310
  handle_version_update
311
311
  import_legacy_archive
312
312
 
313
+ retval = 0
313
314
  case (cmd = args.shift)
314
315
  when 'check'
315
316
  if args.empty?
@@ -334,7 +335,9 @@ EOT
334
335
  # is given, use the current date.
335
336
  @ffs.monthly_report(day_in_localtime(args, '%Y-%m-01'))
336
337
  when 'delete'
337
- process_activities(args, :delete)
338
+ unless process_activities(args, :delete)
339
+ retval = 1
340
+ end
338
341
  when 'dump'
339
342
  @filter = Fit4Ruby::FitFilter.new unless @filter
340
343
  process_files_or_activities(args, :dump)
@@ -344,9 +347,13 @@ EOT
344
347
  if args.empty?
345
348
  # If we have no file or directory for the import command, we get the
346
349
  # most recently used directory from the runtime config.
347
- process_files([ @db['config']['import_dir'] ], :import)
350
+ unless process_files([ @db['config']['import_dir'] ], :import)
351
+ retval = 1
352
+ end
348
353
  else
349
- process_files(args, :import)
354
+ unless process_files(args, :import)
355
+ retval = 1
356
+ end
350
357
  if args.length == 1 && Dir.exists?(args[0])
351
358
  # If only one directory was specified as argument we store the
352
359
  # directory for future use.
@@ -361,7 +368,9 @@ EOT
361
368
  unless (@name = args.shift)
362
369
  Log.abort 'You must provide a new name for the activity'
363
370
  end
364
- process_activities(args, :rename)
371
+ unless process_activities(args, :rename)
372
+ retval = 1
373
+ end
365
374
  when 'set'
366
375
  unless (@attribute = args.shift)
367
376
  Log.abort 'You must specify the attribute you want to change'
@@ -369,7 +378,9 @@ EOT
369
378
  unless (@value = args.shift)
370
379
  Log.abort 'You must specify the new value for the attribute'
371
380
  end
372
- process_activities(args, :set)
381
+ unless process_activities(args, :set)
382
+ retval = 1
383
+ end
373
384
  when 'show'
374
385
  if args.empty?
375
386
  @ffs.show_list_in_browser
@@ -378,12 +389,18 @@ EOT
378
389
  # given day in a browser.
379
390
  @ffs.show_monitoring(args[0])
380
391
  else
381
- process_activities(args, :show)
392
+ unless process_activities(args, :show)
393
+ retval = 1
394
+ end
382
395
  end
383
396
  when 'sources'
384
- process_activities(args, :sources)
397
+ unless process_activities(args, :sources)
398
+ retval = 1
399
+ end
385
400
  when 'summary'
386
- process_activities(args, :summary)
401
+ unless process_activities(args, :summary)
402
+ retval = 1
403
+ end
387
404
  when 'units'
388
405
  change_unit_system(args)
389
406
  when 'htmldir'
@@ -399,7 +416,7 @@ EOT
399
416
  # Ensure that all updates are written to the database.
400
417
  @db.sync
401
418
 
402
- 0
419
+ retval
403
420
  end
404
421
 
405
422
  def help
@@ -409,11 +426,13 @@ EOT
409
426
  def process_files_or_activities(files_or_activities, command)
410
427
  files_or_activities.each do |foa|
411
428
  if foa[0] == ':'
412
- process_activities([ foa ], command)
429
+ return false unless process_activities([ foa ], command)
413
430
  else
414
- process_files([ foa ], command)
431
+ return false unless process_files([ foa ], command)
415
432
  end
416
433
  end
434
+
435
+ true
417
436
  end
418
437
 
419
438
  def process_activities(activity_refs, command)
@@ -426,15 +445,19 @@ EOT
426
445
  activities = @ffs.find(a_ref[1..-1])
427
446
  if activities.empty?
428
447
  Log.warn "No matching activities found for '#{a_ref}'"
429
- return
448
+ return false
449
+ end
450
+ activities.each do |a|
451
+ unless process_activity(a, command)
452
+ return false
453
+ end
430
454
  end
431
- activities.each { |a| process_activity(a, command) }
432
455
  else
433
456
  Log.abort "Activity references must start with ':': #{a_ref}"
434
457
  end
435
458
  end
436
459
 
437
- nil
460
+ true
438
461
  end
439
462
 
440
463
  def process_files(files_or_dirs, command)
@@ -445,12 +468,14 @@ EOT
445
468
  files_or_dirs.each do |fod|
446
469
  if File.directory?(fod)
447
470
  Dir.glob(File.join(fod, '*.FIT'), File::FNM_CASEFOLD).each do |file|
448
- process_file(file, command)
471
+ return false unless process_file(file, command)
449
472
  end
450
473
  else
451
- process_file(fod, command)
474
+ return false unless process_file(fod, command)
452
475
  end
453
476
  end
477
+
478
+ true
454
479
  end
455
480
 
456
481
  # Process a single FIT file according to the given command.
@@ -11,5 +11,5 @@
11
11
  #
12
12
 
13
13
  module PostRunner
14
- VERSION = '1.0.4'
14
+ VERSION = '1.0.5'
15
15
  end
data/postrunner.gemspec CHANGED
@@ -28,12 +28,12 @@ operating systems as well.}
28
28
  spec.require_paths = ["lib"]
29
29
  spec.required_ruby_version = '>=2.4'
30
30
 
31
- spec.add_dependency 'fit4ruby', '~> 3.8.0'
31
+ spec.add_dependency 'fit4ruby', '~> 3.9.0'
32
32
  spec.add_dependency 'perobs', '~> 4.3.0'
33
- spec.add_dependency 'nokogiri', '~> 1.10.10'
33
+ spec.add_dependency 'nokogiri'
34
34
 
35
- spec.add_development_dependency 'bundler', '~> 1.6'
36
- spec.add_development_dependency 'rake', '~> 0.9.6'
37
- spec.add_development_dependency 'rspec', '~> 3.6.0'
38
- spec.add_development_dependency 'yard', '~> 0.9.20'
35
+ spec.add_development_dependency 'bundler'
36
+ spec.add_development_dependency 'rake'
37
+ spec.add_development_dependency 'rspec'
38
+ spec.add_development_dependency 'yard'
39
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postrunner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Schlaeger
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-14 00:00:00.000000000 Z
11
+ date: 2021-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fit4ruby
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.8.0
19
+ version: 3.9.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 3.8.0
26
+ version: 3.9.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: perobs
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -42,72 +42,72 @@ dependencies:
42
42
  name: nokogiri
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 1.10.10
47
+ version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 1.10.10
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '1.6'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '1.6'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 0.9.6
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 0.9.6
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 3.6.0
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 3.6.0
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: yard
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 0.9.20
103
+ version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 0.9.20
110
+ version: '0'
111
111
  description: |-
112
112
  PostRunner is an application to manage FIT files
113
113
  such as those produced by Garmin products like the Forerunner 620 (FR620),
@@ -126,6 +126,7 @@ executables:
126
126
  extensions: []
127
127
  extra_rdoc_files: []
128
128
  files:
129
+ - ".github/workflows/ruby.yml"
129
130
  - ".gitignore"
130
131
  - COPYING
131
132
  - Gemfile
@@ -324,7 +325,7 @@ homepage: https://github.com/scrapper/postrunner
324
325
  licenses:
325
326
  - GNU GPL version 2
326
327
  metadata: {}
327
- post_install_message:
328
+ post_install_message:
328
329
  rdoc_options: []
329
330
  require_paths:
330
331
  - lib
@@ -339,8 +340,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
339
340
  - !ruby/object:Gem::Version
340
341
  version: '0'
341
342
  requirements: []
342
- rubygems_version: 3.2.3
343
- signing_key:
343
+ rubygems_version: 3.2.22
344
+ signing_key:
344
345
  specification_version: 4
345
346
  summary: Application to manage and analyze Garmin FIT files.
346
347
  test_files: