ruboty-ip_resolv 1.2.1

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: 7f92c36c97f0d8cbd1a392d18cc0d1de90730a2e
4
+ data.tar.gz: 417e7ae96dc1b950993b2d53d353e88f29c7ae7f
5
+ SHA512:
6
+ metadata.gz: c3d6b11c43be7570255a7c5b31fcece1bd2c8a112d89f2e2b4c627e99c5836a938cd59f6bccd0596a24cbfa648d0be2ba003c9ee30cb9b1fb8375a42044d81af
7
+ data.tar.gz: e2702f9e6f5fd2f4bc439e8917c41d2bb0cf2f3db2076cd6b10209d79343a31e30873cb072751fa09c4b09ed620f48d6fded552774925b7a5a764eb561c11dd9
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /vendor/bundle
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ruboty-ip_resolv.gemspec
4
+ gemspec
@@ -0,0 +1,38 @@
1
+ # Ruboty::IpResolv
2
+
3
+ Resolve IP Address to Hostname
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'ruboty'
11
+ gem 'ruboty-ip_resolv'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ ## Usage
19
+
20
+ See `ruboty help` or the following:
21
+
22
+ - [lib/ruboty/handlers/ip_resolv.rb](lib/ruboty/handlers/ip_resolv.rb)
23
+
24
+ ## Contributing
25
+
26
+ 1. Fork it ( https://github.com/tacahilo/ruboty-ip_resolv/fork )
27
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
28
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
29
+ 4. Push to the branch (`git push origin my-new-feature`)
30
+ 5. Create a new Pull Request
31
+
32
+ ## LICENSE
33
+
34
+ MIT: http://hfm.mit-license.org
35
+
36
+ ## AUTHOR
37
+
38
+ OKUMURA Takahiro hfm@gmail.com
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,16 @@
1
+ module Ruboty
2
+ module Handlers
3
+ class IpResolv < Base
4
+ on(
5
+ /(?<ipaddr>\d+\.\d+\.\d+\.\d+)/,
6
+ all: true,
7
+ name: 'resolv',
8
+ description: 'Resolv IP address to hostname'
9
+ )
10
+
11
+ def resolv(message)
12
+ Ruboty::IpResolv::Actions::IpResolv.new(message).call
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ require "ruboty/ip_resolv/version"
2
+ require "ruboty/handlers/ip_resolv"
3
+ require "ruboty/ip_resolv/actions/ip_resolv"
@@ -0,0 +1,27 @@
1
+ require 'resolv'
2
+
3
+ module Ruboty
4
+ module IpResolv
5
+ module Actions
6
+ class IpResolv < Ruboty::Actions::Base
7
+ attr_reader :message, :ipaddr
8
+
9
+ def initialize(message)
10
+ @message = message
11
+ @ipaddr = message[:ipaddr]
12
+ end
13
+
14
+ def call
15
+ message.reply(resolv)
16
+ end
17
+
18
+ def resolv
19
+ hostname = Resolv.getname(ipaddr)
20
+ "#{ipaddr} is pointed to #{hostname}"
21
+ rescue Resolv::ResolvError => e
22
+ "#{e}"
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,5 @@
1
+ module Ruboty
2
+ module IpResolv
3
+ VERSION = "1.2.1"
4
+ end
5
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ruboty/ip_resolv/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ruboty-ip_resolv"
8
+ spec.version = Ruboty::IpResolv::VERSION
9
+ spec.authors = ["Takahiro OKUMURA"]
10
+ spec.email = ["hfm.garden@gmail.com"]
11
+ spec.summary = %q{Resolve IP Address to Hostname}
12
+ spec.description = %q{Resolve IP Address to Hostname}
13
+ spec.homepage = ""
14
+ spec.license = "MIT: http://hfm.mit-license.org"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency "ruboty"
22
+ spec.add_development_dependency "bundler", "~> 1.8"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruboty-ip_resolv
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.1
5
+ platform: ruby
6
+ authors:
7
+ - Takahiro OKUMURA
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ruboty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.8'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description: Resolve IP Address to Hostname
56
+ email:
57
+ - hfm.garden@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - README.md
65
+ - Rakefile
66
+ - lib/ruboty/handlers/ip_resolv.rb
67
+ - lib/ruboty/ip_resolv.rb
68
+ - lib/ruboty/ip_resolv/actions/ip_resolv.rb
69
+ - lib/ruboty/ip_resolv/version.rb
70
+ - ruboty-ip_resolv.gemspec
71
+ homepage: ''
72
+ licenses:
73
+ - 'MIT: http://hfm.mit-license.org'
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.4.5
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: Resolve IP Address to Hostname
95
+ test_files: []