spektrum-log 0.0.20 → 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
  SHA1:
3
- metadata.gz: 2d30cad8f6f6191ef4faa750cba19e147da9cf40
4
- data.tar.gz: 8bdcb97ee0a0d330aa66decf6a03d2f234693d65
3
+ metadata.gz: d216965c2d23d88df6669b7de13a900a69279e24
4
+ data.tar.gz: dc646b75ba6918f2689643c76a20fcad203b558c
5
5
  SHA512:
6
- metadata.gz: 23fd531279aa135335a98809ab1cfb7c699587ea834bf7d8e8836c1e8f0ad745a948bb4ec4b50a0b50c72fc7cbbe20a076f7963799df4772580b38ace59831e9
7
- data.tar.gz: 9e3d46610b18f52760f362150dc3d9d2a600659c03f984435b0cadc82bef010aad53dcca7355b800e8abb914f43644f85a545037b55a4e5f051e8ceae2051e55
6
+ metadata.gz: a740b3dbf71d65b839f7716800e7a52766b317ddda3ecc035d8b25eed93d122be0e310b4784ddcccfad981859b292398456bbf31fcb36c8adfc0edcd2d0730ee
7
+ data.tar.gz: 8f8954170ca37d65dad06923c7e7ab463527d59ec5d3e786c58102e1aa0a656ef4bd4f59f77309a744b91ab8404108f1123402d3920f79b1e0c58e36a0c01ad3
@@ -12,9 +12,9 @@ module Spektrum
12
12
  # errors that may be raised.
13
13
  #
14
14
  # @param uri URI to file to read
15
- # @return [Boolean] true if the file is a Spektrum log file, false otherwise
15
+ # @return [Spektrum::Log::File] loaded file if the file is a Spektrum log file, nil otherwise
16
16
  def self.spektrum? uri
17
- !!File.new(uri) rescue false
17
+ File.new(uri) rescue nil
18
18
  end
19
19
 
20
20
  def initialize uri
@@ -1,5 +1,5 @@
1
1
  module Spektrum
2
2
  module Log
3
- VERSION = "0.0.20"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -6,7 +6,9 @@ describe Spektrum::Log::File do
6
6
 
7
7
  context 'with data file 1.TLM' do
8
8
 
9
- subject { Spektrum::Log::File.new(data_file('1.TLM')) }
9
+ before(:all) { @file = _1_tlm }
10
+
11
+ subject { @file }
10
12
 
11
13
  it { should have(3).flights }
12
14
 
@@ -16,7 +18,9 @@ describe Spektrum::Log::File do
16
18
 
17
19
  context 'with data file 2.TLM' do
18
20
 
19
- subject { Spektrum::Log::File.new(data_file('2.TLM')) }
21
+ before(:all) { @file = _2_tlm }
22
+
23
+ subject { @file }
20
24
 
21
25
  it { should have(312).flights }
22
26
 
@@ -26,7 +30,9 @@ describe Spektrum::Log::File do
26
30
 
27
31
  context 'with data file 3.TLM' do
28
32
 
29
- subject { Spektrum::Log::File.new(data_file('3.TLM')) }
33
+ before(:all) { @file = _3_tlm }
34
+
35
+ subject { @file }
30
36
 
31
37
  it { should have(12).flights }
32
38
 
@@ -36,7 +42,9 @@ describe Spektrum::Log::File do
36
42
 
37
43
  context 'with data file 4.TLM' do
38
44
 
39
- subject { Spektrum::Log::File.new(data_file('4.TLM')) }
45
+ before(:all) { @file = _4_tlm }
46
+
47
+ subject { @file }
40
48
 
41
49
  it { should have(1).flights }
42
50
 
@@ -46,7 +54,9 @@ describe Spektrum::Log::File do
46
54
 
47
55
  context 'with data file GPS.TLM' do
48
56
 
49
- subject { Spektrum::Log::File.new(data_file('GPS.TLM')) }
57
+ before(:all) { @file = gps_tlm }
58
+
59
+ subject { @file }
50
60
 
51
61
  it { should have(2).flights }
52
62
 
@@ -56,7 +66,9 @@ describe Spektrum::Log::File do
56
66
 
57
67
  context 'with data file GPS2.TLM' do
