igp 0.0.3 → 1.0.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 07b9c7b783789ada3d21617353f4470d5145856e2f555454e7f09e37de0ef5c9
4
+ data.tar.gz: e733c5f176d331afebfd2b4ff57546555767febc77d514961c6383a88706146a
5
+ SHA512:
6
+ metadata.gz: 720507197bc6f4325574027108b77474053dd64c832d0462611214e74875608eb6c2f025d2d5eff53d4ae867e39697dc8cbdbaf48f7918f0bd728650d103f466
7
+ data.tar.gz: dc0e4f4da5bae955da232efe4353fc62286e49073f431f38c0fad0e4b1c34b428d54d01608a0eabc448feab509418a86af027f1b9c386d41c2db5cb0f82065d5
@@ -0,0 +1,34 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ '*' ]
13
+ pull_request:
14
+ branches: [ main ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ['2.7', '3.0']
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
28
+ with:
29
+ ruby-version: ${{ matrix.ruby-version }}
30
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
31
+ - name: Install dependencies
32
+ run: bundle install
33
+ - name: Run tests
34
+ run: bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,56 @@
1
+ ## Documentation cache and generated files:
2
+ /.yardoc/
3
+ /_yardoc/
4
+ /doc/
5
+ /rdoc/
6
+
7
+ ## Environment normalization:
8
+ /.bundle/
9
+ /vendor/bundle
10
+ /lib/bundler/man/
11
+
12
+ # for a library or gem, you might want to ignore these files since the code is
13
+ # intended to run in multiple environments; otherwise, check them in:
14
+ Gemfile.lock
15
+ .ruby-version
16
+ .ruby-gemset
17
+
18
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
19
+ .rvmrc
20
+
21
+ # rcov generated
22
+ coverage
23
+
24
+ # jeweler generated
25
+ pkg
26
+
27
+ # logs
28
+ log
29
+ *.log
30
+
31
+ # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
32
+ #
33
+ # * Create a file at ~/.gitignore
34
+ # * Include files you want ignored
35
+ # * Run: git config --global core.excludesfile ~/.gitignore
36
+ #
37
+ # After doing this, these files will be ignored in all your git projects,
38
+ # saving you from having to 'pollute' every project you touch with them
39
+ #
40
+ # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
41
+ #
42
+ # For MacOS:
43
+ #
44
+ #.DS_Store
45
+ #
46
+ # For TextMate
47
+ #*.tmproj
48
+ #tmtags
49
+ #
50
+ # For emacs:
51
+ #*~
52
+ #\#*
53
+ #.\#*
54
+ #
55
+ # For vim:
56
+ #*.swp
data/.rubocop.yml ADDED
@@ -0,0 +1,35 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ NewCops: enable
5
+
6
+ Layout/CommentIndentation:
7
+ Exclude:
8
+ - 'lib/igp/base.rb'
9
+
10
+ # Offense count: 1
11
+ # Configuration parameters: CheckForMethodsWithNoSideEffects.
12
+ Lint/Void:
13
+ Exclude:
14
+ - 'lib/igp/shell.rb'
15
+
16
+ # Offense count: 3
17
+ # Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
18
+ Metrics/AbcSize:
19
+ Max: 29
20
+
21
+ # Offense count: 5
22
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
23
+ # IgnoredMethods: refine
24
+ Metrics/BlockLength:
25
+ Max: 148
26
+
27
+ # Offense count: 1
28
+ # Configuration parameters: IgnoredMethods.
29
+ Metrics/CyclomaticComplexity:
30
+ Max: 8
31
+
32
+ # Offense count: 3
33
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
34
+ Metrics/MethodLength:
35
+ Max: 16
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,86 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2022-03-01 12:54:50 UTC using RuboCop version 1.25.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Configuration parameters: Include.
11
+ # Include: **/*.gemspec
12
+ Gemspec/RequiredRubyVersion:
13
+ Exclude:
14
+ - 'igp.gemspec'
15
+
16
+ # Offense count: 1
17
+ Lint/RescueException:
18
+ Exclude:
19
+ - 'bin/igp'
20
+
21
+ # Offense count: 1
22
+ # Configuration parameters: ForbiddenDelimiters.
23
+ # ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
24
+ Naming/HeredocDelimiterNaming:
25
+ Exclude:
26
+ - 'lib/igp/shell.rb'
27
+
28
+ # Offense count: 2
29
+ Security/Eval:
30
+ Exclude:
31
+ - 'spec/spec_helper.rb'
32
+
33
+ # Offense count: 2
34
+ # Cop supports --auto-correct.
35
+ # Configuration parameters: EnforcedStyle.
36
+ # SupportedStyles: nested, compact
37
+ Style/ClassAndModuleChildren:
38
+ Exclude:
39
+ - 'lib/igp/base.rb'
40
+ - 'lib/igp/shell.rb'
41
+
42
+ # Offense count: 1
43
+ # Cop supports --auto-correct.
44
+ Style/Encoding:
45
+ Exclude:
46
+ - 'igp.gemspec'
47
+
48
+ # Offense count: 2
49
+ # Cop supports --auto-correct.
50
+ Style/EvalWithLocation:
51
+ Exclude:
52
+ - 'spec/spec_helper.rb'
53
+
54
+ # Offense count: 1
55
+ # Cop supports --auto-correct.
56
+ Style/ExpandPathArguments:
57
+ Exclude:
58
+ - 'igp.gemspec'
59
+
60
+ # Offense count: 13
61
+ # Cop supports --auto-correct.
62
+ # Configuration parameters: EnforcedStyle.
63
+ # SupportedStyles: always, always_true, never
64
+ Style/FrozenStringLiteralComment:
65
+ Exclude:
66
+ - 'Gemfile'
67
+ - 'Guardfile'
68
+ - 'Rakefile'
69
+ - 'bin/igp'
70
+ - 'igp.gemspec'
71
+ - 'lib/igp.rb'
72
+ - 'lib/igp/base.rb'
73
+ - 'lib/igp/shell.rb'
74
+ - 'lib/igp/version.rb'
75
+ - 'spec/base_spec.rb'
76
+ - 'spec/format_spec.rb'
77
+ - 'spec/shell_spec.rb'
78
+ - 'spec/spec_helper.rb'
79
+
80
+ # Offense count: 4
81
+ # Cop supports --auto-correct.
82
+ Style/StderrPuts:
83
+ Exclude:
84
+ - 'bin/igp'
85
+ - 'lib/igp/base.rb'
86
+ - 'lib/igp/shell.rb'
data/Gemfile CHANGED
@@ -1,11 +1,3 @@
1
- source "http://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
- gem 'net-ping', '~> 1.5.0'
4
- gem 'getoptions', '~> 0.3'
5
-
6
- group :development do
7
- gem 'rspec', '> 2.3.0', :require => 'spec'
8
- gem 'bundler', '~> 1.0.0'
9
- gem 'jeweler', '~> 1.5.2'
10
- gem 'rcov', '>= 0'
11
- end
3
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,16 @@
1
+ guard :rspec, cmd: 'bundle exec rspec' do
2
+ require 'guard/rspec/dsl'
3
+ dsl = Guard::RSpec::Dsl.new(self)
4
+
5
+ # Feel free to open issues for suggestions and improvements
6
+
7
+ # RSpec files
8
+ rspec = dsl.rspec
9
+ watch(rspec.spec_helper) { rspec.spec_dir }
10
+ watch(rspec.spec_support) { rspec.spec_dir }
11
+ watch(rspec.spec_files)
12
+
13
+ # Ruby files
14
+ ruby = dsl.ruby
15
+ dsl.watch_spec_files_for(ruby.lib_files)
16
+ end
data/Rakefile CHANGED
@@ -1,49 +1,18 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'rake'
11
- $LOAD_PATH << './lib'
12
- require 'igp'
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
13
3
 
14
- begin
15
- require 'jeweler'
16
- Jeweler::Tasks.new do |gem|
17
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
18
- gem.name = "igp"
19
- gem.version = Igp::VERSION
20
- gem.homepage = "http://github.com/tardate/igp"
21
- gem.license = "MIT"
22
- gem.summary = %Q{It goes PING!}
23
- gem.description = %Q{It goes PING! .. simple command-line server monitoring with a range of protocols: ICMP, TCP, UDP, HTTP/S, LDAP/S}
24
- gem.email = "gallagher.paul@gmail.com"
25
- gem.authors = ["Paul Gallagher"]
26
- end
27
- Jeweler::RubygemsDotOrgTasks.new
28
- rescue LoadError
29
- puts "Jeweler not available. Install it with: sudo gem install jeweler"
30
- end
4
+ RSpec::Core::RakeTask.new(:spec)
31
5
 
6
+ task default: :spec
32
7
 
33
- require 'rspec'
34
- require 'rspec/core/rake_task'
35
- RSpec::Core::RakeTask.new do |t|
36
- t.rspec_opts = ["-c", "-f progress"]
37
- t.pattern = 'spec/**/*_spec.rb'
8
+ desc 'Open an irb session preloaded with this library'
9
+ task :console do
10
+ sh 'irb -rubygems -I lib -r cancannible.rb'
38
11
  end
39
12
 
13
+ require 'rdoc/task'
40
14
 
41
- task :default => :spec
42
-
43
- require 'rake/rdoctask'
44
- Rake::RDocTask.new do |rdoc|
45
- rdoc.rdoc_dir = 'rdoc'
46
- rdoc.title = "igp #{Igp::VERSION}"
47
- rdoc.rdoc_files.include('README*')
48
- rdoc.rdoc_files.include('lib/**/*.rb')
15
+ RDoc::Task.new do |rdoc|
16
+ rdoc.main = 'README.rdoc'
17
+ rdoc.rdoc_files.include('README.rdoc', 'lib /*.rb')
49
18
  end
data/bin/igp CHANGED
@@ -6,11 +6,10 @@ require 'getoptions'
6
6
 
7
7
  begin
8
8
  options = GetOptions.new(Igp::Shell::OPTIONS)
9
- Igp::Shell.new(options,ARGV).run
10
- rescue Interrupt,NoMethodError
11
- $stderr.puts ""
9
+ Igp::Shell.new(options, ARGV).run
10
+ rescue Interrupt, NoMethodError
11
+ $stderr.puts ''
12
12
  rescue Exception => e
13
13
  $stderr.puts "That wasn't meant to happen! #{e.message}"
14
14
  Igp::Shell.usage
15
15
  end
16
-
data/igp.gemspec CHANGED
@@ -1,78 +1,33 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
1
+ # coding: utf-8
5
2
 
6
- Gem::Specification.new do |s|
7
- s.name = %q{igp}
8
- s.version = "0.0.3"
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'igp/version'
9
6
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Paul Gallagher"]
12
- s.date = %q{2011-05-07}
13
- s.description = %q{It goes PING! .. simple command-line server monitoring with a range of protocols: ICMP, TCP, UDP, HTTP/S, LDAP/S}
14
- s.email = %q{gallagher.paul@gmail.com}
15
- s.executables = ["igp"]
16
- s.extra_rdoc_files = [
17
- "LICENSE",
18
- "README.rdoc"
19
- ]
20
- s.files = [
21
- "CHANGELOG",
22
- "Gemfile",
23
- "Gemfile.lock",
24
- "LICENSE",
25
- "README.rdoc",
26
- "Rakefile",
27
- "bin/igp",
28
- "igp.gemspec",
29
- "init.rb",
30
- "lib/igp.rb",
31
- "lib/igp/base.rb",
32
- "lib/igp/shell.rb",
33
- "lib/igp/version.rb",
34
- "spec/base_spec.rb",
35
- "spec/format_spec.rb",
36
- "spec/shell_spec.rb",
37
- "spec/spec_helper.rb"
38
- ]
39
- s.homepage = %q{http://github.com/tardate/igp}
40
- s.licenses = ["MIT"]
41
- s.require_paths = ["lib"]
42
- s.rubygems_version = %q{1.7.2}
43
- s.summary = %q{It goes PING!}
44
- s.test_files = [
45
- "spec/base_spec.rb",
46
- "spec/format_spec.rb",
47
- "spec/shell_spec.rb",
48
- "spec/spec_helper.rb"
49
- ]
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'igp'
9
+ spec.version = Igp::VERSION
10
+ spec.authors = ['Paul Gallagher']
11
+ spec.email = ['gallagher.paul@gmail.com']
12
+ spec.summary = 'It goes PING!'
13
+ spec.description = 'Simple command-line server monitoring with a range of protocols: ICMP, TCP, UDP, HTTP/S, LDAP/S'
14
+ spec.homepage = 'https://github.com/tardate/igp'
15
+ spec.license = 'MIT'
50
16
 
51
- if s.respond_to? :specification_version then
52
- s.specification_version = 3
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ['lib']
53
21
 
54
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
55
- s.add_runtime_dependency(%q<net-ping>, ["~> 1.5.0"])
56
- s.add_runtime_dependency(%q<getoptions>, ["~> 0.3"])
57
- s.add_development_dependency(%q<rspec>, ["> 2.3.0"])
58
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
59
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
60
- s.add_development_dependency(%q<rcov>, [">= 0"])
61
- else
62
- s.add_dependency(%q<net-ping>, ["~> 1.5.0"])
63
- s.add_dependency(%q<getoptions>, ["~> 0.3"])
64
- s.add_dependency(%q<rspec>, ["> 2.3.0"])
65
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
66
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
67
- s.add_dependency(%q<rcov>, [">= 0"])
68
- end
69
- else
70
- s.add_dependency(%q<net-ping>, ["~> 1.5.0"])
71
- s.add_dependency(%q<getoptions>, ["~> 0.3"])
72
- s.add_dependency(%q<rspec>, ["> 2.3.0"])
73
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
74
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
75
- s.add_dependency(%q<rcov>, [">= 0"])
76
- end
77
- end
22
+ spec.add_runtime_dependency 'getoptions', '~> 0.3'
23
+ spec.add_runtime_dependency 'net-ping', '~> 2.0.8'
78
24
 
25
+ spec.add_development_dependency 'bundler'
26
+ spec.add_development_dependency 'guard-rspec'
27
+ spec.add_development_dependency 'rake'
28
+ spec.add_development_dependency 'rb-fsevent'
29
+ spec.add_development_dependency 'rdoc'
30
+ spec.add_development_dependency 'rspec'
31
+ spec.add_development_dependency 'rubocop'
32
+ spec.metadata['rubygems_mfa_required'] = 'true'
33
+ end
data/lib/igp/base.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  # main class that runs the ping task
2
2
  class Igp::Base
3
-
4
3
  # holds the parsed options
5
4
  attr_reader :options
6
5
  # the output formatter
@@ -27,58 +26,56 @@ class Igp::Base
27
26
  @interval = options[:interval] || 5
28
27
  case options[:type]
29
28
  when :icmp
30
- @ping_handler = Net::Ping::External.new(@options[:host],@options[:port])
29
+ @ping_handler = Net::Ping::External.new(@options[:host], @options[:port])
31
30
  when :udp
32
- @ping_handler = Net::Ping::UDP.new(@options[:host],@options[:port])
31
+ @ping_handler = Net::Ping::UDP.new(@options[:host], @options[:port])
33
32
  when :tcp
34
- @ping_handler = Net::Ping::TCP.new(@options[:host],@options[:port])
33
+ @ping_handler = Net::Ping::TCP.new(@options[:host], @options[:port])
35
34
  when :http, :https
36
35
  @ping_handler = Net::Ping::HTTP.new(@options[:url])
37
- when :ldap, :ldaps
38
- @ping_handler = Net::Ping::LDAP.new(@options[:url])
36
+ # TODO: LDAP was retired from net-ping. to add back in one way or another
37
+ # when :ldap, :ldaps
38
+ # @ping_handler = Net::Ping::LDAP.new(@options[:url])
39
39
  end
40
40
  end
41
41
 
42
42
  # main routine to run a complete ping test
43
43
  def run
44
44
  return unless ping_handler && formatter
45
+
45
46
  formatter.header(
46
- '# It goes PING! .. testing',options[:url],
47
+ '# It goes PING! .. testing', options[:url],
47
48
  (limit ? "#{limit} times - once" : nil),
48
- 'every',interval,'seconds'
49
+ 'every', interval, 'seconds'
49
50
  )
50
- ping_count=0
51
- while (limit.nil? || ping_count < limit) do
51
+ ping_count = 0
52
+ while limit.nil? || ping_count < limit
52
53
  status = ping_handler.ping?
53
- formatter.log(status,formatter.duration(ping_handler.duration),ping_handler.exception)
54
+ formatter.log(status, formatter.duration(ping_handler.duration), ping_handler.exception)
54
55
  ping_count += 1
55
- sleep interval if (limit.nil? || ping_count < limit)
56
+ sleep interval if limit.nil? || ping_count < limit
56
57
  end
57
58
  end
58
59
 
59
60
  # handle output formating tasks
60
61
  class Format
61
-
62
- # the time format - in 1.8 strftime doesn't understand milliseconds
63
- TIME_FORMAT = (RUBY_VERSION =~ /^1\.9/) ? "%Y-%m-%dT%H:%M:%S.%LZ" : "%Y-%m-%dT%H:%M:%SZ"
62
+ TIME_FORMAT = '%Y-%m-%dT%H:%M:%S.%LZ'.freeze
64
63
 
65
64
  # prints the header structure to STDERR
66
65
  def header(*args)
67
66
  $stderr.puts(args.compact.join(' '))
68
67
  end
69
-
68
+
70
69
  # logs ping result to STDOUT
71
70
  # +args+ is an array of values to log
72
71
  def log(*args)
73
- $stdout.puts(([Time.now.utc.strftime( TIME_FORMAT )] + args).join(','))
72
+ $stdout.puts(([Time.now.utc.strftime(TIME_FORMAT)] + args).join(','))
74
73
  $stdout.flush
75
74
  end
76
-
75
+
77
76
  # formats the duration for output. nil duration remains nil
78
77
  def duration(duration)
79
- "%.6f" % duration if duration
78
+ format('%.6f', duration) if duration
80
79
  end
81
-
82
80
  end
83
-
84
- end
81
+ end
data/lib/igp/shell.rb CHANGED
@@ -2,7 +2,6 @@ require 'uri'
2
2
 
3
3
  # class that groks the igp command line options and invokes the ping task
4
4
  class Igp::Shell
5
-
6
5
  # holds the parsed options
7
6
  attr_reader :options
8
7
  # holds the URI object representing the ping target
@@ -14,12 +13,13 @@ class Igp::Shell
14
13
  #
15
14
  # +args+ is the remaining command line arguments
16
15
  #
17
- def initialize(options,args)
16
+ def initialize(options, args)
18
17
  defaults = {
19
- :interval => 1
18
+ interval: 1
20
19
  }
21
- @options = defaults.merge( (options||{}).each{|k,v| {k => v} } )
20
+ @options = defaults.merge((options || {}).each { |k, v| { k => v } })
22
21
  return unless args.first
22
+
23
23
  resolve_addressing args.first
24
24
  normalise_options
25
25
  end
@@ -32,7 +32,7 @@ class Igp::Shell
32
32
  unless uri.scheme
33
33
  @options[:type] = :icmp
34
34
  @options[:host] = uri.to_s
35
- @options[:url] = "#{@options[:type].to_s}://#{@options[:host]}"
35
+ @options[:url] = "#{@options[:type]}://#{@options[:host]}"
36
36
  return
37
37
  end
38
38
  @options[:url] = uri.to_s
@@ -52,7 +52,8 @@ class Igp::Shell
52
52
  # runs the ping task
53
53
  def run
54
54
  case options[:type]
55
- when :icmp,:http,:https,:tcp,:udp,:ldap,:ldaps
55
+ # TODO: LDAP was retired from net-ping. to add back in one way or another
56
+ when :icmp, :http, :https, :tcp, :udp # :ldap, :ldaps
56
57
  Igp::Base.new(options).run
57
58
  else
58
59
  usage
@@ -60,49 +61,50 @@ class Igp::Shell
60
61
  end
61
62
 
62
63
  # defines the valid command line options
63
- OPTIONS = %w(help verbose interval=i limit=i)
64
+ OPTIONS = %w[help verbose interval=i limit=i].freeze
64
65
 
65
66
  # prints usage/help information
66
67
  def usage
67
68
  self.class.usage
68
69
  end
70
+
69
71
  # prints usage/help information
70
72
  def self.usage
71
- $stderr.puts <<-EOS
73
+ $stderr.puts <<~EOS
72
74
 
73
- It goes PING! v#{Igp::VERSION}
74
- ===================================
75
+ It goes PING! v#{Igp::VERSION}
76
+ ===================================
75
77
 
76
- Usage:
77
- igp [options] uri
78
-
79
- Options:
80
- -h | --help :shows command help
81
- -i= | --interval=seconds (default: 1 second)
82
- -l= | --limit=number of tests (default: infinite)
78
+ Usage:
79
+ igp [options] uri
83
80
 
84
- The uri specifies the protocol, hostname and port.
85
- The ICMP protocol is assumed if not specified.
86
- The default well-known port is assumed if not specified.
81
+ Options:
82
+ -h | --help :shows command help
83
+ -i= | --interval=seconds (default: 1 second)
84
+ -l= | --limit=number of tests (default: infinite)
87
85
 
88
- Examples:
86
+ The uri specifies the protocol, hostname and port.
87
+ The ICMP protocol is assumed if not specified.
88
+ The default well-known port is assumed if not specified.
89
89
 
90
- ICMP ping:
91
- igp localhost
92
- igp icmp://localhost
90
+ Examples:
93
91
 
94
- UDP/TCP ping:
95
- igp udp://localhost:123
96
- igp tcp://localhost:843
92
+ ICMP ping:
93
+ igp localhost
94
+ igp icmp://localhost
97
95
 
98
- HTTP/S ping:
99
- igp http://localhost:8080
100
- igp https://localhost:4443
96
+ UDP/TCP ping:
97
+ igp udp://localhost:123
98
+ igp tcp://localhost:843
101
99
 
102
- LDAP/S ping:
103
- igp ldap://localhost
104
- igp ldaps://localhost:6636
100
+ HTTP/S ping:
101
+ igp http://localhost:8080
102
+ igp https://localhost:4443
105
103
 
106
104
  EOS
105
+ # TODO: LDAP was retired from net-ping. to add back in one way or another
106
+ # LDAP/S ping:
107
+ # igp ldap://localhost
108
+ # igp ldaps://localhost:6636
107
109
  end
108
- end
110
+ end
data/lib/igp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Igp
2
- VERSION = "0.0.3"
2
+ VERSION = '1.0.0'.freeze
3
3
  end
data/lib/igp.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'rubygems' if (RUBY_VERSION =~ /^1\.8/)
2
1
  require 'net/ping'
3
2
  require 'igp/version'
4
3
  require 'igp/shell'