igp 0.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/spec/shell_spec.rb CHANGED
@@ -2,22 +2,21 @@ require 'spec_helper'
2
2
  require 'getoptions'
3
3
 
4
4
  describe Igp::Shell do
5
-
6
- describe "base configuration" do
5
+ describe 'base configuration' do
7
6
  context 'without destination specified' do
8
7
  before do
9
8
  @options = GetOptions.new(Igp::Shell::OPTIONS, [])
10
9
  end
11
- it "should initialize without error" do
12
- expect { Igp::Shell.new(@options,[]) }.to_not raise_error
10
+ it 'should initialize without error' do
11
+ expect { Igp::Shell.new(@options, []) }.to_not raise_error
13
12
  end
14
- it "should provide help/usage" do
15
- Igp::Shell.respond_to?(:usage).should be_true
16
- Igp::Shell.new(@options,[]).respond_to?(:usage).should be_true
13
+ it 'should provide help/usage' do
14
+ expect(Igp::Shell).to respond_to(:usage)
15
+ expect(Igp::Shell.new(@options, [])).to respond_to(:usage)
17
16
  end
18
- it "should print usage when run" do
19
- shell = Igp::Shell.new(@options,[])
20
- shell.should_receive(:usage)
17
+ it 'should print usage when run' do
18
+ shell = Igp::Shell.new(@options, [])
19
+ expect(shell).to receive(:usage)
21
20
  shell.run
22
21
  end
23
22
  end
@@ -25,137 +24,136 @@ describe Igp::Shell do
25
24
  before do
26
25
  @options_server_value = 'example.com'
27
26
  @options = GetOptions.new(Igp::Shell::OPTIONS, [])
28
- @shell = Igp::Shell.new(@options,[@options_server_value])
27
+ @shell = Igp::Shell.new(@options, [@options_server_value])
29
28
  end
30
- it "should default to 1 second infinte intervals" do
31
- @shell.options[:interval].should eql(1)
32
- @shell.options[:limit].should be_nil
29
+ it 'should default to 1 second infinte intervals' do
30
+ expect(@shell.options[:interval]).to eql(1)
31
+ expect(@shell.options[:limit]).to be_nil
33
32
  end
34
- it "should accept server and default to icmp ping" do
35
- @shell.options[:host].should eql(@options_server_value)
36
- @shell.options[:type].should eql(:icmp)
33
+ it 'should accept server and default to icmp ping' do
34
+ expect(@shell.options[:host]).to eql(@options_server_value)
35
+ expect(@shell.options[:type]).to eql(:icmp)
37
36
  end
38
37
  end
39
38
  end
40
-
41
- describe "tcp configuration" do
39
+
40
+ describe 'tcp configuration' do
42
41
  before(:each) do
43
42
  @type = :tcp
44
43
  @host = 'localhost'
45
44
  @port = 843
46
- @options_server_value = "#{@type.to_s}://#{@host}:#{@port}"
45
+ @options_server_value = "#{@type}://#{@host}:#{@port}"
47
46
  @shell = Igp::Shell.new(GetOptions.new(Igp::Shell::OPTIONS, []), [@options_server_value])
48
47
  end
49
- it "should support url accessor" do
50
- @shell.options[:url].should eql(@options_server_value)
48
+ it 'should support url accessor' do
49
+ expect(@shell.options[:url]).to eql(@options_server_value)
51
50
  end
52
- it "should default to tcp ping with url when given server with tcp protocol setting" do
53
- @shell.options[:type].should eql(@type)
51
+ it 'should default to tcp ping with url when given server with tcp protocol setting' do
52
+ expect(@shell.options[:type]).to eql(@type)
54
53
  end
55
- it "should resolve host/port" do
56
- @shell.options[:host].should eql(@host)
57
- @shell.options[:port].should eql(@port)
54
+ it 'should resolve host/port' do
55
+ expect(@shell.options[:host]).to eql(@host)
56
+ expect(@shell.options[:port]).to eql(@port)
58
57
  end
59
58
  end
60
59
 
61
- describe "udp configuration" do
60
+ describe 'udp configuration' do
62
61
  before(:each) do
63
62
  @type = :udp
64
63
  @host = 'localhost'
65
64
  @port = 22
66
- @options_server_value = "#{@type.to_s}://#{@host}:#{@port}"
65
+ @options_server_value = "#{@type}://#{@host}:#{@port}"
67
66
  @shell = Igp::Shell.new(GetOptions.new(Igp::Shell::OPTIONS, []), [@options_server_value])
68
67
  end
69
- it "should support url accessor" do
70
- @shell.options[:url].should eql(@options_server_value)
68
+ it 'should support url accessor' do
69
+ expect(@shell.options[:url]).to eql(@options_server_value)
71
70
  end
