gpx_kml 0.0.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +16 -0
- data/Gemfile.lock +1 -1
- data/gpx_kml.gemspec +2 -2
- data/lib/converter.rb +10 -10
- data/lib/gpx_kml/gpx.rb +4 -4
- data/lib/gpx_kml/kml.rb +4 -4
- data/lib/gpx_kml/version.rb +1 -1
- metadata +5 -11
- data/.idea/.gitignore +0 -8
- data/.idea/dictionaries/angelo.xml +0 -3
- data/.idea/gpx_kml.iml +0 -61
- data/.idea/misc.xml +0 -7
- data/.idea/modules.xml +0 -8
- data/.idea/vcs.xml +0 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ed620fe7482aa20af6f157999f63fde7b05020bf8f66f73c2a3923867eda3932
|
|
4
|
+
data.tar.gz: cd97e906096ccbe17686fb22eeeee457e995b0adf8b99f5126a143286217bb1b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cc4026a80235b8fb680be82b28e90c14a4abe9b38a3c9366b7f32277a6948da24d32487f8bebe5240623473ebfdabe112fecccd0da98722b4b79b0af1526d7ee
|
|
7
|
+
data.tar.gz: 00535dc2bf44c737b8f927d0d70288732117260034a7e00ae3ece46c189e6428d6e0260adff4fa0be20987ac268921567b5a9025b342b2ac6e337d8a4108aebd
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
### V 0.1.x
|
|
2
|
+
- v 0.1.2:
|
|
3
|
+
- fixed version tests, AGAIN
|
|
4
|
+
- v 0.1.1:
|
|
5
|
+
- fixed critical bug on output file
|
|
6
|
+
- v 0.1.0:
|
|
7
|
+
- fixed changelog link in rubygems.org
|
|
8
|
+
- removed .idea directory in the project
|
|
9
|
+
- added support for '.xml' & no extension files for kml & gpx
|
|
10
|
+
- fixed 'valid?' method now returning false on an empty document (nokogiri::XML) for kml & gpx
|
|
11
|
+
- updated kml_to_gpx & gpx_to_kml to now return the entire path of the file created
|
|
12
|
+
- fixed version tests, now passing
|
|
13
|
+
---
|
|
14
|
+
### V 0.0.x
|
|
15
|
+
- v 0.0.2: corrected gem Homepage
|
|
16
|
+
- v 0.0.1: release
|
data/Gemfile.lock
CHANGED
data/gpx_kml.gemspec
CHANGED
|
@@ -8,14 +8,14 @@ Gem::Specification.new do |spec|
|
|
|
8
8
|
|
|
9
9
|
spec.summary = 'Gem to convert .gpx into .kml and back'
|
|
10
10
|
spec.description = 'This gem adds the capability to convert GPS Exchange Format (GPX) to Keyhole Markup Language (KML) and viceversa'
|
|
11
|
-
spec.homepage = 'https://www.github.com/engim-eu/'
|
|
11
|
+
spec.homepage = 'https://www.github.com/engim-eu/gpx_kml'
|
|
12
12
|
spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
|
|
13
13
|
|
|
14
14
|
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
|
15
15
|
|
|
16
16
|
spec.metadata['homepage_uri'] = spec.homepage
|
|
17
17
|
spec.metadata['source_code_uri'] = 'https://www.github.com/engim-eu/gpx_kml'
|
|
18
|
-
spec.metadata['changelog_uri'] = 'https://www.github.com/engim-eu/gpx_kml/CHANGELOG.md'
|
|
18
|
+
spec.metadata['changelog_uri'] = 'https://www.github.com/engim-eu/gpx_kml/blob/master/CHANGELOG.md'
|
|
19
19
|
|
|
20
20
|
# Specify which files should be added to the gem when it is released.
|
|
21
21
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
data/lib/converter.rb
CHANGED
|
@@ -33,8 +33,8 @@ module CONVERTER
|
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
|
-
name = "#{Time.now.strftime('%Y%m%d%H%M%S')}_#{gpx.file_name[0..-5]}.kml"
|
|
37
|
-
f = File.open(
|
|
36
|
+
name = "#{output_path}/#{Time.now.strftime('%Y%m%d%H%M%S')}_#{gpx.file_name[0..-5]}.kml"
|
|
37
|
+
f = File.open(name.to_s, 'w')
|
|
38
38
|
f.write(kml.to_xml)
|
|
39
39
|
f.close
|
|
40
40
|
name
|
|
@@ -58,8 +58,8 @@ module CONVERTER
|
|
|
58
58
|
gpx_tracks(xml, kml)
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
|
-
name = "#{Time.now.strftime('%Y%m%d%H%M%S')}_#{kml.file_name[0..-5]}.gpx"
|
|
62
|
-
f = File.open(
|
|
61
|
+
name = "#{output_path}/#{Time.now.strftime('%Y%m%d%H%M%S')}_#{kml.file_name[0..-5]}.gpx"
|
|
62
|
+
f = File.open(name.to_s, 'w')
|
|
63
63
|
f.write(gpx.to_xml)
|
|
64
64
|
f.close
|
|
65
65
|
name
|
|
@@ -138,8 +138,8 @@ module CONVERTER
|
|
|
138
138
|
kml.points.each do |p|
|
|
139
139
|
next if p.nil?
|
|
140
140
|
|
|
141
|
-
xml.wpt('lat':
|
|
142
|
-
xml.ele(
|
|
141
|
+
xml.wpt('lat': p.latitude.to_s, 'lon': p.longitude.to_s) do
|
|
142
|
+
xml.ele(p.elevation.to_s) unless p.elevation.nil? || p.elevation.empty?
|
|
143
143
|
xml.name(p.name) unless p.name.nil? || p.name.empty?
|
|
144
144
|
xml.desc("author = #{p.author}") unless p.author.nil? || p.author.empty?
|
|
145
145
|
xml.link('href': p.link) unless p.link.nil? || p.link.empty?
|
|
@@ -160,8 +160,8 @@ module CONVERTER
|
|
|
160
160
|
r.points.each do |p|
|
|
161
161
|
next if p.nil?
|
|
162
162
|
|
|
163
|
-
xml.rtept('lat':
|
|
164
|
-
xml.ele(
|
|
163
|
+
xml.rtept('lat': p.latitude.to_s, 'lon': p.longitude.to_s) do
|
|
164
|
+
xml.ele(p.elevation.to_s) unless p.elevation.nil? || p.elevation.empty?
|
|
165
165
|
xml.desc("author = #{p.author}") unless p.author.nil? || p.author.empty?
|
|
166
166
|
xml.link('href': p.link) unless p.link.nil? || p.link.empty?
|
|
167
167
|
end
|
|
@@ -184,8 +184,8 @@ module CONVERTER
|
|
|
184
184
|
t.points.each do |p|
|
|
185
185
|
next if p.nil?
|
|
186
186
|
|
|
187
|
-
xml.trkpt('lat':
|
|
188
|
-
xml.ele(
|
|
187
|
+
xml.trkpt('lat': p.latitude.to_s, 'lon': p.longitude.to_s) do
|
|
188
|
+
xml.ele(p.elevation.to_s) unless p.elevation.nil? || p.elevation.empty?
|
|
189
189
|
xml.desc("author = #{p.author}") unless p.author.nil? || p.author.empty?
|
|
190
190
|
xml.link('href': p.link) unless p.link.nil? || p.link.empty?
|
|
191
191
|
end
|
data/lib/gpx_kml/gpx.rb
CHANGED
|
@@ -35,7 +35,9 @@ module GPX
|
|
|
35
35
|
|
|
36
36
|
# For a gpx file to be valid it must only have a waypoint, a route or a track
|
|
37
37
|
def valid?
|
|
38
|
-
|
|
38
|
+
return nil if @gpx.nil?
|
|
39
|
+
|
|
40
|
+
!@gpx.xpath('/xmlns:gpx').empty? && (tracks? || routes? || points?)
|
|
39
41
|
end
|
|
40
42
|
|
|
41
43
|
def routes?
|
|
@@ -118,9 +120,7 @@ module GPX
|
|
|
118
120
|
end
|
|
119
121
|
|
|
120
122
|
def correct_path?(path)
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
false
|
|
123
|
+
path.instance_of?(String) && (path.end_with?('.gpx') || path.end_with?('.xml') || !path.include?('.'))
|
|
124
124
|
end
|
|
125
125
|
|
|
126
126
|
def alt_name
|
data/lib/gpx_kml/kml.rb
CHANGED
|
@@ -30,7 +30,9 @@ module KML
|
|
|
30
30
|
attr_reader :points, :routes, :tracks
|
|
31
31
|
|
|
32
32
|
def valid?
|
|
33
|
-
|
|
33
|
+
return nil if @kml.nil?
|
|
34
|
+
|
|
35
|
+
!@kml.xpath('/xmlns:kml').empty? && (tracks? || routes? || points?)
|
|
34
36
|
end
|
|
35
37
|
|
|
36
38
|
def routes?
|
|
@@ -54,9 +56,7 @@ module KML
|
|
|
54
56
|
private
|
|
55
57
|
|
|
56
58
|
def correct_path?(path)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
false
|
|
59
|
+
path.instance_of?(String) && (path.end_with?('.kml') || path.end_with?('.xml') || !path.include?('.'))
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
def _tracks
|
data/lib/gpx_kml/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gpx_kml
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Angelo Terzi
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-10-
|
|
11
|
+
date: 2021-10-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|
|
@@ -75,12 +75,6 @@ extensions: []
|
|
|
75
75
|
extra_rdoc_files: []
|
|
76
76
|
files:
|
|
77
77
|
- ".gitignore"
|
|
78
|
-
- ".idea/.gitignore"
|
|
79
|
-
- ".idea/dictionaries/angelo.xml"
|
|
80
|
-
- ".idea/gpx_kml.iml"
|
|
81
|
-
- ".idea/misc.xml"
|
|
82
|
-
- ".idea/modules.xml"
|
|
83
|
-
- ".idea/vcs.xml"
|
|
84
78
|
- ".rspec"
|
|
85
79
|
- ".travis.yml"
|
|
86
80
|
- CHANGELOG.md
|
|
@@ -109,13 +103,13 @@ files:
|
|
|
109
103
|
- lib/gpx_kml/templates/trk.gpx
|
|
110
104
|
- lib/gpx_kml/templates/wpt.gpx
|
|
111
105
|
- lib/gpx_kml/version.rb
|
|
112
|
-
homepage: https://www.github.com/engim-eu/
|
|
106
|
+
homepage: https://www.github.com/engim-eu/gpx_kml
|
|
113
107
|
licenses: []
|
|
114
108
|
metadata:
|
|
115
109
|
allowed_push_host: https://rubygems.org
|
|
116
|
-
homepage_uri: https://www.github.com/engim-eu/
|
|
110
|
+
homepage_uri: https://www.github.com/engim-eu/gpx_kml
|
|
117
111
|
source_code_uri: https://www.github.com/engim-eu/gpx_kml
|
|
118
|
-
changelog_uri: https://www.github.com/engim-eu/gpx_kml/CHANGELOG.md
|
|
112
|
+
changelog_uri: https://www.github.com/engim-eu/gpx_kml/blob/master/CHANGELOG.md
|
|
119
113
|
post_install_message:
|
|
120
114
|
rdoc_options: []
|
|
121
115
|
require_paths:
|
data/.idea/.gitignore
DELETED
data/.idea/gpx_kml.iml
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="RUBY_MODULE" version="4">
|
|
3
|
-
<component name="ModuleRunConfigurationManager">
|
|
4
|
-
<shared />
|
|
5
|
-
</component>
|
|
6
|
-
<component name="NewModuleRootManager">
|
|
7
|
-
<content url="file://$MODULE_DIR$">
|
|
8
|
-
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
|
|
9
|
-
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
|
10
|
-
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
|
11
|
-
</content>
|
|
12
|
-
<orderEntry type="inheritedJdk" />
|
|
13
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
14
|
-
<orderEntry type="library" scope="PROVIDED" name="activesupport (v6.1.4.1, RVM: ruby-2.7.2) [gem]" level="application" />
|
|
15
|
-
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, RVM: ruby-2.7.2) [gem]" level="application" />
|
|
16
|
-
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.9, RVM: ruby-2.7.2) [gem]" level="application" />
|
|
17
|
-
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.4.4, RVM: ruby-2.7.2) [gem]" level="application" />
|
|
18
|
-
<orderEntry type="library" scope="PROVIDED" name="factory_bot (v6.2.0, RVM: ruby-2.7.2) [gem]" level="application" />
|
|
19
|
-
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.8.10, RVM: ruby-2.7.2) [gem]" level="application" />
|
|
20
|
-
<orderEntry type="library" scope="PROVIDED" name="mini_portile2 (v2.6.1, RVM: ruby-2.7.2) [gem]" level="application" />
|
|
21
|
-
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.14.4, RVM: ruby-2.7.2) [gem]" level="application" />
|
|
22
|
-
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.12.5, RVM: ruby-2.7.2) [gem]" level="application" />
|
|
23
|
-
<orderEntry type="library" scope="PROVIDED" name="racc (v1.5.2, RVM: ruby-2.7.2) [gem]" level="application" />
|
|
24
|
-
<orderEntry type="library" scope="PROVIDED" name="rake (v12.3.3, RVM: ruby-2.7.2) [gem]" level="application" />
|
|
25
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.10.0, RVM: ruby-2.7.2) [gem]" level="application" />
|
|
26
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.10.1, RVM: ruby-2.7.2) [gem]" level="application" />
|
|
27
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.10.1, RVM: ruby-2.7.2) [gem]" level="application" />
|
|
28
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.10.2, RVM: ruby-2.7.2) [gem]" level="application" />
|
|
29
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.10.2, RVM: ruby-2.7.2) [gem]" level="application" />
|
|
30
|
-
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.4, RVM: ruby-2.7.2) [gem]" level="application" />
|
|
31
|
-
<orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.4.2, RVM: ruby-2.7.2) [gem]" level="application" />
|
|
32
|
-
</component>
|
|
33
|
-
<component name="RakeTasksCache">
|
|
34
|
-
<option name="myRootTask">
|
|
35
|
-
<RakeTaskImpl id="rake">
|
|
36
|
-
<subtasks>
|
|
37
|
-
<RakeTaskImpl description="Build gpx_kml-0.0.0.gem into the pkg directory" fullCommand="build" id="build" />
|
|
38
|
-
<RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
|
|
39
|
-
<RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
|
|
40
|
-
<RakeTaskImpl description="Build and install gpx_kml-0.0.0.gem into system gems" fullCommand="install" id="install" />
|
|
41
|
-
<RakeTaskImpl id="install">
|
|
42
|
-
<subtasks>
|
|
43
|
-
<RakeTaskImpl description="Build and install gpx_kml-0.0.0.gem into system gems without network access" fullCommand="install:local" id="local" />
|
|
44
|
-
</subtasks>
|
|
45
|
-
</RakeTaskImpl>
|
|
46
|
-
<RakeTaskImpl description="Create tag v0.0.0 and build and push gpx_kml-0.0.0.gem to TODO: Set to 'https://mygemserver.com'" fullCommand="release[remote]" id="release[remote]" />
|
|
47
|
-
<RakeTaskImpl description="Run RSpec code examples" fullCommand="spec" id="spec" />
|
|
48
|
-
<RakeTaskImpl description="" fullCommand="default" id="default" />
|
|
49
|
-
<RakeTaskImpl description="" fullCommand="release" id="release" />
|
|
50
|
-
<RakeTaskImpl id="release">
|
|
51
|
-
<subtasks>
|
|
52
|
-
<RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
|
|
53
|
-
<RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
|
|
54
|
-
<RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
|
|
55
|
-
</subtasks>
|
|
56
|
-
</RakeTaskImpl>
|
|
57
|
-
</subtasks>
|
|
58
|
-
</RakeTaskImpl>
|
|
59
|
-
</option>
|
|
60
|
-
</component>
|
|
61
|
-
</module>
|
data/.idea/misc.xml
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectResources">
|
|
4
|
-
<resource url="http://www.w3.org/2005/atom-author-link.xsd" location="$USER_HOME$/Desktop/atom-author-link.xsd" />
|
|
5
|
-
</component>
|
|
6
|
-
<component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.7.2" project-jdk-type="RUBY_SDK" />
|
|
7
|
-
</project>
|
data/.idea/modules.xml
DELETED