pingman 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/pingman +14 -1
- data/lib/pingman.rb +7 -39
- data/lib/pingman/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4736356158408fa1fe509a9e500612c9898c57df
|
4
|
+
data.tar.gz: d38a0a38301ef46a433a389f9ed9ddb419feaee7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64980b42979a3bdcde58975e45ac52a0730b8a2c2a8636906f22eb08ee5d89a0d62f74abb44a7764f36a6a239b8f163008457df53584bf9fde788a9d1d530864
|
7
|
+
data.tar.gz: 076ba2f9cb746f61ded802e1709754ed6108b88352ca9c785c0b0cf2bde8068c09269aad3876de423c035441295a7f3caebb1050ca3995c9746842ee0fb373ef
|
data/bin/pingman
CHANGED
@@ -1,7 +1,20 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'pingman'
|
4
|
+
require 'yaml'
|
4
5
|
Signal.trap(:INT){
|
5
6
|
exit 0
|
6
7
|
}
|
7
|
-
|
8
|
+
|
9
|
+
config = ARGV.size > 0 ? YAML.load_file(File.expand_path(ARGV[0])) :
|
10
|
+
YAML.load_file(File.expand_path('../../lib/sample.yml', __FILE__))
|
11
|
+
lines = []
|
12
|
+
config.each do |k, v|
|
13
|
+
line = Line.new
|
14
|
+
line.hostname = v['host'] || k
|
15
|
+
line.address = k['address']
|
16
|
+
line.row = lines.size
|
17
|
+
lines.push
|
18
|
+
end
|
19
|
+
|
20
|
+
Pingman.pingman lines
|
data/lib/pingman.rb
CHANGED
@@ -1,46 +1,14 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
1
|
+
require 'pingman/version'
|
2
|
+
require 'pingman/line'
|
3
|
+
require 'pingman/screen'
|
4
|
+
require 'pingman/pinger'
|
5
|
+
require 'yaml'
|
6
6
|
|
7
7
|
module Pingman
|
8
|
-
def self.pingman
|
8
|
+
def self.pingman(lines)
|
9
9
|
pinger = Pinger.new
|
10
10
|
screen = Screen.new
|
11
|
-
|
12
|
-
line = Line.new
|
13
|
-
line.hostname = 'local'
|
14
|
-
line.address = '127.0.0.1'
|
15
|
-
line.row = screen.lines.size
|
16
|
-
screen.lines.push line
|
17
|
-
line = Line.new
|
18
|
-
line.hostname = 'google dns'
|
19
|
-
line.address = '8.8.8.8'
|
20
|
-
line.row = screen.lines.size
|
21
|
-
screen.lines.push line
|
22
|
-
line = Line.new
|
23
|
-
line.hostname = 'not found'
|
24
|
-
line.address = '1.2.3.4'
|
25
|
-
line.row = screen.lines.size
|
26
|
-
screen.lines.push line
|
27
|
-
line = Line.new
|
28
|
-
line.hostname = 'google dns'
|
29
|
-
line.address = '8.8.4.4'
|
30
|
-
line.row = screen.lines.size
|
31
|
-
screen.lines.push line
|
32
|
-
line = Line.new
|
33
|
-
line.hostname = 'google.com'
|
34
|
-
line.row = screen.lines.size
|
35
|
-
screen.lines.push line
|
36
|
-
line = Line.new
|
37
|
-
line.hostname = 'yahoo.com'
|
38
|
-
line.row = screen.lines.size
|
39
|
-
screen.lines.push line
|
40
|
-
line = Line.new
|
41
|
-
line.hostname = 'microsoft.com'
|
42
|
-
line.row = screen.lines.size
|
43
|
-
screen.lines.push line
|
11
|
+
screen.lines = lines
|
44
12
|
|
45
13
|
Thread.new do
|
46
14
|
screen.update
|
data/lib/pingman/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pingman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kurochan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ping
|