72
- it "should default to tcp ping with url when given server with tcp protocol setting" do
73
- @shell.options[:type].should eql(@type)
71
+ it 'should default to tcp ping with url when given server with tcp protocol setting' do
72
+ expect(@shell.options[:type]).to eql(@type)
74
73
  end
75
- it "should resolve host/port" do
76
- @shell.options[:host].should eql(@host)
77
- @shell.options[:port].should eql(@port)
74
+ it 'should resolve host/port' do
75
+ expect(@shell.options[:host]).to eql(@host)
76
+ expect(@shell.options[:port]).to eql(@port)
78
77
  end
79
78
  end
80
79
 
81
- describe "http configuration" do
80
+ describe 'http configuration' do
82
81
  before(:each) do
83
82
  @type = :http
84
83
  @host = 'localhost'
85
84
  @port = 80
86
- @options_server_value = "#{@type.to_s}://#{@host}"
85
+ @options_server_value = "#{@type}://#{@host}"
87
86
  @shell = Igp::Shell.new(GetOptions.new(Igp::Shell::OPTIONS, []), [@options_server_value])
88
87
  end
89
- it "should support url accessor" do
90
- @shell.options[:url].should eql(@options_server_value)
88
+ it 'should support url accessor' do
89
+ expect(@shell.options[:url]).to eql(@options_server_value)
91
90
  end
92
- it "should default to tcp ping with url when given server with tcp protocol setting" do
93
- @shell.options[:type].should eql(@type)
91
+ it 'should default to tcp ping with url when given server with tcp protocol setting' do
92
+ expect(@shell.options[:type]).to eql(@type)
94
93
  end
95
- it "should resolve host/port" do
96
- @shell.options[:host].should eql(@host)
97
- @shell.options[:port].should eql(@port)
94
+ it 'should resolve host/port' do
95
+ expect(@shell.options[:host]).to eql(@host)
96
+ expect(@shell.options[:port]).to eql(@port)
98
97
  end
99
98
  end
100
99
 
101
- describe "https configuration" do
100
+ describe 'https configuration' do
102
101
  before(:each) do
103
102
  @type = :https
104
103
  @host = 'localhost'
105
104
  @port = 443
106
- @options_server_value = "#{@type.to_s}://#{@host}"
105
+ @options_server_value = "#{@type}://#{@host}"
107
106
  @shell = Igp::Shell.new(GetOptions.new(Igp::Shell::OPTIONS, []), [@options_server_value])
108
107
  end
109
- it "should support url accessor" do
110
- @shell.options[:url].should eql(@options_server_value)
108
+ it 'should support url accessor' do
109
+ expect(@shell.options[:url]).to eql(@options_server_value)
111
110
  end
112
- it "should default to tcp ping with url when given server with tcp protocol setting" do
113
- @shell.options[:type].should eql(@type)
111
+ it 'should default to tcp ping with url when given server with tcp protocol setting' do
112
+ expect(@shell.options[:type]).to eql(@type)
114
113
  end
115
- it "should resolve host/port" do
116
- @shell.options[:host].should eql(@host)
117
- @shell.options[:port].should eql(@port)
114
+ it 'should resolve host/port' do
115
+ expect(@shell.options[:host]).to eql(@host)
116
+ expect(@shell.options[:port]).to eql(@port)
118
117
  end
119
118
  end
120
119
 
121
- describe "ldap configuration" do
120
+ describe 'ldap configuration' do
122
121
  before(:each) do
123
122
  @type = :ldap
124
123
  @host = 'localhost'
125
124
  @port = 389
126
- @options_server_value = "#{@type.to_s}://#{@host}"
125
+ @options_server_value = "#{@type}://#{@host}"
127
126
  @shell = Igp::Shell.new(GetOptions.new(Igp::Shell::OPTIONS, []), [@options_server_value])
128
127
  end
129
- it "should support url accessor" do
130
- @shell.options[:url].should eql(@options_server_value)
128
+ it 'should support url accessor' do
129
+ expect(@shell.options[:url]).to eql(@options_server_value)
131
130
  end
132
- it "should default to tcp ping with url when given server with tcp protocol setting" do
133
- @shell.options[:type].should eql(@type)
131
+ it 'should default to tcp ping with url when given server with tcp protocol setting' do
132
+ expect(@shell.options[:type]).to eql(@type)
134
133
  end
135
- it "should resolve host/port" do
136
- @shell.options[:host].should eql(@host)
137
- @shell.options[:port].should eql(@port)
134
+ it 'should resolve host/port' do
135
+ expect(@shell.options[:host]).to eql(@host)
136
+ expect(@shell.options[:port]).to eql(@port)
138
137
  end
139
138
  end