58
68
 
59
- subject { Spektrum::Log::File.new(data_file('GPS2.TLM')) }
69
+ before(:all) { @file = gps2_tlm }
70
+
71
+ subject { @file }
60
72
 
61
73
  it { should have(2).flights }
62
74
 
@@ -66,7 +78,9 @@ describe Spektrum::Log::File do
66
78
 
67
79
  context 'with data file X5-G700.TLM' do
68
80
 
69
- subject { Spektrum::Log::File.new(data_file('X5-G700.TLM')) }
81
+ before(:all) { @file = x5_g700_tlm }
82
+
83
+ subject { @file }
70
84
 
71
85
  it { should have(3).flights }
72
86
 
@@ -76,7 +90,9 @@ describe Spektrum::Log::File do
76
90
 
77
91
  context 'with data file X5-GPS1.TLM' do
78
92
 
79
- subject { Spektrum::Log::File.new(data_file('X5-GPS1.TLM')) }
93
+ before(:all) { @file = x5_gps1_tlm }
94
+
95
+ subject { @file }
80
96
 
81
97
  it { should have(5).flights }
82
98
 
@@ -86,7 +102,9 @@ describe Spektrum::Log::File do
86
102
 
87
103
  context 'with data file X5-GPS2.TLM' do
88
104
 
89
- subject { Spektrum::Log::File.new(data_file('X5-GPS2.TLM')) }
105
+ before(:all) { @file = x5_gps2_tlm }
106
+
107
+ subject { @file }
90
108
 
91
109
  it { should have(2).flights }
92
110
 
@@ -4,11 +4,13 @@ describe Spektrum::Log::Flight do
4
4
 
5
5
  context 'with data file 1.TLM' do
6
6
 
7
- let(:file) { Spektrum::Log::File.new(data_file('1.TLM')) }
7
+ before(:all) { @file = _1_tlm }
8
+
9
+ subject { @file }
8
10
 
9
11
  context 'flight 1' do
10
12
 
11
- subject { file.flights[0] }
13
+ subject { @file.flights[0] }
12
14
 
13
15
  it { should have(4).headers }
14
16
 
@@ -34,7 +36,7 @@ describe Spektrum::Log::Flight do
34
36
 
35
37
  context 'flight 2' do
36
38
 
37
- subject { file.flights[1] }
39
+ subject { @file.flights[1] }
38
40
 
39
41
  it { should have(4).headers }
40
42
 
@@ -52,7 +54,7 @@ describe Spektrum::Log::Flight do
52
54
 
53
55
  context 'flight 3' do
54
56
 
55
- subject { file.flights[2] }
57
+ subject { @file.flights[2] }
56
58
 
57
59
  it { should have(4).headers }
58
60
 
@@ -72,11 +74,13 @@ describe Spektrum::Log::Flight do
72
74
 
73
75
  context 'with data file 2.TLM' do
74
76
 
75
- let(:file) { Spektrum::Log::File.new(data_file('2.TLM')) }
77
+ before(:all) { @file = _2_tlm }
78
+
79
+ subject { @file }
76
80
 
77
81
  context 'flight 1' do
78
82
 
79
- subject { file.flights[0] }
83
+ subject { @file.flights[0] }
80
84
 
81
85
  it { should have(5).headers }
82
86
 
@@ -102,7 +106,7 @@ describe Spektrum::Log::Flight do
102
106
 
103
107
  context 'flight 305' do
104
108
 
105
- subject { file.flights[304] }
109
+ subject { @file.flights[304] }
106
110
 
107
111
  its(:model_name) { should eql('ERW|N XL ULTRALIGHT') }
108
112
 
@@ -114,7 +118,7 @@ describe Spektrum::Log::Flight do
114
118
 
115
119
  context 'flight 306' do
116
120
 
117
- subject { file.flights[305] }
121
+ subject { @file.flights[305] }
118
122
 
119
123
  its(:model_name) { should eql('ERW|N XL ULTRALIGHT') }
120
124
 
@@ -124,7 +128,7 @@ describe Spektrum::Log::Flight do
124
128
 
125
129
  context 'flight 308' do
126
130
 
127
- subject { file.flights[307] }
131
+ subject { @file.flights[307] }
128
132
 
