lita-netping 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rubocop.yml +7 -0
- data/.travis.yml +8 -0
- data/Gemfile +3 -0
- data/LICENSE +19 -0
- data/README.md +45 -0
- data/Rakefile +8 -0
- data/lib/lita-netping.rb +9 -0
- data/lib/lita/handlers/netping.rb +36 -0
- data/lita-netping.gemspec +26 -0
- data/locales/en.yml +11 -0
- data/spec/lita/handlers/netping_spec.rb +19 -0
- data/spec/spec_helper.rb +12 -0
- metadata +172 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c4be87eefd9a97bf9ee291760508ae033132bb41
|
4
|
+
data.tar.gz: ee2ea65ebdfec3986c5e3f591f99e4ee0691763b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bb13f837813965d634239ac1a75686906c7e43fa26aa8126d63741c6e89dc899c585d69b063883f1d54058021ba8424af94040e1b8dac8b6308a28d43737b992
|
7
|
+
data.tar.gz: 00d7d3f926f31acb8feba3860b16e4b63fd4fd2799b6cec06b99ac02c140449db22d99f53295cbd29011aece8b9201fea4b74684b5e69bf66352bb7f6998f4a5
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2014 Eric Sigler
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# lita-netping
|
2
|
+
|
3
|
+
[![Build Status](https://img.shields.io/travis/esigler/lita-netping/master.svg)](https://travis-ci.org/esigler/lita-netping)
|
4
|
+
[![MIT License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://tldrlegal.com/license/mit-license)
|
5
|
+
[![RubyGems :: RMuh Gem Version](http://img.shields.io/gem/v/lita-netping.svg)](https://rubygems.org/gems/lita-netping)
|
6
|
+
[![Coveralls Coverage](https://img.shields.io/coveralls/esigler/lita-netping/master.svg)](https://coveralls.io/r/esigler/lita-netping)
|
7
|
+
[![Code Climate](https://img.shields.io/codeclimate/github/esigler/lita-netping.svg)](https://codeclimate.com/github/esigler/lita-netping)
|
8
|
+
[![Gemnasium](https://img.shields.io/gemnasium/esigler/lita-netping.svg)](https://gemnasium.com/esigler/lita-netping)
|
9
|
+
|
10
|
+
An IP ping plugin for [Lita](https://github.com/jimmycuadra/lita).
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Add lita-netping to your Lita instance's Gemfile:
|
15
|
+
|
16
|
+
``` ruby
|
17
|
+
gem "lita-netping"
|
18
|
+
```
|
19
|
+
|
20
|
+
## Configuration
|
21
|
+
|
22
|
+
none
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
Examples:
|
27
|
+
|
28
|
+
```
|
29
|
+
ping google.com - Ping google.com
|
30
|
+
```
|
31
|
+
|
32
|
+
Syntax:
|
33
|
+
|
34
|
+
```
|
35
|
+
ping <target> - Ping <target> (either DNS or IP address)
|
36
|
+
```
|
37
|
+
|
38
|
+
## Note
|
39
|
+
|
40
|
+
This plugin uses the net-ping library, and the "Net::Ping::External" check,
|
41
|
+
so it will use the "ping" equivalent on whatever host it's running on.
|
42
|
+
|
43
|
+
## License
|
44
|
+
|
45
|
+
[MIT](http://opensource.org/licenses/MIT)
|
data/Rakefile
ADDED
data/lib/lita-netping.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
module Lita
|
2
|
+
module Handlers
|
3
|
+
class Netping < Handler
|
4
|
+
route(
|
5
|
+
/^ping\s(?<target>.+)/,
|
6
|
+
:ping,
|
7
|
+
command: true,
|
8
|
+
help: {
|
9
|
+
t('help.ping.syntax') => t('help.ping.desc')
|
10
|
+
}
|
11
|
+
)
|
12
|
+
|
13
|
+
def ping(response)
|
14
|
+
target = response.match_data['target']
|
15
|
+
|
16
|
+
response.reply(format(target, ping_target(target)))
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def format(host, result)
|
22
|
+
if result
|
23
|
+
t('ping.success', host: host)
|
24
|
+
else
|
25
|
+
t('ping.fail', host: host)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def ping_target(host)
|
30
|
+
Net::Ping::External.new(host).ping
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
Lita.register_handler(Netping)
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = 'lita-netping'
|
3
|
+
spec.version = '0.5.0'
|
4
|
+
spec.authors = ['Eric Sigler']
|
5
|
+
spec.email = ['me@esigler.com']
|
6
|
+
spec.description = 'An IP ping plugin for Lita'
|
7
|
+
spec.summary = 'An IP ping plugin for Lita'
|
8
|
+
spec.homepage = 'https://github.com/esigler/lita-netping'
|
9
|
+
spec.license = 'MIT'
|
10
|
+
spec.metadata = { 'lita_plugin_type' => 'handler' }
|
11
|
+
|
12
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
13
|
+
spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
|
14
|
+
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
|
15
|
+
spec.require_paths = ['lib']
|
16
|
+
|
17
|
+
spec.add_runtime_dependency 'lita', '>= 4.0'
|
18
|
+
spec.add_runtime_dependency 'net-ping'
|
19
|
+
|
20
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
21
|
+
spec.add_development_dependency 'rake'
|
22
|
+
spec.add_development_dependency 'rspec', '>= 3.0.0'
|
23
|
+
spec.add_development_dependency 'simplecov'
|
24
|
+
spec.add_development_dependency 'coveralls'
|
25
|
+
spec.add_development_dependency 'rubocop'
|
26
|
+
end
|
data/locales/en.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Lita::Handlers::Netping, lita_handler: true do
|
4
|
+
it do
|
5
|
+
is_expected.to route_command('ping example.com').to(:ping)
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#ping' do
|
9
|
+
it 'returns a success if the target is pingable' do
|
10
|
+
send_command('ping example.com')
|
11
|
+
expect(replies.last).to eq('example.com responded to ping')
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'returns a failure if the target is not pingable' do
|
15
|
+
send_command('ping unknownhost.local')
|
16
|
+
expect(replies.last).to eq('unknownhost.local did not respond to ping')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'coveralls'
|
3
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
4
|
+
SimpleCov::Formatter::HTMLFormatter,
|
5
|
+
Coveralls::SimpleCov::Formatter
|
6
|
+
]
|
7
|
+
SimpleCov.start { add_filter '/spec/' }
|
8
|
+
|
9
|
+
require 'lita-netping'
|
10
|
+
require 'lita/rspec'
|
11
|
+
|
12
|
+
Lita.version_3_compatibility_mode = false
|
metadata
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lita-netping
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Eric Sigler
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: lita
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: net-ping
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
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: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.0.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.0.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: coveralls
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
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: rubocop
|
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
|
+
description: An IP ping plugin for Lita
|
126
|
+
email:
|
127
|
+
- me@esigler.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- ".gitignore"
|
133
|
+
- ".rubocop.yml"
|
134
|
+
- ".travis.yml"
|
135
|
+
- Gemfile
|
136
|
+
- LICENSE
|
137
|
+
- README.md
|
138
|
+
- Rakefile
|
139
|
+
- lib/lita-netping.rb
|
140
|
+
- lib/lita/handlers/netping.rb
|
141
|
+
- lita-netping.gemspec
|
142
|
+
- locales/en.yml
|
143
|
+
- spec/lita/handlers/netping_spec.rb
|
144
|
+
- spec/spec_helper.rb
|
145
|
+
homepage: https://github.com/esigler/lita-netping
|
146
|
+
licenses:
|
147
|
+
- MIT
|
148
|
+
metadata:
|
149
|
+
lita_plugin_type: handler
|
150
|
+
post_install_message:
|
151
|
+
rdoc_options: []
|
152
|
+
require_paths:
|
153
|
+
- lib
|
154
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - ">="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0'
|
164
|
+
requirements: []
|
165
|
+
rubyforge_project:
|
166
|
+
rubygems_version: 2.2.2
|
167
|
+
signing_key:
|
168
|
+
specification_version: 4
|
169
|
+
summary: An IP ping plugin for Lita
|
170
|
+
test_files:
|
171
|
+
- spec/lita/handlers/netping_spec.rb
|
172
|
+
- spec/spec_helper.rb
|