vatsim_online 0.8.2 → 0.8.3

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
2
  SHA1:
3
- metadata.gz: 5c84444eff827ec17c1b43911026b508b6c95de8
4
- data.tar.gz: a1772f912ac88ebc8b4f915282f96d0ccef1ecf3
3
+ metadata.gz: 2d6ff206e783e76208736015dd0192e0e7a24b44
4
+ data.tar.gz: 8c4cf4a435d97a09f469318d5270f98366d03468
5
5
  SHA512:
6
- metadata.gz: 7af3966ae44350d64cc965db7a149887c92b2943dea7f336a5e5a9dfafd53401a78d1c341e14bfea294b43b7bfcde6e2bc0d6f245be34fbdd0eaedaf9bcc3878
7
- data.tar.gz: 5430a427e96e550635f8a0c91bd5707916e1aa771370516ce4983342e054d5b58a3cd0f836d44deedb4270e60064eadce2900b21a1b269d7caa613151daa1f98
6
+ metadata.gz: 183387efe4206e8e54deb92efbe38e7a9605067269e7eea960b5f024be39d416cac6795b7dae669f57957a1b9cbad04b0fcf05a9800cb4ead9e0569f5d146891
7
+ data.tar.gz: 47db87f81ad25fc410e237c7342c3b4fd21ab5841a106559529f5f927a27abe9e89302e6244dbd061c456e151ff85ed27c1aa9f5e4ff20ac0f3509db1bdd13fc
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Changelog
4
4
 
5
+ ### v. 0.8.3 - 10 April 2014
6
+
7
+ * Fix stale data bug, change data fallback logic
8
+
5
9
  ### v. 0.8.2 - 5 October 2013
6
10
 
7
11
  * Handle undetermined position when drawing gcmap
data/README.md CHANGED
@@ -332,6 +332,10 @@ the same result.
332
332
 
333
333
  ## Changelog
334
334
 
335
+ ### v. 0.8.3 - 10 April 2014
336
+
337
+ * Fix stale data bug, change data fallback logic
338
+
335
339
  ### v. 0.8.2 - 5 October 2013
336
340
 
337
341
  * Handle undetermined position when drawing gcmap
@@ -6,7 +6,9 @@ module VatsimTools
6
6
 
7
7
  STATUS_URL = "http://status.vatsim.net/status.txt"
8
8
  LOCAL_STATUS = "#{Dir.tmpdir}/vatsim_status.txt"
9
+ LOCAL_STATUS_BAK = "#{Dir.tmpdir}/vatsim_status_bak.txt"
9
10
  LOCAL_DATA = "#{Dir.tmpdir}/vatsim_data.txt"
11
+ LOCAL_DATA_BAK = "#{Dir.tmpdir}/vatsim_data_bak.txt"
10
12
 
11
13
  def initialize
12
14
  data_file
@@ -14,9 +16,10 @@ module VatsimTools
14
16
 
15
17
  def create_status_tempfile
16
18
  curl = Curl::Easy.new(STATUS_URL)
17
- curl.timeout = 5
19
+ curl.timeout = 20
18
20
  curl.perform
19
21
  curl = curl.body_str
22
+ create_status_backup if File.exists?(LOCAL_STATUS)
20
23
  status = Tempfile.new('vatsim_status')
21
24
  File.rename status.path, LOCAL_STATUS
22
25
  File.open(LOCAL_STATUS, "w+") {|f| f.write(curl) }
@@ -26,10 +29,17 @@ module VatsimTools
26
29
  dummy_status
27
30
  rescue Curl::Err::TimeoutError
28
31
  dummy_status
29
- rescue
32
+ rescue
30
33
  dummy_status
31
34
  rescue Exception
32
- dummy_status
35
+ dummy_status
36
+ end
37
+
38
+ def create_status_backup
39
+ source = LOCAL_STATUS
40
+ target = LOCAL_STATUS_BAK
41
+ FileUtils.cp_r source, target
42
+ File.chmod(0777, LOCAL_STATUS_BAK)
33
43
  end
