lita-netping 0.5.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.
@@ -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
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
@@ -0,0 +1,7 @@
1
+ Documentation:
2
+ Exclude:
3
+ - lib/lita/handlers/netping.rb
4
+
5
+ FileName:
6
+ Exclude:
7
+ - lib/lita-netping.rb
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1
4
+ script: bundle exec rake
5
+ before_install:
6
+ - gem update --system
7
+ services:
8
+ - redis-server
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
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.
@@ -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)
@@ -0,0 +1,8 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+ RuboCop::RakeTask.new(:rubocop)
7
+
8
+ task default: [:spec, :rubocop]
@@ -0,0 +1,9 @@
1
+ require 'lita'
2
+
3
+ Lita.load_locales Dir[File.expand_path(
4
+ File.join('..', '..', 'locales', '*.yml'), __FILE__
5
+ )]
6
+
7
+ require 'lita/handlers/netping'
8
+
9
+ require 'net/ping'
@@ -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
@@ -0,0 +1,11 @@
1
+ en:
2
+ lita:
3
+ handlers:
4
+ netping:
5
+ help:
6
+ ping:
7
+ syntax: ping <target>
8
+ desc: Ping <target> (either DNS or IP address)
9
+ ping:
10
+ success: "%{host} responded to ping"
11
+ fail: "%{host} did not respond to ping"
@@ -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
@@ -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