gpx_kml 0.0.2 → 0.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a2e888dd2e4deea6901194802d13d77f25541c7325738fa627a868a8f0f9990
4
- data.tar.gz: 2906c62425c20121d7937eb9c64dce2efe32c1fd5495571cfb196b91ab8cb310
3
+ metadata.gz: 13f65ff6210343e36ea2ac9d4dba526063b52acb79e53e0b9041396e5c7f60e8
4
+ data.tar.gz: 20812205cf5a53b658bf7a5d4ea4ec389c3d535bdb6ea0f27e0bd06b9865998e
5
5
  SHA512:
6
- metadata.gz: cc0232ac9695899cd5a7fa13c036f9464c20ebec651bdc833a570a76fc75c880ed6b1dd0bdd3a7c1f8dbc0e146474974a28fa9213467226f436ef0daacb0d6c9
7
- data.tar.gz: cbda2b7aa7a335a8fa9ec46311b10e94d39fa12e711ad457cc6a295ccdb6d38d7e48fef02383c23d839c699bfd18f48fd67de39edf1074e9bf33bb1f6b8b4859
6
+ metadata.gz: 35887d6a1c43fb454ec18d06e02c7dc9de8b0586eaff513d6f18540b52b19768d5c52332cc5d4c7f94085e404c0253ec66618421d7379eeb624db83340163e36
7
+ data.tar.gz: d6d731ba24b088f7f6c35f19a8668a6384c85cba46f486455182457d79dabffd1ac289aafd74bc2d2113ecefcc41b1d19a4a491d068fa5a8d00ba5e1e4f42cb0
data/.gitignore CHANGED
@@ -6,6 +6,7 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ /.idea/
9
10
 
10
11
  # rspec failure tracking
11
12
  .rspec_status
data/CHANGELOG.md CHANGED
@@ -1,2 +1,12 @@
1
+ ### V 0.1.x
2
+ - v 0.1.0:
3
+ - fixed changelog link in rubygems.org
4
+ - removed .idea directory in the project
5
+ - added support for '.xml' & no extension files for kml & gpx
6
+ - fixed 'valid?' method now returning false on an empty document (nokogiri::XML) for kml & gpx
7
+ - updated kml_to_gpx & gpx_to_kml to now return the entire path of the file created
8
+ - fixed version tests, now passing
9
+ ---
10
+ ### V 0.0.x
1
11
  - v 0.0.2: corrected gem Homepage
2
12
  - v 0.0.1: release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gpx_kml (0.0.2)
4
+ gpx_kml (0.1.0)
5
5
  nokogiri (~> 1.12.0)
6
6
  rake (~> 12.0)
7
7
 
data/gpx_kml.gemspec CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
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,7 +33,7 @@ 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"
36
+ name = "#{output_path}/#{Time.now.strftime('%Y%m%d%H%M%S')}_#{gpx.file_name[0..-5]}.kml"
37
37
  f = File.open("#{output_path}/#{name}", 'w')
38
38
  f.write(kml.to_xml)
39
39
  f.close
@@ -58,7 +58,7 @@ 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"
61
+ name = "#{output_path}/#{Time.now.strftime('%Y%m%d%H%M%S')}_#{kml.file_name[0..-5]}.gpx"
62
62
  f = File.open("#{output_path}/#{name}", 'w')
63
63
  f.write(gpx.to_xml)
64
64
  f.close
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
- tracks? || routes? || points?
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
- return true if path.instance_of?(String) && (path.end_with? '.gpx')
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
- tracks? || routes? || points?
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
- return true if path.instance_of?(String) && (path.end_with? '.kml')
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GPXKML
4
- VERSION = '0.0.2'
4
+ VERSION = '0.1.0'
5
5
  end
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.0.2
4
+ version: 0.1.0
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-27 00:00:00.000000000 Z
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
@@ -115,7 +109,7 @@ metadata:
115
109
  allowed_push_host: https://rubygems.org
116
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
@@ -1,8 +0,0 @@
1
- # Default ignored files
2
- /shelf/
3
- /workspace.xml
4
- # Editor-based HTTP Client requests
5
- /httpRequests/
6
- # Datasource local storage ignored files
7
- /dataSources/
8
- /dataSources.local.xml
@@ -1,3 +0,0 @@
1
- <component name="ProjectDictionaryState">
2
- <dictionary name="angelo" />
3
- </component>
data/.idea/gpx_kml.iml DELETED
@@ -1,60 +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="minitest (v5.14.4, RVM: ruby-2.7.2) [gem]" level="application" />
21
- <orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.12.5, RVM: ruby-2.7.2) [gem]" level="application" />
22
- <orderEntry type="library" scope="PROVIDED" name="racc (v1.6.0, RVM: ruby-2.7.2) [gem]" level="application" />
23
- <orderEntry type="library" scope="PROVIDED" name="rake (v12.3.3, RVM: ruby-2.7.2) [gem]" level="application" />
24
- <orderEntry type="library" scope="PROVIDED" name="rspec (v3.10.0, RVM: ruby-2.7.2) [gem]" level="application" />
25
- <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.10.1, RVM: ruby-2.7.2) [gem]" level="application" />
26
- <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.10.1, RVM: ruby-2.7.2) [gem]" level="application" />
27
- <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.10.2, RVM: ruby-2.7.2) [gem]" level="application" />
28
- <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.10.2, RVM: ruby-2.7.2) [gem]" level="application" />
29
- <orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.4, RVM: ruby-2.7.2) [gem]" level="application" />
30
- <orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.4.2, RVM: ruby-2.7.2) [gem]" level="application" />
31
- </component>
32
- <component name="RakeTasksCache">
33
- <option name="myRootTask">
34
- <RakeTaskImpl id="rake">
35
- <subtasks>
36
- <RakeTaskImpl description="Build gpx_kml-0.0.1.gem into the pkg directory" fullCommand="build" id="build" />
37
- <RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
38
- <RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
39
- <RakeTaskImpl description="Build and install gpx_kml-0.0.1.gem into system gems" fullCommand="install" id="install" />
40
- <RakeTaskImpl id="install">
41
- <subtasks>
42
- <RakeTaskImpl description="Build and install gpx_kml-0.0.1.gem into system gems without network access" fullCommand="install:local" id="local" />
43
- </subtasks>
44
- </RakeTaskImpl>
45
- <RakeTaskImpl description="Create tag v0.0.1 and build and push gpx_kml-0.0.1.gem to https://rubygems.com'" fullCommand="release[remote]" id="release[remote]" />
46
- <RakeTaskImpl description="Run RSpec code examples" fullCommand="spec" id="spec" />
47
- <RakeTaskImpl description="" fullCommand="default" id="default" />
48
- <RakeTaskImpl description="" fullCommand="release" id="release" />
49
- <RakeTaskImpl id="release">
50
- <subtasks>
51
- <RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
52
- <RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
53
- <RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
54
- </subtasks>
55
- </RakeTaskImpl>
56
- </subtasks>
57
- </RakeTaskImpl>
58
- </option>
59
- </component>
60
- </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
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/gpx_kml.iml" filepath="$PROJECT_DIR$/.idea/gpx_kml.iml" />
6
- </modules>
7
- </component>
8
- </project>
data/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>