34
44
 
35
45
  def read_status_tempfile
@@ -51,9 +61,10 @@ module VatsimTools
51
61
 
52
62
  def create_local_data_file
53
63
  curl = Curl::Easy.new(servers.sample)
54
- curl.timeout = 5
64
+ curl.timeout = 20
55
65
  curl.perform
56
66
  curl = curl.body_str
67
+ create_data_backup if File.exists?(LOCAL_DATA)
57
68
  data = Tempfile.new('vatsim_data', :encoding => 'utf-8')
58
69
  File.rename data.path, LOCAL_DATA
59
70
  data = curl.gsub(/["]/, '\s').encode!('UTF-16', 'UTF-8', :invalid => :replace, :replace => '').encode!('UTF-8', 'UTF-16')
@@ -69,7 +80,14 @@ module VatsimTools
69
80
  rescue
70
81
  gem_data_file
71
82
  rescue Exception
72
- gem_data_file
83
+ gem_data_file
84
+ end
85
+
86
+ def create_data_backup
87
+ source = LOCAL_DATA
88
+ target = LOCAL_DATA_BAK
89
+ FileUtils.cp_r source, target
90
+ File.chmod(0777, LOCAL_DATA_BAK)
73
91
  end
74
92
 
75
93
  def read_local_datafile
@@ -78,36 +96,22 @@ module VatsimTools
78
96
  difference > 2 ? create_local_data_file : data.read
79
97
  end
80
98
 
81
- def data_file
99
+ def data_file
82
100
  File.exists?(LOCAL_DATA) ? read_local_datafile : create_local_data_file
83
- LOCAL_DATA
101
+ LOCAL_DATA
84
102
  end
85
103
 
86
104
  def gem_data_file
87
- # path = File.realpath("lib/vatsim_online/vatsim_data.txt")
88
- # gem_data = File.open(path, :encoding => 'iso-8859-15').read
89
- # data = Tempfile.new('vatsim_data', :encoding => 'iso-8859-15')
90
- # data.write(gem_data.gsub(/["]/, '\s').force_encoding('iso-8859-15'))
91
- # File.rename data.path, "#{Dir.tmpdir}/vatsim_data.txt"
92
-
93
- source = File.join(Gem.loaded_specs["vatsim_online"].full_gem_path, "spec", "vatsim_data.txt")
94
- target = "#{Dir.tmpdir}/vatsim_data.txt"
105
+ source = LOCAL_DATA_BAK
106
+ target = LOCAL_DATA
95
107
  FileUtils.cp_r source, target
96
-
97
108
  File.chmod(0777, LOCAL_DATA)
98
109
  end
99
110
 
100
111
  def dummy_status
101
- # path = File.realpath("lib/vatsim_online/vatsim_status.txt")
102
- # gem_data = File.open(path, :encoding => 'iso-8859-15').read
103
- # data = Tempfile.new('vatsim_status', :encoding => 'iso-8859-15')
104
- # data.write(gem_data.gsub(/["]/, '\s').force_encoding('iso-8859-15'))
105
- # File.rename data.path, "#{Dir.tmpdir}/vatsim_status.txt"
106
-
107
- source = File.join(Gem.loaded_specs["vatsim_online"].full_gem_path, "spec", "vatsim_status.txt")
108
- target = "#{Dir.tmpdir}/vatsim_status.txt"
112
+ source = LOCAL_STATUS_BAK
113
+ target = LOCAL_STATUS
109
114
  FileUtils.cp_r source, target
110
-
111
115
  File.chmod(0777, LOCAL_STATUS)
112
116
  end
113
117
 
@@ -1,3 +1,3 @@
1
1
  module VatsimOnline
2
- VERSION = "0.8.2"
2
+ VERSION = "0.8.3"
3
3
  end
@@ -17,16 +17,16 @@
17
17
  120218:NOTCP
18
18
  ;
19
19
  url0=http://www.pcflyer.net/DataFeed/vatsim-data.txt
20
- url0=http://www.klain.net/sidata/vatsim-data.txt
21
20
  url0=http://fsproshop.com/servinfo/vatsim-data.txt
22
21
  url0=http://info.vroute.net/vatsim-data.txt
23
22
  url0=http://data.vattastic.com/vatsim-data.txt
23
+ url0=http://vatsim.aircharts.org/vatsim-data.txt
24
24
  ;
25
- url1=http://www.net-flyer.net/DataFeed/vatsim-servers.txt
26
- url1=http://www.klain.net/sidata/vatsim-servers.txt
25
+ url1=http://www.pcflyer.net/DataFeed/vatsim-servers.txt
27
26
  url1=http://fsproshop.com/servinfo/vatsim-servers.txt
28
27
  url1=http://info.vroute.net/vatsim-servers.txt
29
28
  url1=http://data.vattastic.com/vatsim-servers.txt
29
+ url1=http://vatsim.aircharts.org/vatsim-servers.txt
30
30
  ;
31
31
  metar0=http://metar.vatsim.net/metar.php
32
32
  ;
@@ -34,4 +34,4 @@ atis0=http://stats.vatsim.net/atis.html
34
34
  ;
35
35
  user0=http://stats.vatsim.net/search_id.php
36
36
  ;
37
- ; END
37
+ ; END
@@ -22,7 +22,7 @@ Gem::Specification.new do |gem|
22
22
  gem.add_development_dependency "libnotify"
23
23
  gem.add_development_dependency "rb-inotify"
24
24
  gem.add_development_dependency "guard-rspec"
25
- gem.add_dependency "curb", "~> 0.8.4"
25
+ gem.add_dependency "curb", "~> 0.8.5"
26
26
  gem.add_dependency "time_diff", "~> 0.3.0"
27
27
  gem.add_dependency "gcmapper", "~> 0.4.0"
28
28
  end
metadata CHANGED
@@ -1,139 +1,139 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vatsim_online
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Svilen Vassilev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-05 00:00:00.000000000 Z
11
+ date: 2014-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: guard
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
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
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: libnotify
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rb-inotify
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: guard-rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: curb
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 0.8.4
103
+ version: 0.8.5
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 0.8.4
110
+ version: 0.8.5
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: time_diff
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: 0.3.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ~>
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: 0.3.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: gcmapper
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: 0.4.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: 0.4.0
139
139
  description: Selectively pulls and parses Vatsim online stations data. Essentially
@@ -147,8 +147,8 @@ executables: []
147
147
  extensions: []
148
148
  extra_rdoc_files: []
149
149
  files:
150
- - .gitignore
151
- - .travis.yml
150
+ - ".gitignore"
151
+ - ".travis.yml"
152
152
  - CHANGELOG.md
153
153
  - CONTRIBUTING.md
154
154
  - Gemfile
@@ -185,17 +185,17 @@ require_paths:
185
185
  - lib
186
186
  required_ruby_version: !ruby/object:Gem::Requirement
187
187
  requirements:
188
- - - '>='
188
+ - - ">="
189
189
  - !ruby/object:Gem::Version
190
190
  version: '0'
191
191
  required_rubygems_version: !ruby/object:Gem::Requirement
192
192
  requirements:
193
- - - '>='
193
+ - - ">="
194
194
  - !ruby/object:Gem::Version
195
195
  version: '0'
196
196
  requirements: []
197
197
  rubyforge_project:
198
- rubygems_version: 2.0.3
198
+ rubygems_version: 2.2.2
199
199
  signing_key:
200
200
  specification_version: 4
201
201
  summary: Selectively pulls and parses Vatsim online stations data. Essentially it's