multi_ping 0.2.2 → 0.2.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: 628708535df51a473c4cd83aa7ccdddfe19b6bab
4
- data.tar.gz: 123094ffb39335752037aaa61cce765623312a30
3
+ metadata.gz: 02b167edbca8685a94c8b53ca1b5b6e116cc8300
4
+ data.tar.gz: e3f62114c87ca6f6fc178b3cae3402fc95a4706a
5
5
  SHA512:
6
- metadata.gz: de32ea97040cfd8c71e8588f55a4d550375388ac995980cc8119a519b10227694c82387244264057ea99ae93ab091635f766a13a490cccd9d840b5719910587d
7
- data.tar.gz: cf0c8fc21bade89159fff489ff24d7cc68bb87815309784a1a83f28f6f9fbbf92bb9096d5e01499411d66a84d9eeae7c96055144f237bcac727c886da2631e7a
6
+ metadata.gz: a701a96253ffd5c86d1c448742875429db54a2974f5845b2d1c47369dbbc6e6824da37aaa88b78b3cf5efafbdf3430b83746e1ed08a98d9f21f6a6c7f6cf7c66
7
+ data.tar.gz: c7ccb520be41b9fbecb0459b7f43744e2d59a6f49c0dace47dbd686f0b5fbf9617b92090e41fbb20faecd248631afc884b9c5fba3dbeeaee43ad603f175e7b78
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
3
+ # require "bundler/setup"
4
4
  require "multi_ping"
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
@@ -14,8 +14,13 @@ require "multi_ping"
14
14
 
15
15
  require 'optparse'
16
16
 
17
+ if Process.euid > 0
18
+ puts "You have to run with root privilege"
19
+ exit(-1)
20
+ end
21
+
17
22
  options = {}
18
- OptionParser.new do |opts|
23
+ parser = OptionParser.new do |opts|
19
24
  opts.banner = <<BANNER
20
25
  Usage 1: multi_ping [options] hosts...
21
26
  Usage 2: multi_ping [options] < host_file (one host each line)
@@ -25,7 +30,9 @@ BANNER
25
30
  opts.on('-p', '--parallel PARALLEL', 'Parallel running') { |v| options[:parallel] = v }
26
31
  opts.on('-v', '--verbose', 'Print log verbose') { options[:verbose] = true}
27
32
  opts.on('-t', '--threshold COUNT', 'Stop ping once reach the threshold') {|v| options[:threshold] = v}
28
- end.parse!
33
+ end
34
+
35
+ parser.parse!
29
36
 
30
37
  options[:hosts] = []
31
38
 
@@ -36,6 +43,8 @@ else
36
43
  options[:hosts] << line
37
44
  end
38
45
  end
39
-
46
+ if ARGV.empty? && options[:hosts].empty?
47
+ puts parser
48
+ end
40
49
  processor = MultiPing::Processor.new(options).process
41
50
  processor.results.map{|k,v| puts "#{k}, #{v[0].round(4)}, #{v[1].round(2)}"}
@@ -1,3 +1,3 @@
1
1
  module MultiPing
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -13,13 +13,12 @@ Gem::Specification.new do |spec|
13
13
  spec.description = %q{Check network quality by sending ICMP package concurrently.}
14
14
  spec.homepage = "https://github.com/genewoo/multi_ping"
15
15
  spec.license = "MIT"
16
- spec.executables = 'multi_ping'
17
16
  spec.required_ruby_version = '>= 2.2.0'
18
17
  spec.required_rubygems_version = '>= 1.8.11'
19
18
 
20
19
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
20
  spec.bindir = "bin"
22
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
23
22
  spec.require_paths = ["lib"]
24
23
 
25
24
  spec.add_dependency('net-ping', '>= 1.7.6')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multi_ping
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - genewoo
@@ -83,7 +83,8 @@ dependencies:
83
83
  description: Check network quality by sending ICMP package concurrently.
84
84
  email:
85
85
  - genewoo_AT_gmail.com
86
- executables: []
86
+ executables:
87
+ - multi_ping
87
88
  extensions: []
88
89
  extra_rdoc_files: []
89
90
  files:
@@ -123,3 +124,4 @@ signing_key:
123
124
  specification_version: 4
124
125
  summary: Ping Multiple Nodes Concurrently
125
126
  test_files: []
127
+ has_rdoc: