vatsim_online_redux 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/vatsim_online/data_downloader.rb +4 -4
- data/lib/vatsim_online/version.rb +1 -1
- data/spec/data_downloader_spec.rb +15 -15
- data/spec/data_downloader_spec_helper.rb +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd68ccf12195db00f19d4d0b1dc2b63f37398a91acc7b31ec39431509a824eb6
|
4
|
+
data.tar.gz: d8b59e279987e9556a46461673c51edf822b74f9babf07fa5b09f5e981a2bd78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d0623b2c5eec7131dc915da80541b89c9a3b289d4a7e7560353dd1d15b2765bfca31ebfdb87c2512293463131a89d4a4cd84a1f9168546e7d2977e7d21fc183
|
7
|
+
data.tar.gz: 111171a1440fa950db5d79a5a2dfd0076cf50ed7bd2eb4fcd3a765bf6b19e475c1c5df29ce7046ce168953c6d9952d06bbac804b5fe6a0a3d91d1e2c042d5c73
|
data/CHANGELOG.md
CHANGED
@@ -24,7 +24,7 @@ require 'fileutils'
|
|
24
24
|
request = Net::HTTP::Get.new(uri.path)
|
25
25
|
http.use_ssl = (uri.scheme == 'https')
|
26
26
|
data = http.request(request).body.gsub("\n", '')
|
27
|
-
create_status_backup if File.
|
27
|
+
create_status_backup if File.exist?(LOCAL_STATUS)
|
28
28
|
File.write(LOCAL_STATUS, data)
|
29
29
|
File.chmod(0777, LOCAL_STATUS)
|
30
30
|
dummy_status if data.include? "<html><head>"
|
@@ -55,7 +55,7 @@ require 'fileutils'
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def status_file
|
58
|
-
File.
|
58
|
+
File.exist?(LOCAL_STATUS) ? read_status_tempfile : create_status_tempfile
|
59
59
|
LOCAL_STATUS
|
60
60
|
end
|
61
61
|
|
@@ -71,7 +71,7 @@ require 'fileutils'
|
|
71
71
|
request = Net::HTTP::Get.new(uri.path)
|
72
72
|
http.use_ssl = (uri.scheme == 'https')
|
73
73
|
req_data = http.request(request).body
|
74
|
-
create_data_backup if File.
|
74
|
+
create_data_backup if File.exist?(LOCAL_DATA)
|
75
75
|
File.open(LOCAL_DATA, "w+") {|f| f.write(req_data.force_encoding('UTF-8'))}
|
76
76
|
File.chmod(0777, LOCAL_DATA)
|
77
77
|
gem_data_file if req_data.include? "<html><head>"
|
@@ -105,7 +105,7 @@ require 'fileutils'
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def data_file
|
108
|
-
File.
|
108
|
+
File.exist?(LOCAL_DATA) ? read_local_datafile : create_local_data_file
|
109
109
|
LOCAL_DATA
|
110
110
|
end
|
111
111
|
|
@@ -17,9 +17,9 @@ describe VatsimTools::DataDownloader do
|
|
17
17
|
describe "create_status_tempfile" do
|
18
18
|
it "should create a file" do
|
19
19
|
delete_local_files
|
20
|
-
File.
|
20
|
+
File.exist?(LOCAL_STATUS).should be false
|
21
21
|
target.new.create_status_tempfile
|
22
|
-
File.
|
22
|
+
File.exist?(LOCAL_STATUS).should be true
|
23
23
|
status = File.open(LOCAL_STATUS)
|
24
24
|
status.path.should eq("#{Dir.tmpdir}/vatsim_online/vatsim_status.json")
|
25
25
|
status.size.should be > 100
|
@@ -30,7 +30,7 @@ describe VatsimTools::DataDownloader do
|
|
30
30
|
describe "read_status_tempfile" do
|
31
31
|
it "should confirm a file exists" do
|
32
32
|
target.new.read_status_tempfile
|
33
|
-
File.
|
33
|
+
File.exist?(LOCAL_STATUS).should be true
|
34
34
|
status = File.open(LOCAL_STATUS)
|
35
35
|
status.size.should be > 100
|
36
36
|
status.close
|
@@ -40,18 +40,18 @@ describe VatsimTools::DataDownloader do
|
|
40
40
|
describe "status_file" do
|
41
41
|
it "should return status.txt path" do
|
42
42
|
delete_local_files
|
43
|
-
File.
|
43
|
+
File.exist?(LOCAL_STATUS).should be false
|
44
44
|
target.new.status_file.class.should eq(String)
|
45
45
|
target.new.status_file.should include("vatsim_status.json")
|
46
46
|
target.new.status_file.should eq(LOCAL_STATUS)
|
47
47
|
target.new.status_file.should eq("#{Dir.tmpdir}/vatsim_online/vatsim_status.json")
|
48
|
-
File.
|
48
|
+
File.exist?(LOCAL_STATUS).should be true
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
52
|
describe "servers" do
|
53
53
|
it "should contain an array of server URLs" do
|
54
|
-
File.
|
54
|
+
File.exist?(LOCAL_STATUS).should be true
|
55
55
|
target.new.servers.class.should eq(Array)
|
56
56
|
target.new.servers.size.should eq(1)
|
57
57
|
end
|
@@ -60,9 +60,9 @@ describe VatsimTools::DataDownloader do
|
|
60
60
|
describe "create_local_data_file" do
|
61
61
|
it "should confirm a file exists" do
|
62
62
|
delete_local_files
|
63
|
-
File.
|
63
|
+
File.exist?(LOCAL_DATA).should be false
|
64
64
|
target.new.create_local_data_file
|
65
|
-
File.
|
65
|
+
File.exist?(LOCAL_DATA).should be true
|
66
66
|
data = File.open(LOCAL_DATA)
|
67
67
|
data.path.should eq("#{Dir.tmpdir}/vatsim_online/vatsim_data.json")
|
68
68
|
data.size.should be > 100
|
@@ -73,7 +73,7 @@ describe VatsimTools::DataDownloader do
|
|
73
73
|
describe "read_local_datafile" do
|
74
74
|
it "should confirm a file exists" do
|
75
75
|
target.new.read_local_datafile
|
76
|
-
File.
|
76
|
+
File.exist?(LOCAL_DATA).should be true
|
77
77
|
data = File.open(LOCAL_DATA)
|
78
78
|
data.size.should be > 100
|
79
79
|
data.close
|
@@ -83,23 +83,23 @@ describe VatsimTools::DataDownloader do
|
|
83
83
|
describe "data_file" do
|
84
84
|
it "should contain file path" do
|
85
85
|
delete_local_files
|
86
|
-
File.
|
86
|
+
File.exist?(LOCAL_DATA).should be false
|
87
87
|
target.new.data_file.class.should eq(String)
|
88
88
|
target.new.data_file.should include("vatsim_data.json")
|
89
89
|
target.new.data_file.should eq(LOCAL_DATA)
|
90
90
|
target.new.data_file.should eq("#{Dir.tmpdir}/vatsim_online/vatsim_data.json")
|
91
|
-
File.
|
91
|
+
File.exist?(LOCAL_DATA).should be true
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
95
|
describe "new" do
|
96
96
|
it "should return" do
|
97
97
|
delete_local_files
|
98
|
-
File.
|
99
|
-
File.
|
98
|
+
File.exist?(LOCAL_DATA).should be false
|
99
|
+
File.exist?(LOCAL_STATUS).should be false
|
100
100
|
target.new
|
101
|
-
File.
|
102
|
-
File.
|
101
|
+
File.exist?(LOCAL_DATA).should be true
|
102
|
+
File.exist?(LOCAL_STATUS).should be true
|
103
103
|
data = File.open(LOCAL_DATA)
|
104
104
|
status = File.open(LOCAL_DATA)
|
105
105
|
data.size.should be > 100
|
@@ -1,10 +1,10 @@
|
|
1
1
|
def delete_local_files
|
2
2
|
local_Status = "#{Dir.tmpdir}/vatsim_online/vatsim_status.json"
|
3
3
|
lOCAL_DATA = "#{Dir.tmpdir}/vatsim_online/vatsim_data.json"
|
4
|
-
if File.
|
4
|
+
if File.exist?(local_Status)
|
5
5
|
File.delete(local_Status)
|
6
6
|
end
|
7
|
-
if File.
|
7
|
+
if File.exist?(lOCAL_DATA)
|
8
8
|
File.delete(lOCAL_DATA)
|
9
9
|
end
|
10
10
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vatsim_online_redux
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Svilen Vassilev
|
8
8
|
- Alex Dent
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-06-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -151,7 +151,7 @@ homepage: https://github.com/aldent95/vatsim_online_redux
|
|
151
151
|
licenses:
|
152
152
|
- MIT
|
153
153
|
metadata: {}
|
154
|
-
post_install_message:
|
154
|
+
post_install_message:
|
155
155
|
rdoc_options: []
|
156
156
|
require_paths:
|
157
157
|
- lib
|
@@ -166,8 +166,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: '0'
|
168
168
|
requirements: []
|
169
|
-
rubygems_version: 3.
|
170
|
-
signing_key:
|
169
|
+
rubygems_version: 3.4.12
|
170
|
+
signing_key:
|
171
171
|
specification_version: 4
|
172
172
|
summary: Updated version of original gem by Svilen Vassilev. Selectively pulls and
|
173
173
|
parses Vatsim online stations data. Essentially it's a 'who's online' library, capable
|