129
133
  its(:model_name) { should eql('ERW|N XL ULTRALIGHT') }
130
134
 
@@ -134,7 +138,7 @@ describe Spektrum::Log::Flight do
134
138
 
135
139
  context 'flight 312' do
136
140
 
137
- subject { file.flights[311] }
141
+ subject { @file.flights[311] }
138
142
 
139
143
  its(:model_name) { should eql('ERW|N XL ULTRALIGHT') }
140
144
 
@@ -146,11 +150,13 @@ describe Spektrum::Log::Flight do
146
150
 
147
151
  context 'with data file 3.TLM' do
148
152
 
149
- let(:file) { Spektrum::Log::File.new(data_file('3.TLM')) }
153
+ before(:all) { @file = _3_tlm }
154
+
155
+ subject { @file }
150
156
 
151
157
  context 'flight 1' do
152
158
 
153
- subject { file.flights[0] }
159
+ subject { @file.flights[0] }
154
160
 
155
161
  it { should have(5).headers }
156
162
 
@@ -166,7 +172,7 @@ describe Spektrum::Log::Flight do
166
172
 
167
173
  context 'flight 2' do
168
174
 
169
- subject { file.flights[1] }
175
+ subject { @file.flights[1] }
170
176
 
171
177
  it { should have(5).headers }
172
178
 
@@ -182,7 +188,7 @@ describe Spektrum::Log::Flight do
182
188
 
183
189
  context 'flight 3' do
184
190
 
185
- subject { file.flights[2] }
191
+ subject { @file.flights[2] }
186
192
 
187
193
  it { should have(5).headers }
188
194
 
@@ -198,7 +204,7 @@ describe Spektrum::Log::Flight do
198
204
 
199
205
  context 'flight 4' do
200
206
 
201
- subject { file.flights[3] }
207
+ subject { @file.flights[3] }
202
208
 
203
209
  it { should have(5).headers }
204
210
 
@@ -214,7 +220,7 @@ describe Spektrum::Log::Flight do
214
220
 
215
221
  context 'flight 5' do
216
222
 
217
- subject { file.flights[4] }
223
+ subject { @file.flights[4] }
218
224
 
219
225
  it { should have(5).headers }
220
226
 
@@ -230,7 +236,7 @@ describe Spektrum::Log::Flight do
230
236
 
231
237
  context 'flight 6' do
232
238
 
233
- subject { file.flights[5] }
239
+ subject { @file.flights[5] }
234
240
 
235
241
  it { should have(5).headers }
236
242
 
@@ -246,7 +252,7 @@ describe Spektrum::Log::Flight do
246
252
 
247
253
  context 'flight 7' do
248
254
 
249
- subject { file.flights[6] }
255
+ subject { @file.flights[6] }
250
256
 
251
257
  it { should have(5).headers }
252
258
 
@@ -262,7 +268,7 @@ describe Spektrum::Log::Flight do
262
268
 
263
269
  context 'flight 8' do
264
270
 
265
- subject { file.flights[7] }
271
+ subject { @file.flights[7] }
266
272
 
267
273
  it { should have(5).headers }
268
274
 
@@ -278,7 +284,7 @@ describe Spektrum::Log::Flight do
278
284
 
279
285
  context 'flight 9' do
280
286
 
281
- subject { file.flights[8] }
287
+ subject { @file.flights[8] }
282
288
 
283
289
  it { should have(5).headers }
284
290
 
@@ -296,11 +302,13 @@ describe Spektrum::Log::Flight do
296
302
 
297
303
  context 'with data file 4.TLM' do
298
304
 
299
- let(:file) { Spektrum::Log::File.new(data_file('4.TLM')) }
305
+ before(:all) { @file = _4_tlm }
306
+
307
+ subject { @file }
300
308
 
301
309
  context 'flight 1' do
302
310
 
303
- subject { file.flights[0] }
311
+ subject { @file.flights[0] }
304
312
 
305
313
  it { should have(5).headers }
306
314
 
@@ -340,11 +348,13 @@ describe Spektrum::Log::Flight do
340
348
 
341
349
  context 'with data file GPS.TLM' do
342
350
 
