network_tester 0.1.0 → 0.1.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 +4 -4
- data/README.md +12 -8
- data/bin/network_tester +6 -1
- data/lib/network_tester/version.rb +1 -1
- data/lib/network_tester.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8870247b41213f59a27412a2d6ece65d115f927a
|
4
|
+
data.tar.gz: 750a0973e73691cbc22db840970f355512dcac91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d98ab87470e2dae559b4a2c554e147d00702588ea88a66e446b40fa2b623c5161fbd8ecb6375cc18753f11e5e9ca2e600976e2da7053d170cd9f97470088876a
|
7
|
+
data.tar.gz: 0f95afc228fc11d7f7d541ce52a26c59718ca0bb3142fb119bd89860a782b206ed9fa6cfe7f8cc3677fefc1ec1aeb91370e9f58c78c19e8460a77a9264650e1e
|
data/README.md
CHANGED
@@ -1,12 +1,18 @@
|
|
1
1
|
# NetworkTester
|
2
2
|
|
3
|
-
|
3
|
+
Announces the number of milliseconds it takes for a ping response. Can pass the millisecond threshold before announcement.
|
4
4
|
|
5
|
-
|
5
|
+
When diagnosing network issues, you may want to plug and unplug ethernet cables to search for a problem. The genesis of this project is I wanted a way to do this without carrying my laptop around and looking at it all the time.
|
6
|
+
|
7
|
+
On a Mac, the number of milliseconds taken by the ping is announced. On Linux, I believe there is an audible beep when the ping takes longer than the threshold. (Untested.)
|
6
8
|
|
7
9
|
## Installation
|
8
10
|
|
9
|
-
|
11
|
+
Install it to get the bin file:
|
12
|
+
|
13
|
+
$ gem install network_tester
|
14
|
+
|
15
|
+
Or add this line to your application's Gemfile:
|
10
16
|
|
11
17
|
```ruby
|
12
18
|
gem 'network_tester'
|
@@ -16,13 +22,11 @@ And then execute:
|
|
16
22
|
|
17
23
|
$ bundle
|
18
24
|
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install network_tester
|
22
|
-
|
23
25
|
## Usage
|
24
26
|
|
25
|
-
|
27
|
+
After installing the gem, you may need to open a new shell, and then type:
|
28
|
+
|
29
|
+
network_tester <millisecond_threshold>
|
26
30
|
|
27
31
|
## Development
|
28
32
|
|
data/bin/network_tester
CHANGED
@@ -5,4 +5,9 @@ $LOAD_PATH.unshift Pathname.new(__FILE__).dirname + '..'
|
|
5
5
|
|
6
6
|
require_relative '../lib/network_tester'
|
7
7
|
|
8
|
-
|
8
|
+
puts 'asdfjlfdls'
|
9
|
+
puts ARGV.inspect
|
10
|
+
maxtime = 70
|
11
|
+
maxtime = Integer(ARGV[0]) if ARGV.size>0
|
12
|
+
puts maxtime
|
13
|
+
NetworkTester::loop(nil, 'google.com', maxtime)
|
data/lib/network_tester.rb
CHANGED
@@ -3,11 +3,11 @@ require_relative "network_tester/version"
|
|
3
3
|
module NetworkTester
|
4
4
|
module_function
|
5
5
|
|
6
|
-
def notifier(time)
|
6
|
+
def notifier(time, maxtime=70)
|
7
7
|
time = Float(time)
|
8
8
|
if time < 10
|
9
9
|
notify('wee')
|
10
|
-
elsif time >
|
10
|
+
elsif time > maxtime
|
11
11
|
notify(Integer(time), rate=Integer(time)*2)
|
12
12
|
end
|
13
13
|
rescue => e
|
@@ -34,12 +34,12 @@ module NetworkTester
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
def loop(max_count=nil, addr='google.com')
|
37
|
+
def loop(max_count=nil, addr='google.com', maxtime=70)
|
38
38
|
count = 1
|
39
39
|
while (max_count.nil? or count<max_count)
|
40
40
|
time = pingr
|
41
41
|
print time.inspect
|
42
|
-
notifier(time)
|
42
|
+
notifier(time, maxtime)
|
43
43
|
sleep 1
|
44
44
|
end
|
45
45
|
rescue => e
|