open_gpx_2_kml 0.10.1 → 0.10.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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- open_gpx_2_kml (0.10.1)
4
+ open_gpx_2_kml (0.10.2)
5
5
  builder (= 3.1.4)
6
6
  geo_swap (= 0.2.1)
7
7
  nokogiri (= 1.5.6)
@@ -15,5 +15,9 @@ module TF1Converter
15
15
  end
16
16
  end
17
17
  end
18
+
19
+ def self.translate_filename(file_path)
20
+ file_path.split('.')[0...-1].join('.') + '.csv'
21
+ end
18
22
  end
19
23
  end
@@ -23,15 +23,14 @@ module TF1Converter
23
23
  end
24
24
 
25
25
  def into(output_file)
26
- raw_file_name = output_file.path.split('.').first
27
- csv_path = raw_file_name + '.csv'
28
- CsvFile.new(@gpx.waypoints, csv_path).to_csv!
26
+ csv_file_name = CsvFile.translate_filename(output_file.path)
27
+ CsvFile.new(@gpx.waypoints, csv_file_name).to_csv!
29
28
 
30
29
  kml = KmlFile.new(@gpx.waypoints, @gpx.tracks, @filename).to_xml
31
30
  output_file.puts kml
32
31
  output_file.close
33
32
 
34
- kmz = KmzFile.assemble!(raw_file_name)
33
+ kmz = KmzFile.assemble!(csv_file_name.gsub(/\.csv$/,''))
35
34
  end
36
35
 
37
36
  end
@@ -1,3 +1,3 @@
1
1
  module TF1Converter
2
- VERSION = "0.10.1"
2
+ VERSION = "0.10.2"
3
3
  end
@@ -0,0 +1,17 @@
1
+ require_relative '../../../lib/tf1_converter/csv_file'
2
+
3
+ module TF1Converter
4
+ describe CsvFile do
5
+ describe '.translate_filename' do
6
+ it 'changes a filepath to be a csv filename' do
7
+ base_path = '/some/long/path/with/file'
8
+ CsvFile.translate_filename("#{base_path}.kmz").should == "#{base_path}.csv"
9
+ end
10
+
11
+ it 'changes a filepath with dots to be a csv filename' do
12
+ base_path = '/some/long.path/with.file'
13
+ CsvFile.translate_filename("#{base_path}.kmz").should == "#{base_path}.csv"
14
+ end
15
+ end
16
+ end
17
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: open_gpx_2_kml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.10.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -195,6 +195,7 @@ files:
195
195
  - spec/fixtures/test.gpx
196
196
  - spec/fixtures/waypoint-by-name.gpx
197
197
  - spec/lib/tf1_converter/config_spec.rb
198
+ - spec/lib/tf1_converter/csv_file_spec.rb
198
199
  - spec/lib/tf1_converter/gpx/track_spec.rb
199
200
  - spec/lib/tf1_converter/gpx/waypoint_spec.rb
200
201
  - spec/lib/tf1_converter/kml/track_color_spec.rb
@@ -214,7 +215,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
214
215
  version: '0'
215
216
  segments:
216
217
  - 0
217
- hash: 1970865931088980454
218
+ hash: 1443026133062831129
218
219
  required_rubygems_version: !ruby/object:Gem::Requirement
219
220
  none: false
220
221
  requirements:
@@ -223,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
223
224
  version: '0'
224
225
  segments:
225
226
  - 0
226
- hash: 1970865931088980454
227
+ hash: 1443026133062831129
227
228
  requirements: []
228
229
  rubyforge_project:
229
230
  rubygems_version: 1.8.23
@@ -237,6 +238,7 @@ test_files:
237
238
  - spec/fixtures/test.gpx
238
239
  - spec/fixtures/waypoint-by-name.gpx
239
240
  - spec/lib/tf1_converter/config_spec.rb
241
+ - spec/lib/tf1_converter/csv_file_spec.rb
240
242
  - spec/lib/tf1_converter/gpx/track_spec.rb
241
243
  - spec/lib/tf1_converter/gpx/waypoint_spec.rb
242
244
  - spec/lib/tf1_converter/kml/track_color_spec.rb