140
139
 
141
- describe "ldaps configuration" do
140
+ describe 'ldaps configuration' do
142
141
  before(:each) do
143
142
  @type = :ldaps
144
143
  @host = 'localhost'
145
144
  @port = 636
146
- @options_server_value = "#{@type.to_s}://#{@host}"
145
+ @options_server_value = "#{@type}://#{@host}"
147
146
  @shell = Igp::Shell.new(GetOptions.new(Igp::Shell::OPTIONS, []), [@options_server_value])
148
147
  end
149
- it "should support url accessor" do
150
- @shell.options[:url].should eql(@options_server_value)
148
+ it 'should support url accessor' do
149
+ expect(@shell.options[:url]).to eql(@options_server_value)
151
150
  end
152
- it "should default to tcp ping with url when given server with tcp protocol setting" do
153
- @shell.options[:type].should eql(@type)
151
+ it 'should default to tcp ping with url when given server with tcp protocol setting' do
152
+ expect(@shell.options[:type]).to eql(@type)
154
153
  end
155
- it "should resolve host/port" do
156
- @shell.options[:host].should eql(@host)
157
- @shell.options[:port].should eql(@port)
154
+ it 'should resolve host/port' do
155
+ expect(@shell.options[:host]).to eql(@host)
156
+ expect(@shell.options[:port]).to eql(@port)
158
157
  end
159
158
  end
160
-
161
- end
159
+ end
data/spec/spec_helper.rb CHANGED
@@ -2,13 +2,13 @@ require 'igp'
2
2
  require 'stringio'
3
3
 
4
4
  def capture(*streams)
5
- streams.map! { |stream| stream.to_s }
5
+ streams.map!(&:to_s)
6
6
  begin
7
7
  result = StringIO.new
8
- streams.each { |stream| eval "$#{stream} = result" }
8
+ streams.each { |stream| eval "$#{stream} = result # $#{stream} = result" }
9
9
  yield
10
10
  ensure
11
- streams.each { |stream| eval("$#{stream} = #{stream.upcase}") }
11
+ streams.each { |stream| eval("$#{stream} = #{stream.upcase} # $#{stream} = #{stream.upcase}") }
12
12
  end
13
13
  result.string
14
- end
14
+ end
metadata CHANGED
@@ -1,142 +1,241 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: igp
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.0.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
6
5
  platform: ruby
7
- authors:
6
+ authors:
8
7
  - Paul Gallagher
9
- autorequire:
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
-
13
- date: 2011-05-07 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: net-ping
17
- requirement: &id001 !ruby/object:Gem::Requirement
18
- none: false
19
- requirements:
20
- - - ~>
21
- - !ruby/object:Gem::Version
22
- version: 1.5.0
11
+ date: 2022-03-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: getoptions
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.3'
23
20
  type: :runtime
24
21
  prerelease: false
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: getoptions
28
- requirement: &id002 !ruby/object:Gem::Requirement
29
- none: false
30
- requirements:
31
- - - ~>
32
- - !ruby/object:Gem::Version
33
- version: "0.3"
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: net-ldap
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.16.0
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: rspec
39
- requirement: &id003 !ruby/object:Gem::Requirement
40
- none: false
41
- requirements:
42
- - - ">"
43
- - !ruby/object:Gem::Version
44
- version: 2.3.0
45
- type: :development
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.16.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: net-ping
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 2.0.8
48
+ type: :runtime
46
49
  prerelease: false
47
- version_requirements: *id003
48
- - !ruby/object:Gem::Dependency
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 2.0.8
55
+ - !ruby/object:Gem::Dependency
49
56
  name: bundler
50
- requirement: &id004 !ruby/object:Gem::Requirement
51
- none: false
52
- requirements:
53
- - - ~>
54
- - !ruby/object:Gem::Version
55
- version: 1.0.0
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: fakeldap
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.1.1
56
76
  type: :development
57
77
  prerelease: false
58
- version_requirements: *id004
59
- - !ruby/object:Gem::Dependency
60
- name: jeweler
61
- requirement: &id005 !ruby/object:Gem::Requirement
62
- none: false
63
- requirements:
64
- - - ~>
65
- - !ruby/object:Gem::Version
66
- version: 1.5.2
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.1.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard-rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
67
90
  type: :development
68
91
  prerelease: false
69
- version_requirements: *id005
70
- - !ruby/object:Gem::Dependency
71
- name: rcov
72
- requirement: &id006 !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
75
94
  - - ">="
76
- - !ruby/object:Gem::Version
77
- version: "0"
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
78
104
  type: :development
79
105
  prerelease: false
