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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f388ed4e3ed7f6da7a73c5565ef060601e90e95e
4
- data.tar.gz: 0e0fb882167e13b291fb3519b1f0380e5163c83a
3
+ metadata.gz: dc3899c775a9005a9a0531f08e322b7c9e839e53
4
+ data.tar.gz: 32e44558fdeba1d090efa2d080136987a6a0ae1f
5
5
  SHA512:
6
- metadata.gz: 82eb885c1a4d8836acd3f53aabd1cf8811936297d7144724f38bc599a81aa1b1a2ab3cc706000af20c7387528562b31f81e491cca2ebaa5514b6ac4a094f3866
7
- data.tar.gz: 5633dbde493ade486f1c4029063310d9a373abdc98dbb8cfa3ab112f57066c57bb2b26ca9fa28de1dfee6bedc4815246e21c55b4d08ad039c30661bd2ab74f33
6
+ metadata.gz: 26ea0043139735c235297fe8b6067545681a6934341cfde4af27c25c8595dc5690baef0166b93f55d760e4a8ca7d282be5184acf20febbaa7719458d09d10a7b
7
+ data.tar.gz: 0cc080b3775777e4a4a369656da8fd81e84062d455322d0d20557cfc8081b055da0a09da22430db448a1842fb691c60711ad29bf4657ec8bfa0c3b60b30b9836
data/Gemfile.lock CHANGED
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gpx_track_generator (0.3.0)
4
+ gpx_track_generator (0.3.1)
5
5
  activesupport
6
+ fedux_org-stdlib
6
7
  nokogiri
7
8
  nokogiri-pretty
8
9
  thor
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`.
@@ -21,4 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_runtime_dependency 'nokogiri-pretty'
22
22
  spec.add_runtime_dependency 'thor'
23
23
  spec.add_runtime_dependency 'activesupport'
24
+ spec.add_runtime_dependency 'fedux_org-stdlib'
24
25
  end
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+ module GpxTrackGenerator
3
+ class Logger < FeduxOrgStdlib::Logging::Logger
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+ # Main
3
+ module GpxTrackGenerator
4
+ @logger = GpxTrackGenerator::Logger.new
5
+
6
+ class << self
7
+ attr_reader :logger
8
+ end
9
+ end
@@ -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
- files.each_with_object(document.css('trk').first) do |e, a|
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
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # GpxTrackGenerator
3
3
  module GpxTrackGenerator
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
@@ -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.0
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