natour 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.natour.yml +28 -0
- data/CHANGELOG.adoc +13 -16
- data/README.adoc +2 -29
- data/bin/natour +5 -35
- data/lib/natour/config.rb +3 -6
- data/lib/natour/gps_track.rb +2 -1
- data/lib/natour/gpx_file.rb +10 -1
- data/lib/natour/report.rb +1 -0
- data/lib/natour/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a5853cf54dee642dc7cf5e2fef40e7a3379266ead197977c4804146b8334ef0
|
4
|
+
data.tar.gz: 13b08bc14434447bb5e6b18605f1c8a1fdadef8bba17e47154eec829095b3e13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f829da1ae7ae12e9f753274e8200c8d3de4e0d7e6c8cf13d5cdcb6c2c1abb4bf0ce5d8837e22ff32ed4589d2f30c7a4d5175831c24dfe8e642a8cf279be96fa6
|
7
|
+
data.tar.gz: d144ee6947ada5321c828772db6364770dc8bea4616a3022e4c1f99bdc9a3df23e9f8bcd9c0e0dcf29fd74c945513539d19050d8780f0805e32e3ecd981ef69b
|
data/.natour.yml
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
:report:
|
3
|
+
:create:
|
4
|
+
:out_dir: null
|
5
|
+
:out_file: null
|
6
|
+
:overwrite: false
|
7
|
+
:track_formats:
|
8
|
+
- :gpx
|
9
|
+
- :fit
|
10
|
+
:map: true
|
11
|
+
:map_layers: []
|
12
|
+
:adoc_author: null
|
13
|
+
:convert:
|
14
|
+
:out_dir: null
|
15
|
+
:out_file: null
|
16
|
+
:overwrite: false
|
17
|
+
:backend: :pdf
|
18
|
+
:draft: false
|
19
|
+
:draft_backend: null
|
20
|
+
:image_maxdim: 1800
|
21
|
+
:map:
|
22
|
+
:create:
|
23
|
+
:out_dir: null
|
24
|
+
:out_file: null
|
25
|
+
:overwrite: false
|
26
|
+
:gps_colors: []
|
27
|
+
:map_layers: []
|
28
|
+
:image_size: [1200, 900]
|
data/CHANGELOG.adoc
CHANGED
@@ -4,15 +4,26 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
|
5
5
|
The format is based on https://keepachangelog.com/en/1.0.0/[Keep a Changelog^], and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Versioning^].
|
6
6
|
|
7
|
+
IMPORTANT: As per Semantic Versioning, the major version zero is for initial development and anything may change at any time.
|
8
|
+
|
7
9
|
== Unreleased
|
8
10
|
|
11
|
+
== 0.11.0 - 2023-04-15
|
12
|
+
|
13
|
+
=== Changed
|
14
|
+
|
15
|
+
- Specify files to load for a configuration instead of a file and directories.
|
16
|
+
- The configuration files must now be named `.natour.yml` (prefixed with a dot).
|
17
|
+
|
18
|
+
=== Fixed
|
19
|
+
|
20
|
+
- Do not abort creating reports if GPX files do not contain tracks.
|
21
|
+
|
9
22
|
== 0.10.0 - 2023-02-18
|
10
23
|
|
11
24
|
=== Fixed
|
12
25
|
|
13
26
|
- Prevent orphaned section titles and table captions in PDF output.
|
14
|
-
+
|
15
|
-
IMPORTANT: This is a breaking change for existing AsciiDoc files that are converted again. Apply the breakable option to tables containing species lists; otherwise the numbering of the tables will not be consecutive.
|
16
27
|
|
17
28
|
== 0.9.0 - 2022-10-08
|
18
29
|
|
@@ -39,21 +50,11 @@ IMPORTANT: This is a breaking change for existing AsciiDoc files that are conver
|
|
39
50
|
=== Changed
|
40
51
|
|
41
52
|
- Rename arguments of `Natour::MapGeoAdmin.save_image`, i.e. `tracks` to `gps_files`, `layers` to `map_layers` and `size` to `image_size`.
|
42
|
-
+
|
43
|
-
IMPORTANT: This is a breaking change.
|
44
53
|
- Improve the error reporting on the command line interface in case of file errors.
|
45
54
|
- Rework the configuration; the structure and naming follows the command line interface and the keys are of type Ruby Symbol. For details, see the README file.
|
46
|
-
+
|
47
|
-
IMPORTANT: This is a breaking change. Adapt the configuration file accordingly.
|
48
55
|
- Rework the command line interface. Use `natour --help` to get more information.
|
49
|
-
+
|
50
|
-
IMPORTANT: This is a breaking change. Adapt the commands accordingly.
|
51
56
|
- Change `backend` and `draft_backend` arguments of `Natour::convert_report` to symbols.
|
52
|
-
+
|
53
|
-
IMPORTANT: This is a breaking change. Adapt the configuration file accordingly.
|
54
57
|
- Rename `Natour::create` to `Natour::create_reports` and `Natour::convert` to `Natour::convert_report`.
|
55
|
-
+
|
56
|
-
IMPORTANT: This is a breaking change.
|
57
58
|
|
58
59
|
=== Fixed
|
59
60
|
|
@@ -110,8 +111,6 @@ IMPORTANT: This is a breaking change.
|
|
110
111
|
=== Removed
|
111
112
|
|
112
113
|
- Remove redundant method `Natour::Image.portrait?`.
|
113
|
-
+
|
114
|
-
IMPORTANT: This is a breaking change. Use `Natour::Image.landscape?` instead.
|
115
114
|
|
116
115
|
== 0.3.0 - 2021-03-07
|
117
116
|
|
@@ -136,8 +135,6 @@ IMPORTANT: This is a breaking change. Use `Natour::Image.landscape?` instead.
|
|
136
135
|
=== Changed
|
137
136
|
|
138
137
|
- Rename `Natour::SpeciesList.name` to `Natour::SpeciesList.title`.
|
139
|
-
+
|
140
|
-
IMPORTANT: This is a breaking change.
|
141
138
|
- Return an empty array from `Natour::SpeciesList.load_file` if the format is unknown.
|
142
139
|
- Change the format of the start time in the AsciiDoc output from _12:30_ to _12:30 Uhr_.
|
143
140
|
- Change the format of the duration in the AsciiDoc output from _1h30_ to _1:30 h_.
|
data/README.adoc
CHANGED
@@ -90,38 +90,11 @@ NOTE: Use `natour --help` to get more information.
|
|
90
90
|
|
91
91
|
=== Configuration
|
92
92
|
|
93
|
-
The configuration is built by loading https://yaml.org/[YAML^] files in hierarchical order. The files must be named
|
93
|
+
The configuration is built by loading https://yaml.org/[YAML^] files in hierarchical order. The files must be named `.natour.yml` and are loaded first from the home directory of the current user and then from the current working directory. The values of the previously loaded files are overwritten by the values of the files loaded later. The values are stored internally in nested, dictionary-like collections (Ruby `Hash`), where the structure follows to the command line interface. All keys are of type Ruby `Symbol` and correspond to the commands and options, with middle hyphens replaced by underscores, leading hyphens removed, and without the `no-` prefix for boolean switches. The following configuration file shows all entries and their default values.
|
94
94
|
|
95
95
|
[source,yml]
|
96
96
|
----
|
97
|
-
|
98
|
-
:report:
|
99
|
-
:create:
|
100
|
-
:out_dir: null
|
101
|
-
:out_file: null
|
102
|
-
:overwrite: false
|
103
|
-
:track_formats:
|
104
|
-
- :gpx
|
105
|
-
- :fit
|
106
|
-
:map: true
|
107
|
-
:map_layers: []
|
108
|
-
:adoc_author: null
|
109
|
-
:convert:
|
110
|
-
:out_dir: null
|
111
|
-
:out_file: null
|
112
|
-
:overwrite: false
|
113
|
-
:backend: :pdf
|
114
|
-
:draft: false
|
115
|
-
:draft_backend: null
|
116
|
-
:image_maxdim: 1800
|
117
|
-
:map:
|
118
|
-
:create:
|
119
|
-
:out_dir: null
|
120
|
-
:out_file: null
|
121
|
-
:overwrite: false
|
122
|
-
:gps_colors: []
|
123
|
-
:map_layers: []
|
124
|
-
:image_size: [1200, 900]
|
97
|
+
include::.natour.yml[]
|
125
98
|
----
|
126
99
|
|
127
100
|
How to restrict GPS tracks to the FIT format (see https://developer.garmin.com/fit/[FIT SDK^]) and add additional map layers (see https://api3.geo.admin.ch/api/faq/index.html#which-layers-are-available[API FAQ - GeoAdmin API 3.0 documentation^]) is shown in the example below.
|
data/bin/natour
CHANGED
@@ -125,41 +125,11 @@ class NatourCmd < Clamp::Command
|
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
128
|
-
config = Natour::Config.
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
out_dir: nil,
|
134
|
-
out_file: nil,
|
135
|
-
overwrite: false,
|
136
|
-
track_formats: %i[gpx fit],
|
137
|
-
map: true,
|
138
|
-
map_layers: [],
|
139
|
-
adoc_author: nil
|
140
|
-
},
|
141
|
-
convert: {
|
142
|
-
out_dir: nil,
|
143
|
-
out_file: nil,
|
144
|
-
overwrite: false,
|
145
|
-
backend: :pdf,
|
146
|
-
draft: false,
|
147
|
-
draft_backend: nil,
|
148
|
-
image_maxdim: 1800
|
149
|
-
}
|
150
|
-
},
|
151
|
-
map: {
|
152
|
-
create: {
|
153
|
-
out_dir: nil,
|
154
|
-
out_file: nil,
|
155
|
-
overwrite: false,
|
156
|
-
gps_colors: [],
|
157
|
-
map_layers: [],
|
158
|
-
image_size: [1200, 900]
|
159
|
-
}
|
160
|
-
}
|
161
|
-
}
|
162
|
-
)
|
128
|
+
config = Natour::Config.load_files([
|
129
|
+
"#{__dir__}/../.natour.yml",
|
130
|
+
Pathname(Dir.home).join('.natour.yml'),
|
131
|
+
Pathname(Dir.pwd).join('.natour.yml')
|
132
|
+
])
|
163
133
|
|
164
134
|
NatourCmd.run(
|
165
135
|
Pathname($PROGRAM_NAME).basename,
|
data/lib/natour/config.rb
CHANGED
@@ -4,12 +4,9 @@ require 'yaml'
|
|
4
4
|
|
5
5
|
module Natour
|
6
6
|
class Config
|
7
|
-
def self.
|
8
|
-
configs =
|
9
|
-
config = YAML.safe_load(
|
10
|
-
File.read(Pathname(dir).join(filename)),
|
11
|
-
permitted_classes: [Symbol]
|
12
|
-
)
|
7
|
+
def self.load_files(filenames, default: {})
|
8
|
+
configs = filenames.map do |filename|
|
9
|
+
config = YAML.safe_load(File.read(filename), permitted_classes: [Symbol])
|
13
10
|
config || {}
|
14
11
|
rescue Errno::ENOENT
|
15
12
|
{}
|
data/lib/natour/gps_track.rb
CHANGED
@@ -29,7 +29,8 @@ module Natour
|
|
29
29
|
format = Pathname(filename).extname.to_s.delete_prefix('.').to_sym if format == :auto
|
30
30
|
case format
|
31
31
|
when :gpx
|
32
|
-
GPXFile.new(filename)
|
32
|
+
gpx_file = GPXFile.new(filename)
|
33
|
+
gpx_file if gpx_file.types.include?(:track)
|
33
34
|
when :fit
|
34
35
|
FITFile.new(filename)
|
35
36
|
end
|
data/lib/natour/gpx_file.rb
CHANGED
@@ -9,9 +9,16 @@ module Natour
|
|
9
9
|
'xmlns:gpxtrkx' => 'http://www.garmin.com/xmlschemas/TrackStatsExtension/v1'
|
10
10
|
}.freeze
|
11
11
|
|
12
|
+
attr_reader :types
|
13
|
+
|
12
14
|
def initialize(filename)
|
13
15
|
@doc = Nokogiri.XML(File.read(filename, mode: 'r:utf-8'))
|
14
16
|
|
17
|
+
@types = []
|
18
|
+
@types << :waypoint if @doc.at('/xmlns:gpx/xmlns:wpt', GPX_XMLNS)
|
19
|
+
@types << :route if @doc.at('/xmlns:gpx/xmlns:rte', GPX_XMLNS)
|
20
|
+
@types << :track if @doc.at('/xmlns:gpx/xmlns:trk', GPX_XMLNS)
|
21
|
+
|
15
22
|
stats = @doc.at('/xmlns:gpx/xmlns:trk/xmlns:extensions/gpxtrkx:TrackStatsExtension', GPX_XMLNS)
|
16
23
|
if stats
|
17
24
|
ascent = stats.at('./gpxtrkx:Ascent', GPX_XMLNS).text.to_i
|
@@ -23,7 +30,7 @@ module Natour
|
|
23
30
|
start_point = to_track_point(@doc.at('/xmlns:gpx/xmlns:trk/xmlns:trkseg[1]/xmlns:trkpt[1]', GPX_XMLNS))
|
24
31
|
end_point = to_track_point(@doc.at('/xmlns:gpx/xmlns:trk/xmlns:trkseg[last()]/xmlns:trkpt[last()]', GPX_XMLNS))
|
25
32
|
|
26
|
-
super(filename, start_point
|
33
|
+
super(filename, start_point&.time&.to_date, ascent, descent, distance, duration, start_point, end_point)
|
27
34
|
end
|
28
35
|
|
29
36
|
def to_gpx
|
@@ -33,6 +40,8 @@ module Natour
|
|
33
40
|
private
|
34
41
|
|
35
42
|
def to_track_point(trkpt)
|
43
|
+
return nil unless trkpt
|
44
|
+
|
36
45
|
GPSTrackPoint.new(
|
37
46
|
trkpt['lat'].to_f,
|
38
47
|
trkpt['lon'].to_f,
|
data/lib/natour/report.rb
CHANGED
data/lib/natour/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: natour
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Gysi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -213,6 +213,7 @@ executables:
|
|
213
213
|
extensions: []
|
214
214
|
extra_rdoc_files: []
|
215
215
|
files:
|
216
|
+
- ".natour.yml"
|
216
217
|
- CHANGELOG.adoc
|
217
218
|
- LICENSE
|
218
219
|
- README.adoc
|