343
- let(:file) { Spektrum::Log::File.new(data_file('GPS.TLM')) }
351
+ before(:all) { @file = gps_tlm }
352
+
353
+ subject { @file }
344
354
 
345
355
  context 'flight 1' do
346
356
 
347
- subject { file.flights[0] }
357
+ subject { @file.flights[0] }
348
358
 
349
359
  its(:duration) { should be_within(1).of(697) }
350
360
 
@@ -364,7 +374,7 @@ describe Spektrum::Log::Flight do
364
374
 
365
375
  context 'flight 2' do
366
376
 
367
- subject { file.flights[1] }
377
+ subject { @file.flights[1] }
368
378
 
369
379
  its(:duration) { should be_within(1).of(733) }
370
380
 
@@ -386,11 +396,13 @@ describe Spektrum::Log::Flight do
386
396
 
387
397
  context 'with data file GPS2.TLM' do
388
398
 
389
- let(:file) { Spektrum::Log::File.new(data_file('GPS2.TLM')) }
399
+ before(:all) { @file = gps2_tlm }
400
+
401
+ subject { @file }
390
402
 
391
403
  context 'flight 1' do
392
404
 
393
- subject { file.flights[0] }
405
+ subject { @file.flights[0] }
394
406
 
395
407
  its(:duration) { should be_within(1).of(503) }
396
408
 
@@ -410,7 +422,7 @@ describe Spektrum::Log::Flight do
410
422
 
411
423
  context 'flight 2' do
412
424
 
413
- subject { file.flights[1] }
425
+ subject { @file.flights[1] }
414
426
 
415
427
  its(:duration) { should be_within(1).of(347) }
416
428
 
@@ -430,11 +442,13 @@ describe Spektrum::Log::Flight do
430
442
 
431
443
  context 'with data file X5-G700.TLM' do
432
444
 
433
- let(:file) { Spektrum::Log::File.new(data_file('X5-G700.TLM')) }
445
+ before(:all) { @file = x5_g700_tlm }
446
+
447
+ subject { @file }
434
448
 
435
449
  context 'flight 1' do
436
450
 
437
- subject { file.flights[0] }
451
+ subject { @file.flights[0] }
438
452
 
439
453
  its(:duration) { should be_within(0.1).of(323.6) }
440
454
 
@@ -444,7 +458,7 @@ describe Spektrum::Log::Flight do
444
458
 
445
459
  context 'flight 2' do
446
460
 
447
- subject { file.flights[1] }
461
+ subject { @file.flights[1] }
448
462
 
449
463
  its(:duration) { should be_within(0.1).of(323.8) }
450
464
 
@@ -454,7 +468,7 @@ describe Spektrum::Log::Flight do
454
468
 
455
469
  context 'flight 3' do
456
470
 
457
- subject { file.flights[2] }
471
+ subject { @file.flights[2] }
458
472
 
459
473
  its(:duration) { should be_within(0.1).of(325.5) }
460
474
 
@@ -466,17 +480,19 @@ describe Spektrum::Log::Flight do
466
480
 
467
481
  context 'with data file X5-GPS1.TLM' do
468
482
 
469
- let(:file) { Spektrum::Log::File.new(data_file('X5-GPS1.TLM')) }
483
+ before(:all) { @file = x5_gps1_tlm }
484
+
485
+ subject { @file }
470
486
 
471
487
  its 'flights should contain some gps coordinates' do
472
488
 
473
- file.flights.select { |f| f.gps1_records? }.should have(4).flights
489
+ @file.flights.select { |f| f.gps1_records? }.should have(4).flights
474
490
 
475
491
  end
476
492
 
477
493
  its 'longitudes should all be negative' do
478
494
 
479
- file.flights.each do |flight|
495
+ @file.flights.each do |flight|
480
496
 
481
497
  flight.gps1_records.each do |gps1|
482
498
  gps1.longitude.should be < 0.0
@@ -488,7 +504,7 @@ describe Spektrum::Log::Flight do
488
504
 
489
505
  context 'flight 1' do
490
506
 
491
- subject { file.flights[0] }
507
+ subject { @file.flights[0] }
492
508
 
493
509
  its(:duration) { should be_within(0.1).of(318.6) }
494
510
 
@@ -498,7 +514,7 @@ describe Spektrum::Log::Flight do
498
514
 
