fit-parser 0.0.1

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.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.rspec +1 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.md +27 -0
  7. data/Rakefile +2 -0
  8. data/fit.gemspec +30 -0
  9. data/lib/fit.rb +23 -0
  10. data/lib/fit/file.rb +29 -0
  11. data/lib/fit/file/data.rb +99 -0
  12. data/lib/fit/file/definition.rb +120 -0
  13. data/lib/fit/file/definitions.rb +705 -0
  14. data/lib/fit/file/header.rb +18 -0
  15. data/lib/fit/file/record.rb +37 -0
  16. data/lib/fit/file/record_header.rb +27 -0
  17. data/lib/fit/file/type.rb +41 -0
  18. data/lib/fit/file/types.rb +954 -0
  19. data/lib/fit/version.rb +3 -0
  20. data/spec/file/data_spec.rb +111 -0
  21. data/spec/file/definition_spec.rb +26 -0
  22. data/spec/file/definitions_spec.rb +81 -0
  23. data/spec/file/header_spec.rb +28 -0
  24. data/spec/file/record_header_spec.rb +20 -0
  25. data/spec/file/record_spec.rb +56 -0
  26. data/spec/file/type_spec.rb +99 -0
  27. data/spec/file/types_spec.rb +100 -0
  28. data/spec/file_spec.rb +21 -0
  29. data/spec/fit_spec.rb +10 -0
  30. data/spec/spec_helper.rb +19 -0
  31. data/spec/support/examples/file/full_file_with_wrong_crc.fit +0 -0
  32. data/spec/support/examples/file/header +0 -0
  33. data/spec/support/examples/file/header_14b.fit +0 -0
  34. data/spec/support/examples/record/data_record_2.fit +0 -0
  35. data/spec/support/examples/record/data_record_2bis.fit +0 -0
  36. data/spec/support/examples/record/definition_record +0 -0
  37. data/spec/support/examples/record/definition_record_2.fit +0 -0
  38. data/spec/support/examples/record/message/data_dynamic_fields.fit +0 -0
  39. data/spec/support/examples/record/message/data_field_array.fit +0 -0
  40. data/spec/support/examples/record/message/data_file_capabilities_activities.fit +0 -0
  41. data/spec/support/examples/record/message/data_file_capabilities_settings.fit +0 -0
  42. data/spec/support/examples/record/message/definition +0 -0
  43. data/spec/support/examples/record/message/definition_dynamic_fields.fit +0 -0
  44. data/spec/support/examples/record/message/definition_field_array.fit +0 -0
  45. data/spec/support/examples/record/message/definition_file_capabilities.fit +0 -0
  46. data/spec/support/examples/record/normal_header +1 -0
  47. metadata +228 -0
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fit::File do
4
+ let(:file) { described_class.read( example_file('file/full_file_with_wrong_crc.fit') ) }
5
+
6
+ it 'should have a header' do
7
+ expect(file.header).to be_a Fit::File::Header
8
+ end
9
+
10
+ it 'should have records' do
11
+ expect(file.records).to be_a Array
12
+ expect(file.records[0]).to be_a Fit::File::Record
13
+ end
14
+
15
+ it 'should have a CRC' do
16
+ # warning this file is not having a consistent CRC compare to
17
+ # its content. To be used only for test.
18
+ expect(file.crc).to be_a String
19
+ expect(BinData::Uint16le.read(file.crc)).to be == 34100
20
+ end
21
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fit do
4
+ describe "VERSION" do
5
+ subject{ Fit::VERSION }
6
+
7
+ it { is_expected.to be_a(String) }
8
+ it { is_expected.to match(/\d{1,2}\.\d{1,2}\.\d{1,2}/) }
9
+ end
10
+ end
@@ -0,0 +1,19 @@
1
+ require 'simplecov'
2
+ SimpleCov.add_filter '/spec/'
3
+ SimpleCov.start
4
+
5
+ SPEC_ROOT = File.dirname(__FILE__)
6
+
7
+ $LOAD_PATH.unshift SPEC_ROOT, File.join(SPEC_ROOT, '..', 'lib')
8
+
9
+ require 'rspec'
10
+ require 'rspec/its'
11
+ require 'fit'
12
+
13
+ RSpec.configure do |config|
14
+ config.raise_errors_for_deprecations!
15
+ end
16
+
17
+ def example_file(filename)
18
+ File.open File.join(SPEC_ROOT, 'support', 'examples', filename)
19
+ end
metadata ADDED
@@ -0,0 +1,228 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fit-parser
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jeff Wallace
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bindata
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.1.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.1.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 4.2.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 4.2.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 3.2.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 3.2.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-its
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: Ruby gem for reading Garmin FIT files
126
+ email:
127
+ - jeff@tjwallace.ca
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".gitignore"
133
+ - ".rspec"
134
+ - Gemfile
135
+ - LICENSE.txt
136
+ - README.md
137
+ - Rakefile
138
+ - fit.gemspec
139
+ - lib/fit.rb
140
+ - lib/fit/file.rb
141
+ - lib/fit/file/data.rb
142
+ - lib/fit/file/definition.rb
143
+ - lib/fit/file/definitions.rb
144
+ - lib/fit/file/header.rb
145
+ - lib/fit/file/record.rb
146
+ - lib/fit/file/record_header.rb
147
+ - lib/fit/file/type.rb
148
+ - lib/fit/file/types.rb
149
+ - lib/fit/version.rb
150
+ - spec/file/data_spec.rb
151
+ - spec/file/definition_spec.rb
152
+ - spec/file/definitions_spec.rb
153
+ - spec/file/header_spec.rb
154
+ - spec/file/record_header_spec.rb
155
+ - spec/file/record_spec.rb
156
+ - spec/file/type_spec.rb
157
+ - spec/file/types_spec.rb
158
+ - spec/file_spec.rb
159
+ - spec/fit_spec.rb
160
+ - spec/spec_helper.rb
161
+ - spec/support/examples/file/full_file_with_wrong_crc.fit
162
+ - spec/support/examples/file/header
163
+ - spec/support/examples/file/header_14b.fit
164
+ - spec/support/examples/record/data_record_2.fit
165
+ - spec/support/examples/record/data_record_2bis.fit
166
+ - spec/support/examples/record/definition_record
167
+ - spec/support/examples/record/definition_record_2.fit
168
+ - spec/support/examples/record/message/data_dynamic_fields.fit
169
+ - spec/support/examples/record/message/data_field_array.fit
170
+ - spec/support/examples/record/message/data_file_capabilities_activities.fit
171
+ - spec/support/examples/record/message/data_file_capabilities_settings.fit
172
+ - spec/support/examples/record/message/definition
173
+ - spec/support/examples/record/message/definition_dynamic_fields.fit
174
+ - spec/support/examples/record/message/definition_field_array.fit
175
+ - spec/support/examples/record/message/definition_file_capabilities.fit
176
+ - spec/support/examples/record/normal_header
177
+ homepage: https://github.com/tjwallace/fit
178
+ licenses:
179
+ - MIT
180
+ metadata: {}
181
+ post_install_message:
182
+ rdoc_options: []
183
+ require_paths:
184
+ - lib
185
+ required_ruby_version: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ required_rubygems_version: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ requirements: []
196
+ rubyforge_project:
197
+ rubygems_version: 2.2.2
198
+ signing_key:
199
+ specification_version: 4
200
+ summary: Ruby gem for reading Garmin FIT files
201
+ test_files:
202
+ - spec/file/data_spec.rb
203
+ - spec/file/definition_spec.rb
204
+ - spec/file/definitions_spec.rb
205
+ - spec/file/header_spec.rb
206
+ - spec/file/record_header_spec.rb
207
+ - spec/file/record_spec.rb
208
+ - spec/file/type_spec.rb
209
+ - spec/file/types_spec.rb
210
+ - spec/file_spec.rb
211
+ - spec/fit_spec.rb
212
+ - spec/spec_helper.rb
213
+ - spec/support/examples/file/full_file_with_wrong_crc.fit
214
+ - spec/support/examples/file/header
215
+ - spec/support/examples/file/header_14b.fit
216
+ - spec/support/examples/record/data_record_2.fit
217
+ - spec/support/examples/record/data_record_2bis.fit
218
+ - spec/support/examples/record/definition_record
219
+ - spec/support/examples/record/definition_record_2.fit
220
+ - spec/support/examples/record/message/data_dynamic_fields.fit
221
+ - spec/support/examples/record/message/data_field_array.fit
222
+ - spec/support/examples/record/message/data_file_capabilities_activities.fit
223
+ - spec/support/examples/record/message/data_file_capabilities_settings.fit
224
+ - spec/support/examples/record/message/definition
225
+ - spec/support/examples/record/message/definition_dynamic_fields.fit
226
+ - spec/support/examples/record/message/definition_field_array.fit
227
+ - spec/support/examples/record/message/definition_file_capabilities.fit
228
+ - spec/support/examples/record/normal_header