metar-parser 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 96aed5c791fc3274cb9758d30633b5f4319b07f4
4
- data.tar.gz: 778df304d83213264a12b441004b9da5cde52fb4
2
+ SHA256:
3
+ metadata.gz: c2221be718069fb9c9ed4791bf08348dd5faf5aaad09b1d3d0275cf74e2f3641
4
+ data.tar.gz: 67b70702eb6cf48f4f8e1629c259728775dfb3a4a87aadee70f19951708aca01
5
5
  SHA512:
6
- metadata.gz: 4ff94e01c7441dee8221603c924e30e087681de5326306641c62b20d747093844ea26f876f49cedd391c129b23a230e418dcf195750ee0c0c0b932ec1052847e
7
- data.tar.gz: 3f0f8b04af21560c7cc620c557d51b2b556f2a84e56cc57af321d2c7183359a527f36bfb075d6eda872a4953b861e4d03aee47e077c517a8821af37f4375d718
6
+ metadata.gz: 71168e1083737aab11b6af0bf0f8ecfd62109896805acc79aa8a15e7d78a217aca97902f657ae1c004f5047acfe478a185cd3c13ba23b034e35d62f7571390f3
7
+ data.tar.gz: bea84d9351eaf9facc647b6ee78fc0fd964d224818af062dd729c3f7ad42b18bc56315d23a0d548b7585f35fcc19b0a5636470e78f512a179bbe77ce29464303
@@ -88,7 +88,7 @@ module Metar
88
88
  end
89
89
 
90
90
  def disconnect
91
- return if @@connection.nil
91
+ return if @@connection.nil?
92
92
  @@connection.close
93
93
  @@connection = nil
94
94
  end
@@ -101,6 +101,7 @@ module Metar
101
101
  connection.retrbinary("RETR #{ cccc }.TXT", 1024) do |chunk|
102
102
  s << chunk
103
103
  end
104
+ disconnect
104
105
  return s
105
106
  rescue Net::FTPPermError, Net::FTPTempError, EOFError => e
106
107
  connect
@@ -2,7 +2,7 @@ module Metar
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 4
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -159,24 +159,28 @@ describe Metar::Raw::Noaa do
159
159
  context '.fetch' do
160
160
  before do
161
161
  allow(ftp).to receive(:retrbinary).and_yield("chunk 1\n").and_yield("chunk 2\n")
162
+ allow(ftp).to receive(:close)
162
163
  end
163
164
 
164
165
  it 'uses the connection' do
165
166
  Metar::Raw::Noaa.fetch('the_cccc')
166
167
 
167
168
  expect(Net::FTP).to have_received(:new)
169
+ expect(ftp).to have_received(:close)
168
170
  end
169
171
 
170
172
  it 'downloads the raw report' do
171
173
  Metar::Raw::Noaa.fetch('the_cccc')
172
174
 
173
175
  expect(ftp).to have_received(:retrbinary).with('RETR the_cccc.TXT', kind_of(Fixnum))
176
+ expect(ftp).to have_received(:close)
174
177
  end
175
178
 
176
179
  it 'returns the data' do
177
180
  raw = Metar::Raw::Noaa.fetch('the_cccc')
178
181
 
179
182
  expect(raw).to eq("chunk 1\nchunk 2\n")
183
+ expect(ftp).to have_received(:close)
180
184
  end
181
185
 
182
186
  context 'if retrieval fails once' do
@@ -195,6 +199,7 @@ describe Metar::Raw::Noaa do
195
199
  raw = Metar::Raw::Noaa.fetch('the_cccc')
196
200
 
197
201
  expect(raw).to eq("chunk 1\nchunk 2\n")
202
+ expect(ftp).to have_received(:close)
198
203
  end
199
204
  end
200
205
 
@@ -206,6 +211,7 @@ describe Metar::Raw::Noaa do
206
211
  it 'fails with an error' do
207
212
  expect do
208
213
  Metar::Raw::Noaa.fetch('the_cccc')
214
+ expect(ftp).to have_received(:close)
209
215
  end.to raise_error(RuntimeError, /failed 2 times/)
210
216
  end
211
217
  end
@@ -217,6 +223,7 @@ describe Metar::Raw::Noaa do
217
223
 
218
224
  before do
219
225
  allow(ftp).to receive(:retrbinary).and_yield(noaa_metar)
226
+ allow(ftp).to receive(:close)
220
227
  end
221
228
 
222
229
  subject { Metar::Raw::Noaa.new(cccc) }
@@ -225,6 +232,7 @@ describe Metar::Raw::Noaa do
225
232
  subject.metar
226
233
 
227
234
  expect(ftp).to have_received(:retrbinary).with("RETR #{cccc}.TXT", 1024)
235
+ expect(ftp).to have_received(:close)
228
236
  end
229
237
 
230
238
  it 'sets data to the returned value' do
@@ -238,8 +246,8 @@ describe Metar::Raw::Noaa do
238
246
  let(:raw_time) { "2016/03/31 23:59" }
239
247
  let(:raw_metar) { "OPPS 312359Z 23006KT 4000 HZ SCT040 SCT100 17/12 Q1011" }
240
248
 
241
- specify "are parsed as UTC" do
242
- expect(subject.time.zone).to eq("UTC")
249
+ specify "are parsed as UTC/GMT" do
250
+ expect(subject.time.zone).to eq("UTC").or eq("GMT")
243
251
  end
244
252
 
245
253
  context "across month rollover" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metar-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Yates
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-15 00:00:00.000000000 Z
11
+ date: 2019-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 3.2.0
47
+ version: '3.2'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 3.2.0
54
+ version: '3.2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: simplecov
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -237,28 +237,28 @@ required_rubygems_version: !ruby/object:Gem::Requirement
237
237
  version: '0'
238
238
  requirements: []
239
239
  rubyforge_project: nowarning
240
- rubygems_version: 2.4.5
240
+ rubygems_version: 2.7.6
241
241
  signing_key:
242
242
  specification_version: 4
243
243
  summary: A Ruby gem for worldwide weather reports
244
244
  test_files:
245
+ - spec/parser_spec.rb
245
246
  - spec/station_spec.rb
246
- - spec/data/speed_spec.rb
247
+ - spec/i18n_spec.rb
248
+ - spec/raw_spec.rb
249
+ - spec/report_spec.rb
250
+ - spec/data/pressure_spec.rb
247
251
  - spec/data/density_altitude_spec.rb
248
- - spec/data/sky_condition_spec.rb
249
- - spec/data/distance_spec.rb
250
252
  - spec/data/remark_spec.rb
251
- - spec/data/temperature_spec.rb
252
253
  - spec/data/weather_phenomenon_spec.rb
253
- - spec/data/lightning_spec.rb
254
- - spec/data/variable_wind_spec.rb
254
+ - spec/data/sky_condition_spec.rb
255
255
  - spec/data/visibility_remark_spec.rb
256
- - spec/data/wind_spec.rb
257
- - spec/data/pressure_spec.rb
258
256
  - spec/data/runway_visible_range_spec.rb
257
+ - spec/data/variable_wind_spec.rb
258
+ - spec/data/wind_spec.rb
259
+ - spec/data/lightning_spec.rb
259
260
  - spec/data/vertical_visibility_spec.rb
260
261
  - spec/data/visibility_spec.rb
261
- - spec/i18n_spec.rb
262
- - spec/raw_spec.rb
263
- - spec/parser_spec.rb
264
- - spec/report_spec.rb
262
+ - spec/data/temperature_spec.rb
263
+ - spec/data/speed_spec.rb
264
+ - spec/data/distance_spec.rb