80
- version_requirements: *id006
81
- description: "It goes PING! .. simple command-line server monitoring with a range of protocols: ICMP, TCP, UDP, HTTP/S, LDAP/S"
82
- email: gallagher.paul@gmail.com
83
- executables:
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rb-fsevent
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rdoc
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rspec
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rubocop
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: ruby-ldapserver
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: 0.5.0
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: 0.5.0
181
+ description: 'Simple command-line server monitoring with a range of protocols: ICMP,
182
+ TCP, UDP, HTTP/S, LDAP/S'
183
+ email:
184
+ - gallagher.paul@gmail.com
185
+ executables:
84
186
  - igp
85
187
  extensions: []
86
-
87
- extra_rdoc_files:
88
- - LICENSE
89
- - README.rdoc
90
- files:
188
+ extra_rdoc_files: []
189
+ files:
190
+ - ".github/workflows/ruby.yml"
191
+ - ".gitignore"
192
+ - ".rubocop.yml"
193
+ - ".rubocop_todo.yml"
91
194
  - CHANGELOG
92
195
  - Gemfile
93
- - Gemfile.lock
196
+ - Guardfile
94
197
  - LICENSE
95
198
  - README.rdoc
96
199
  - Rakefile
97
200
  - bin/igp
98
201
  - igp.gemspec
99
- - init.rb
100
202
  - lib/igp.rb
101
203
  - lib/igp/base.rb
102
204
  - lib/igp/shell.rb
103
205
  - lib/igp/version.rb
206
+ - lib/net/ping/ldap.rb
104
207
  - spec/base_spec.rb
105
208
  - spec/format_spec.rb
209
+ - spec/net/ping/ldap_spec.rb
106
210
  - spec/shell_spec.rb
107
211
  - spec/spec_helper.rb
108
- homepage: http://github.com/tardate/igp
109
- licenses:
212
+ homepage: https://github.com/tardate/igp
213
+ licenses:
110
214
  - MIT
111
- post_install_message:
215
+ metadata:
216
+ rubygems_mfa_required: 'true'
217
+ post_install_message:
112
218
  rdoc_options: []
113
-
114
- require_paths:
219
+ require_paths:
115
220
  - lib
116
- required_ruby_version: !ruby/object:Gem::Requirement
117
- none: false
118
- requirements:
221
+ required_ruby_version: !ruby/object:Gem::Requirement
222
+ requirements:
119
223
  - - ">="
120
- - !ruby/object:Gem::Version
121
- hash: -2613847138706563759
122
- segments:
123
- - 0
124
- version: "0"
125
- required_rubygems_version: !ruby/object:Gem::Requirement
126
- none: false
127
- requirements:
224
+ - !ruby/object:Gem::Version
225
+ version: '0'
226
+ required_rubygems_version: !ruby/object:Gem::Requirement
227
+ requirements:
128
228
  - - ">="
129
- - !ruby/object:Gem::Version
130
- version: "0"
229
+ - !ruby/object:Gem::Version
230
+ version: '0'
131
231
  requirements: []
132
-
133
- rubyforge_project:
134
- rubygems_version: 1.7.2
135
- signing_key:
136
- specification_version: 3
232
+ rubygems_version: 3.2.20
233
+ signing_key:
234
+ specification_version: 4
137
235
  summary: It goes PING!
138
- test_files:
236
+ test_files:
139
237
  - spec/base_spec.rb
140
238
  - spec/format_spec.rb
239
+ - spec/net/ping/ldap_spec.rb
141
240
  - spec/shell_spec.rb
142
241
  - spec/spec_helper.rb
data/Gemfile.lock DELETED
@@ -1,34 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- diff-lcs (1.1.2)
5
- getoptions (0.3)
6
- git (1.2.5)
7
- jeweler (1.5.2)
8
- bundler (~> 1.0.0)
9
- git (>= 1.2.5)
10
- rake
11
- net-ldap (0.2.2)
12
- net-ping (1.5.0)
13
- net-ldap (~> 0.2.2)
14
- rake (0.8.7)
15
- rcov (0.9.9)
16
- rspec (2.5.0)
17
- rspec-core (~> 2.5.0)
18
- rspec-expectations (~> 2.5.0)
19
- rspec-mocks (~> 2.5.0)
20
- rspec-core (2.5.1)
21
- rspec-expectations (2.5.0)
22
- diff-lcs (~> 1.1.2)
23
- rspec-mocks (2.5.0)
24
-
25
- PLATFORMS
26
- ruby
27
-
28
- DEPENDENCIES
29
- bundler (~> 1.0.0)
30
- getoptions (~> 0.3)
31
- jeweler (~> 1.5.2)
32
- net-ping (~> 1.5.0)
33
- rcov
34
- rspec (> 2.3.0)
data/init.rb DELETED
@@ -1 +0,0 @@
1
- require 'igp'