gpx_track_generator 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -1
- data/README.md +35 -0
- data/gpx_track_generator.gemspec +1 -0
- data/lib/gpx_track_generator/logger.rb +5 -0
- data/lib/gpx_track_generator/main.rb +9 -0
- data/lib/gpx_track_generator/runner.rb +2 -0
- data/lib/gpx_track_generator/track.rb +7 -1
- data/lib/gpx_track_generator/version.rb +1 -1
- data/lib/gpx_track_generator.rb +4 -0
- metadata +17 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc3899c775a9005a9a0531f08e322b7c9e839e53
|
4
|
+
data.tar.gz: 32e44558fdeba1d090efa2d080136987a6a0ae1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26ea0043139735c235297fe8b6067545681a6934341cfde4af27c25c8595dc5690baef0166b93f55d760e4a8ca7d282be5184acf20febbaa7719458d09d10a7b
|
7
|
+
data.tar.gz: 0cc080b3775777e4a4a369656da8fd81e84062d455322d0d20557cfc8081b055da0a09da22430db448a1842fb691c60711ad29bf4657ec8bfa0c3b60b30b9836
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -21,6 +21,41 @@ Or install it yourself as:
|
|
21
21
|
|
22
22
|
## Usage
|
23
23
|
|
24
|
+
### Introduction
|
25
|
+
|
26
|
+
The order of the gpx files which should be used by `gpx_track_generator` is
|
27
|
+
important. It iterates over all files an concatenate the found nodes one after
|
28
|
+
another. So make sure that all files are in the correct order.
|
29
|
+
|
30
|
+
#### Example:
|
31
|
+
|
32
|
+
```
|
33
|
+
file1.gpx => Part 1 of walk
|
34
|
+
file2.gpx => Part 2 of walk
|
35
|
+
file3.gpx => Part 3 of Walk
|
36
|
+
```
|
37
|
+
|
38
|
+
*CLI*
|
39
|
+
|
40
|
+
```bash
|
41
|
+
gpx_track file1.gpx file2.gpx file3.gpx
|
42
|
+
```
|
43
|
+
|
44
|
+
|
45
|
+
*Ruby*
|
46
|
+
|
47
|
+
```
|
48
|
+
input_files = %w(file1.gpx file2.gpx file3.gpx)
|
49
|
+
track_name = 'Track ABC'
|
50
|
+
output_file = 'my_track.gpx'
|
51
|
+
|
52
|
+
GpxTrackGenerator::Api.generate(
|
53
|
+
input_files: input_files,
|
54
|
+
track_name: track_name,
|
55
|
+
output_file: output_file
|
56
|
+
)
|
57
|
+
```
|
58
|
+
|
24
59
|
### Ruby
|
25
60
|
|
26
61
|
Create your track file from ruby code. This can be helpful in your `Rakefile`.
|
data/gpx_track_generator.gemspec
CHANGED
@@ -10,6 +10,8 @@ module GpxTrackGenerator
|
|
10
10
|
|
11
11
|
desc 'generate', 'Generate gpx track'
|
12
12
|
def generate
|
13
|
+
GpxTrackGenerator.logger.info "Generating GPX Track \"#{options[:file]}\" from #{input_files.to_list(last_separator: ' and ')}"
|
14
|
+
|
13
15
|
Api.generate(
|
14
16
|
input_files: input_files,
|
15
17
|
track_name: options[:name],
|
@@ -30,6 +30,12 @@ module GpxTrackGenerator
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def build_document
|
33
|
+
gpx_files = if reverse
|
34
|
+
files.reverse
|
35
|
+
else
|
36
|
+
files
|
37
|
+
end
|
38
|
+
|
33
39
|
document.child << metadata
|
34
40
|
|
35
41
|
document.child << document.create_element('trk')
|
@@ -39,7 +45,7 @@ module GpxTrackGenerator
|
|
39
45
|
if single_segment
|
40
46
|
document.css('trk').first << document.create_element('trkseg')
|
41
47
|
|
42
|
-
|
48
|
+
gpx_files.each_with_object(document.css('trk').first) do |e, a|
|
43
49
|
a << "<!-- #{e.file_name} -->"
|
44
50
|
document.css('trkseg').last << (reverse ? e.nodes.reverse : e.nodes)
|
45
51
|
end
|
data/lib/gpx_track_generator.rb
CHANGED
@@ -2,9 +2,13 @@ require 'thor'
|
|
2
2
|
require 'nokogiri'
|
3
3
|
require 'thor/actions'
|
4
4
|
require 'active_support/core_ext/string/strip'
|
5
|
+
require 'fedux_org_stdlib/logging/logger'
|
6
|
+
require 'fedux_org_stdlib/core_ext/array/list'
|
5
7
|
require 'nokogiri-pretty'
|
6
8
|
|
7
9
|
require 'gpx_track_generator/version'
|
10
|
+
require 'gpx_track_generator/logger'
|
11
|
+
require 'gpx_track_generator/main'
|
8
12
|
require 'gpx_track_generator/gpx_file'
|
9
13
|
require 'gpx_track_generator/runner'
|
10
14
|
require 'gpx_track_generator/track'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gpx_track_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Meyer
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: fedux_org-stdlib
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description:
|
70
84
|
email:
|
71
85
|
- dev@fedux.org
|
@@ -107,6 +121,8 @@ files:
|
|
107
121
|
- lib/gpx_track_generator.rb
|
108
122
|
- lib/gpx_track_generator/api.rb
|
109
123
|
- lib/gpx_track_generator/gpx_file.rb
|
124
|
+
- lib/gpx_track_generator/logger.rb
|
125
|
+
- lib/gpx_track_generator/main.rb
|
110
126
|
- lib/gpx_track_generator/runner.rb
|
111
127
|
- lib/gpx_track_generator/track.rb
|
112
128
|
- lib/gpx_track_generator/version.rb
|