499
515
  context 'flight 2' do
500
516
 
501
- subject { file.flights[1] }
517
+ subject { @file.flights[1] }
502
518
 
503
519
  its(:duration) { should be_within(0.1).of(327.5) }
504
520
 
@@ -508,7 +524,7 @@ describe Spektrum::Log::Flight do
508
524
 
509
525
  context 'flight 3' do
510
526
 
511
- subject { file.flights[2] }
527
+ subject { @file.flights[2] }
512
528
 
513
529
  its(:duration) { should be_within(0.1).of(326.5) }
514
530
 
@@ -518,7 +534,7 @@ describe Spektrum::Log::Flight do
518
534
 
519
535
  context 'flight 4' do
520
536
 
521
- subject { file.flights[3] }
537
+ subject { @file.flights[3] }
522
538
 
523
539
  its(:duration) { should eql(0.0) }
524
540
 
@@ -528,7 +544,7 @@ describe Spektrum::Log::Flight do
528
544
 
529
545
  context 'flight 5' do
530
546
 
531
- subject { file.flights[4] }
547
+ subject { @file.flights[4] }
532
548
 
533
549
  its(:duration) { should be_within(0.1).of(332.6) }
534
550
 
@@ -540,17 +556,19 @@ describe Spektrum::Log::Flight do
540
556
 
541
557
  context 'with data file X5-GPS2.TLM' do
542
558
 
543
- let(:file) { Spektrum::Log::File.new(data_file('X5-GPS2.TLM')) }
559
+ before(:all) { @file = x5_gps2_tlm }
560
+
561
+ subject { @file }
544
562
 
545
563
  its 'flights should contain some gps coordinates' do
546
564
 
547
- file.flights.select { |f| f.gps1_records? }.should have(2).flights
565
+ @file.flights.select { |f| f.gps1_records? }.should have(2).flights
548
566
 
549
567
  end
550
568
 
551
569
  its 'longitudes should all be negative' do
552
570
 
553
- file.flights.each do |flight|
571
+ @file.flights.each do |flight|
554
572
 
555
573
  flight.gps1_records.each do |gps1|
556
574
  gps1.longitude.should be < 0.0
@@ -562,7 +580,7 @@ describe Spektrum::Log::Flight do
562
580
 
563
581
  context 'flight 1' do
564
582
 
565
- subject { file.flights[0] }
583
+ subject { @file.flights[0] }
566
584
 
567
585
  its(:duration) { should be_within(0.1).of(328.6) }
568
586
 
@@ -574,7 +592,7 @@ describe Spektrum::Log::Flight do
574
592
 
575
593
  context 'flight 2' do
576
594
 
577
- subject { file.flights[1] }
595
+ subject { @file.flights[1] }
578
596
 
579
597
  its(:duration) { should be_within(0.1).of(299.1) }
580
598
 
@@ -36,3 +36,14 @@ def invalid_data_files
36
36
  invalid << __FILE__
37
37
  invalid << 'NOFILE.TLM'
38
38
  end
39
+
40
+ def _1_tlm; Spektrum::Log::File.new(data_file('1.TLM')) end
41
+ def _2_tlm; Spektrum::Log::File.new(data_file('2.TLM')) end
42
+ def _3_tlm; Spektrum::Log::File.new(data_file('3.TLM')) end
43
+ def _4_tlm; Spektrum::Log::File.new(data_file('4.TLM')) end
44
+ def gps_tlm; Spektrum::Log::File.new(data_file('GPS.TLM')) end
45
+ def gps2_tlm; Spektrum::Log::File.new(data_file('GPS2.TLM')) end
46
+ def x5_g700_tlm; Spektrum::Log::File.new(data_file('X5-G700.TLM')) end
47
+ def x5_gps1_tlm; Spektrum::Log::File.new(data_file('X5-GPS1.TLM')) end
48
+ def x5_gps2_tlm; Spektrum::Log::File.new(data_file('X5-GPS2.TLM')) end
49
+ def x5_gps3_tlm; Spektrum::Log::File.new(data_file('X5-GPS3.TLM')) end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spektrum-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Veys
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-06 00:00:00.000000000 Z
11
+ date: 2013-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print