simple-trail 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Manipulation::Statistics do
6
+ it 'calculates basic file info' do
7
+ parser = Parser::Gpx.new('./spec/examples/test_1.gpx')
8
+ parser.read
9
+
10
+ statistics_logic = described_class.new(parser.points)
11
+ expect(statistics_logic.distance).to eq 1.3221312287173086
12
+ expect(statistics_logic.ascent).to eq 154
13
+ expect(statistics_logic.descent).to eq 67
14
+ expect(statistics_logic.time).to eq 1464.0
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Manipulation::Straightener do
6
+ it 'calculates basic file info' do
7
+ parser = Parser::Gpx.new('./spec/examples/test_1.gpx')
8
+ parser.read
9
+
10
+ straigtener_logic = described_class.new(parser.points)
11
+ straigtener_logic.points_without_clusters
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Manipulation::Unifier do
6
+ it 'unifies when no previous points' do
7
+ parser = Parser::Gpx.new('./spec/examples/test_1.gpx')
8
+ parser.read
9
+
10
+ unification_logic = described_class.new(parser.points, [])
11
+ unification_logic.unify
12
+
13
+ expect(unification_logic.unified_points.size).to eq 7
14
+ end
15
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Parser::Gpx do
6
+ it 'reads the file' do
7
+ gpx_parser = described_class.new('./spec/examples/test_1.gpx')
8
+ expect { gpx_parser.read }.not_to raise_error
9
+ expect(gpx_parser.parsed_file).not_to be_nil
10
+ end
11
+
12
+ it 'reads metadata' do
13
+ gpx_parser = described_class.new('./spec/examples/test_1.gpx')
14
+ gpx_parser.read
15
+
16
+ expect(gpx_parser.meta[:author]).to eq 'choosen'
17
+ expect(gpx_parser.meta[:name]).to eq '06.06.2020 18:56'
18
+ end
19
+
20
+ it 'reads points simplified/all' do
21
+ gpx_parser = described_class.new('./spec/examples/test_1.gpx')
22
+ gpx_parser.read
23
+ expect(gpx_parser.points.size).to eq 190
24
+ expect(gpx_parser.points.size).to eq gpx_parser.simplified_points.size
25
+
26
+ random_index = rand(gpx_parser.points.size)
27
+ expect(gpx_parser.points[random_index][:lat]).to eq gpx_parser.simplified_points[random_index][:lat]
28
+ expect(gpx_parser.points[random_index][:lon]).to eq gpx_parser.simplified_points[random_index][:lon]
29
+ end
30
+
31
+ it 'reads file with segments' do
32
+ gpx_parser = described_class.new('./spec/examples/test_with_segments.gpx')
33
+ expect { gpx_parser.read }.not_to raise_error
34
+
35
+ expect(gpx_parser.points.size).to eq 355
36
+ end
37
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'simple_trail'
4
+
5
+ RSpec.configure do |config|
6
+ config.expect_with :rspec do |expectations|
7
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
8
+ end
9
+
10
+ config.mock_with :rspec do |mocks|
11
+ mocks.verify_partial_doubles = true
12
+ end
13
+
14
+ config.shared_context_metadata_behavior = :apply_to_host_groups
15
+ end
metadata ADDED
@@ -0,0 +1,147 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: simple-trail
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Staszek Zawadzki
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-08-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: geokit
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: '1.13'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: '1.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: xmlhasher
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.13'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.13'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.9'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.9'
69
+ description: Optimazing and manipulating GPX file data. For my private purposes mostly
70
+ email: st.zawadzki@gmail.com
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - ".rubocop.yml"
76
+ - README.md
77
+ - install.sh
78
+ - lib/simple_trail.rb
79
+ - lib/simple_trail/manipulation/statistics.rb
80
+ - lib/simple_trail/manipulation/straightener.rb
81
+ - lib/simple_trail/manipulation/unifier.rb
82
+ - lib/simple_trail/parser/gpx.rb
83
+ - simple-trail.gemspec
84
+ - spec/examples/kbl.gpx
85
+ - spec/examples/test-xxl.gpx
86
+ - spec/examples/test_1.gpx
87
+ - spec/examples/test_10.gpx
88
+ - spec/examples/test_11.gpx
89
+ - spec/examples/test_12.gpx
90
+ - spec/examples/test_2.gpx
91
+ - spec/examples/test_3.gpx
92
+ - spec/examples/test_4.gpx
93
+ - spec/examples/test_5.gpx
94
+ - spec/examples/test_6.gpx
95
+ - spec/examples/test_7.gpx
96
+ - spec/examples/test_8.gpx
97
+ - spec/examples/test_9.gpx
98
+ - spec/examples/test_with_segments.gpx
99
+ - spec/manipulation/statistics_spec.rb
100
+ - spec/manipulation/straightener_spec.rb
101
+ - spec/manipulation/unifier_spec.rb
102
+ - spec/parser/gpx_spec.rb
103
+ - spec/spec_helper.rb
104
+ homepage:
105
+ licenses:
106
+ - MIT
107
+ metadata: {}
108
+ post_install_message:
109
+ rdoc_options: []
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ requirements: []
123
+ rubygems_version: 3.1.2
124
+ signing_key:
125
+ specification_version: 4
126
+ summary: Readind and manipulating GPX and other trail representation file
127
+ test_files:
128
+ - spec/examples/kbl.gpx
129
+ - spec/examples/test-xxl.gpx
130
+ - spec/examples/test_1.gpx
131
+ - spec/examples/test_10.gpx
132
+ - spec/examples/test_11.gpx
133
+ - spec/examples/test_12.gpx
134
+ - spec/examples/test_2.gpx
135
+ - spec/examples/test_3.gpx
136
+ - spec/examples/test_4.gpx
137
+ - spec/examples/test_5.gpx
138
+ - spec/examples/test_6.gpx
139
+ - spec/examples/test_7.gpx
140
+ - spec/examples/test_8.gpx
141
+ - spec/examples/test_9.gpx
142
+ - spec/examples/test_with_segments.gpx
143
+ - spec/manipulation/statistics_spec.rb
144
+ - spec/manipulation/straightener_spec.rb
145
+ - spec/manipulation/unifier_spec.rb
146
+ - spec/parser/gpx_spec.rb
147
+ - spec/spec_helper.rb