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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ec6ce7607a57801924c408e6c78a3f8c5bc003a
4
- data.tar.gz: 0bb6d40920a994ca6f99e09f40fe4edc281b27e2
3
+ metadata.gz: 4736356158408fa1fe509a9e500612c9898c57df
4
+ data.tar.gz: d38a0a38301ef46a433a389f9ed9ddb419feaee7
5
5
  SHA512:
6
- metadata.gz: 70b8ba342b7537faac02435373af2e2364ae0da3368cf24e8cfb4a163f4f263e74a3493fd856a960b7dc1f56bdbe7a0ab394d17d26ee16f4bb179870f96af92a
7
- data.tar.gz: 56c170559f64a8fd5d0e19468aaa1408ffd5d8337e0f092ca05a71b58d63ae010e2685d3b9a3bbc1d5cadb063042592cf6b5456a57386367196eb0c554f109bb
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
- Pingman.pingman
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 "pingman/version"
2
-
3
- require "pingman/line"
4
- require "pingman/screen"
5
- require "pingman/pinger"
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
@@ -1,3 +1,3 @@
1
1
  module Pingman
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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-01-31 00:00:00.000000000 Z
11
+ date: 2014-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ping