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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2235bc4753b04e2c64a0b2c8b2c1293c28480ca
4
- data.tar.gz: ef02885377dd79f221f3de605f8436c8a2e79665
3
+ metadata.gz: 8870247b41213f59a27412a2d6ece65d115f927a
4
+ data.tar.gz: 750a0973e73691cbc22db840970f355512dcac91
5
5
  SHA512:
6
- metadata.gz: 23a105223a32b52cd408a7473a91aac6654c623aef44c488270545f89bf9c0c93842d9c26b328315e517f7fa26004558aa65c757e50db271f7713fa8856568e0
7
- data.tar.gz: c56878cfb352e2e7b730600d100f96c89ddc632041375e5c7c40e3fb436bcd3c4ec03951770dab2c0a2cf28438cb32ebad4a5764de7c22a9ebe794303c06e893
6
+ metadata.gz: d98ab87470e2dae559b4a2c554e147d00702588ea88a66e446b40fa2b623c5161fbd8ecb6375cc18753f11e5e9ca2e600976e2da7053d170cd9f97470088876a
7
+ data.tar.gz: 0f95afc228fc11d7f7d541ce52a26c59718ca0bb3142fb119bd89860a782b206ed9fa6cfe7f8cc3677fefc1ec1aeb91370e9f58c78c19e8460a77a9264650e1e
data/README.md CHANGED
@@ -1,12 +1,18 @@
1
1
  # NetworkTester
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/network_tester`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Announces the number of milliseconds it takes for a ping response. Can pass the millisecond threshold before announcement.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
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
- Add this line to your application's Gemfile:
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
- TODO: Write usage instructions here
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
- NetworkTester::loop
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)
@@ -1,3 +1,3 @@
1
1
  module NetworkTester
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -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 > 70
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: network_tester
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - bmd