wifi-watch 1.0.0 → 1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 697446ea552c7a3457679d63683eca662ffb8f3a
4
- data.tar.gz: cbb35fe686254583710005731b65469fb9118eaf
3
+ metadata.gz: cfaa11569827201e5cfdbd4c2a12a6ae39821200
4
+ data.tar.gz: 2008abb7d60341ac78ae9795561dace06a88328b
5
5
  SHA512:
6
- metadata.gz: ba64b8fa9cb33a576390acaaf3807c12b3a47a6b23a2a7babe9dd1527412a4d80033c7e86b5f6f9fa457701f8ff3597740e6c13d38b11d649343945a607cbba3
7
- data.tar.gz: 426294ddb194941801ff65d1ca5969595b9b8311d4d67e866ec1febcd38054ac6e3817cf6e623f6b79aa4663398e64373162eb61605708373e72f421f08698d5
6
+ metadata.gz: 647b3eda4408818db7cab2d11c50b414d9ba51310a2e4b006756f659e7bc92e5c7250044d4d7266b06366c7d289b326477fe3affae33be0fa4977e05de962f61
7
+ data.tar.gz: 95ae3066b5f008fa73aabfe372f729ca7ad625c6bdda2869fdae1fc9da4990546f44b11e1eeaaa69512b693c5ce48789a1ed397610f23cdb0c8b6847970ce538
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  *.gem
2
+ /test/results/
data/README.md CHANGED
@@ -33,15 +33,29 @@ on a moment to moment basis.
33
33
 
34
34
  ### Installation
35
35
 
36
+ You can install the gem from rubygems.org
37
+
38
+ ```
39
+ gem install wifi-watch
40
+ ```
41
+
36
42
  wifi-watch is a stand alone ruby script which will run with
37
- any ruby version and has no dependencies. Clone the repository
38
- and copy wifi-watch into your path.
43
+ any ruby version and has no dependencies. You can git clone
44
+ the repository and copy wifi-watch into your path.
39
45
 
40
46
  ```
41
47
  git clone https://github.com/jgorman/wifi-watch.git
42
48
  sudo cp wifi-watch/bin/wifi-watch /usr/local/bin
43
49
  ```
44
50
 
51
+ You can use curl or wget to download the script.
52
+
53
+ ```
54
+ curl https://raw.githubusercontent.com/jgorman/wifi-watch/master/bin/wifi-watch >wifi-watch
55
+ chmod +x wifi-watch
56
+ sudo mv wifi-watch /usr/local/bin
57
+ ```
58
+
45
59
  ### Usage: wifi-watch [options]
46
60
 
47
61
  ```
data/bin/wifi-watch CHANGED
@@ -9,7 +9,7 @@ class WifiWatch
9
9
  Default_host = "ns.google.com" # Ping target host.
10
10
  Default_count = 600 # Accounting period in seconds.
11
11
  Program = "wifi-watch"
12
- Version = "1.0.0"
12
+ Version = "1.0.1"
13
13
 
14
14
  def run
15
15
  @shown_header = false # Have we shown the column headers yet?
@@ -86,6 +86,7 @@ class WifiWatch
86
86
 
87
87
  opt.on("-c", "--count seconds", Integer,
88
88
  "Accounting period [#{options.count}].") do |count|
89
+ raise "--count must be positive" unless count > 0
89
90
  options.count = count
90
91
  end
91
92
 
@@ -164,6 +165,8 @@ class WifiWatch
164
165
  last_notified = now
165
166
  end
166
167
  sleep 0.2 # Be nice to the cpu.
168
+ rescue
169
+ break # Some systems throw an error at eof.
167
170
  end
168
171
  end
169
172
  if last_notified > waiting_start
@@ -171,7 +174,13 @@ class WifiWatch
171
174
  end
172
175
 
173
176
  # Process each line of ping output.
174
- stdin.each do |line|
177
+ while true
178
+ begin
179
+ line = stdin.gets
180
+ rescue
181
+ break # Some systems throw an error at eof.
182
+ end
183
+ break unless line
175
184
 
176
185
  line.chomp!
177
186
  if first_byte
@@ -339,11 +348,11 @@ class WifiWatch
339
348
 
340
349
  # Is the target count hour aligned?
341
350
  minutes = count / 60
342
- if 60 % minutes != 0 || minutes < 2
343
- return count # Not hour aligned and multiple minutes.
351
+ if 60 % minutes != 0
352
+ return count # Not hour aligned.
344
353
  end
345
354
 
346
- # See if we are already suitable aligned right now.
355
+ # See if we are already suitably aligned right now.
347
356
  now = Time.now
348
357
  mm = now.min
349
358
  ss = now.sec
data/wifi-watch.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "wifi-watch"
4
- spec.version = "1.0.0"
4
+ spec.version = "1.0.1"
5
5
  spec.authors = ["John Gorman"]
6
6
  spec.email = ["johngorman2@gmail.com"]
7
7
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wifi-watch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Gorman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-09 00:00:00.000000000 Z
11
+ date: 2018-03-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Run wifi-watch in a terminal so that you can easily check your network
14
14
  quality at this moment and how it has been holding up since you began recording
@@ -34,9 +34,6 @@ files:
34
34
  - test/ping_logs/dns-slow.log
35
35
  - test/ping_logs/fail-mode.log
36
36
  - test/ping_logs/wifi-login.log
37
- - test/results/dns-down.out
38
- - test/results/fail-mode.out
39
- - test/results/wifi-login.out
40
37
  - test/run_tests
41
38
  - wifi-watch.gemspec
42
39
  homepage: https://github.com/jgorman/wifi-watch
@@ -1,11 +0,0 @@
1
- 09:47:38 ping: cannot resolve ns.google.com: Unknown host
2
- PING ns.google.com (216.239.32.10): 56 data bytes
3
-
4
- Time Ping Run Mode Failed Round Trip
5
- ----- ---- ---- ---- ------ ----------
6
- 09:47 10 10 good 0.0% 54.45 ms
7
- 09:47 10 5 good 50.0% 76.66 ms
8
- 09:48:06 ping: cannot resolve ns.google.com: Unknown host
9
- 09:48 10 10 good 0.0% 72.06 ms
10
- 09:48 10 3 good 70.0% 82.17 ms
11
- 09:48:34 ping: cannot resolve ns.google.com: Unknown host
@@ -1,6 +0,0 @@
1
- PING ns.google.com (216.239.32.10): 56 data bytes
2
-
3
- Time Ping Run Mode Failed Round Trip
4
- ----- ---- ---- ---- ------ ----------
5
- 10:31 10 10 good 0.0% 80.47 ms
6
- 10:31 8 5 fail 62.5% 32.70 ms
@@ -1,7 +0,0 @@
1
- PING ns.google.com (216.239.32.10): 56 data bytes
2
-
3
- Time Ping Run Mode Failed Round Trip
4
- ----- ---- ---- ---- ------ ----------
5
- 10:45 5 1 fail 20.0% 68.06 ms
6
- 10:45:43 92 bytes from 10.128.128.128: Communication prohibited by filter
7
- 10:45 11 3 good 36.4% 61.58 ms