ruboty-eto 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a3ff86eab33c7275d6b36279f11336f51bb58fc6
4
+ data.tar.gz: f90b66424ce635c94571f8feefd6d319df5f9626
5
+ SHA512:
6
+ metadata.gz: 70ac4ab96ee4b0bad620c4929ad8bcdda3a3169dbaff6ac713c3a66f82c067d831e0e5f6d843e789967670d359c4a35b4146bcb7bdb22d0e7954a0b518cd01ff
7
+ data.tar.gz: c1757d2a5b280e692970c1c1c56f77c9726590556b8ae49816e5a8c676af7cdbbbbbf3a07230ad7bd4b66babe0f07dc3728130bccb74cb088aa9ce239f72876f
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+ gem 'eto'
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 tbpgr
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,74 @@
1
+ # Ruboty::Eto
2
+
3
+ An Ruboty Handler + Actions to Get Eto (Japanese Zodiac) name or emoji.
4
+
5
+ [Ruboty](https://github.com/r7kamura/ruboty) is Chat bot framework. Ruby + Bot = Ruboty
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'ruboty-eto'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install ruboty-eto
22
+
23
+ ## Commands
24
+
25
+ |Command|Pattern|Description|
26
+ |:--|:--|:--|
27
+ |names|/eto names\z/|get eto names|
28
+ |name|/eto name (?<year>d\{4\})\z/|get eto name from year|
29
+ |emoji|/eto emoji (?<year>d\{4\})\z/|get eto emoji from year|
30
+
31
+ ## Usage
32
+ ### names
33
+ * get eto names
34
+
35
+ ~~~
36
+ >ruboty eto names
37
+ >子丑寅卯辰巳午未申酉戌亥
38
+ ~~~
39
+
40
+ ### name
41
+ * get eto name from year
42
+
43
+ ~~~
44
+ >ruboty eto name 1977
45
+ >巳
46
+ ~~~
47
+
48
+ ### emoji
49
+ * get eto emoji from year
50
+
51
+ ~~~
52
+ >ruboty eto name 1977
53
+ >:snake:
54
+ ~~~
55
+
56
+ ## ENV
57
+
58
+ |Name|Description|
59
+ |:--|:--|
60
+ |--|--|
61
+
62
+ ## Dependency
63
+
64
+ |Name|Description|
65
+ |:--|:--|
66
+ |eto gem|<i class="fa fa-github-square" style="font-size:1em;"></i> [eto gem](https://github.com/tbpgr/eto)|
67
+
68
+ ## Contributing
69
+
70
+ 1. Fork it ( https://github.com/tbpgr/ruboty-eto/fork )
71
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
72
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
73
+ 4. Push to the branch (`git push origin my-new-feature`)
74
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,8 @@
1
+ require "ruboty/eto/version"
2
+ require "ruboty/handlers/eto"
3
+
4
+ module Ruboty
5
+ module Eto
6
+ # Your code goes here...
7
+ end
8
+ end
@@ -0,0 +1,21 @@
1
+ require 'eto'
2
+ require 'ruboty/eto/actions/eto_helper'
3
+
4
+ module Ruboty
5
+ module Eto
6
+ module Actions
7
+ class Emoji < Ruboty::Actions::Base
8
+ include EtoHelper
9
+ def call
10
+ message.reply(emoji)
11
+ end
12
+
13
+ private
14
+
15
+ def emoji
16
+ call_eto_method(:emoji, year)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,15 @@
1
+ require 'eto'
2
+
3
+ module EtoHelper
4
+ def call_eto_method(method_name, *args)
5
+ if args.size == 0
6
+ Eto.send(method_name)
7
+ else
8
+ Eto.send(method_name, args.first)
9
+ end
10
+ end
11
+
12
+ def year
13
+ message[:year]
14
+ end
15
+ end
@@ -0,0 +1,21 @@
1
+ require 'eto'
2
+ require 'ruboty/eto/actions/eto_helper'
3
+
4
+ module Ruboty
5
+ module Eto
6
+ module Actions
7
+ class Name < Ruboty::Actions::Base
8
+ include EtoHelper
9
+ def call
10
+ message.reply(name)
11
+ end
12
+
13
+ private
14
+
15
+ def name
16
+ call_eto_method(:name, year)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ require 'eto'
2
+ require 'ruboty/eto/actions/eto_helper'
3
+
4
+ module Ruboty
5
+ module Eto
6
+ module Actions
7
+ class Names < Ruboty::Actions::Base
8
+ include EtoHelper
9
+ def call
10
+ message.reply(names)
11
+ end
12
+
13
+ private
14
+
15
+ def names
16
+ call_eto_method(:names).join
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ module Ruboty
2
+ module Eto
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,25 @@
1
+ require "ruboty/eto/actions/names"
2
+ require "ruboty/eto/actions/name"
3
+ require "ruboty/eto/actions/emoji"
4
+
5
+ module Ruboty
6
+ module Handlers
7
+ class Eto < Base
8
+ on /eto names\z/, name: 'names', description: 'get eto names'
9
+ on /eto name (?<year>\d{4})\z/, name: 'name', description: 'get eto name from year'
10
+ on /eto emoji (?<year>\d{4})\z/, name: 'emoji', description: 'get eto emoji from year'
11
+
12
+ def names(message)
13
+ Ruboty::Eto::Actions::Names.new(message).call
14
+ end
15
+
16
+ def name(message)
17
+ Ruboty::Eto::Actions::Name.new(message).call
18
+ end
19
+
20
+ def emoji(message)
21
+ Ruboty::Eto::Actions::Emoji.new(message).call
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ruboty/eto/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ruboty-eto"
8
+ spec.version = Ruboty::Eto::VERSION
9
+ spec.authors = ["tbpgr"]
10
+ spec.email = ["tbpgr@tbpgr.jp"]
11
+ spec.summary = %q{Get Eto (Japanese Zodiac) name or emoji.}
12
+ spec.description = %q{Get Eto (Japanese Zodiac) name or emoji.}
13
+ spec.homepage = "https://github.com/tbpgr/ruboty-eto"
14
+ spec.license = "MIT"
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_runtime_dependency "eto"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.7"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruboty-eto
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - tbpgr
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-27 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: eto
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.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ description: Get Eto (Japanese Zodiac) name or emoji.
70
+ email:
71
+ - tbpgr@tbpgr.jp
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - lib/ruboty/eto.rb
82
+ - lib/ruboty/eto/actions/emoji.rb
83
+ - lib/ruboty/eto/actions/eto_helper.rb
84
+ - lib/ruboty/eto/actions/name.rb
85
+ - lib/ruboty/eto/actions/names.rb
86
+ - lib/ruboty/eto/version.rb
87
+ - lib/ruboty/handlers/eto.rb
88
+ - ruboty-eto.gemspec
89
+ homepage: https://github.com/tbpgr/ruboty-eto
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.3.0
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: Get Eto (Japanese Zodiac) name or emoji.
113
+ test_files: []