lita-sushiyuki 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ce281ca5e0508e3f42b05224a70d1675b509db6a
4
+ data.tar.gz: 9388de9d367a8752efd575f387c5f959c7c87281
5
+ SHA512:
6
+ metadata.gz: ac6029e5311173c296fd09d206c7270de6a16d1c81d7d37044dd6df2abcbf278749543df7a4c10d47ab4cf103af1dc5ff66018c2cc9a82b7b9f8f4c3fb696e14
7
+ data.tar.gz: d16e1552b0ba6d85b8c484c8ef340d33b639fff43e707e27a284a68bd6774a46bcd4e6cfff27bf72c4369f3fb608e1df198c8e8530c47488227bae3f239a70e4
data/.gitignore ADDED
@@ -0,0 +1,22 @@
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
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in lita-sushiyuki.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,28 @@
1
+ 寿司ゆき (SUSHIYUKI) - http://awayuki.net/sushiyuki/
2
+ Copyright (c) 2014 awayuki. (CC BY-NC-ND 4.0)
3
+
4
+
5
+ Source code:
6
+
7
+ Copyright (c) 2014 fukayatsu
8
+
9
+ MIT License
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining
12
+ a copy of this software and associated documentation files (the
13
+ "Software"), to deal in the Software without restriction, including
14
+ without limitation the rights to use, copy, modify, merge, publish,
15
+ distribute, sublicense, and/or sell copies of the Software, and to
16
+ permit persons to whom the Software is furnished to do so, subject to
17
+ the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be
20
+ included in all copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # lita-sushiyuki
2
+
3
+ Give me :sushi:
4
+
5
+ ## Installation
6
+
7
+ Add this line to your lita's Gemfile:
8
+
9
+ gem 'lita-sushiyuki'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ ## Usage
16
+
17
+ ```
18
+ Lita: sushi me ikura
19
+ Lita: sushi ikura
20
+ Lita: sushi ok
21
+ Lita: sushi list
22
+ ...
23
+ ```
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/fukayatsu/lita-sushiyuki/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
32
+
33
+ ## SUSHIYUKI
34
+
35
+ 寿司ゆき (SUSHIYUKI) - http://awayuki.net/sushiyuki/
36
+ Copyright (c) 2014 awayuki. (CC BY-NC-ND 4.0)
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,92 @@
1
+ module Lita
2
+ module Handlers
3
+ class Sushiyuki < Handler
4
+ SUSHI_MAP = {
5
+ # filename: aliases
6
+ '01' => ["yes"],
7
+ '02' => ["no"],
8
+ '03' => ["ok"],
9
+ '04' => ["thanks", "thank you", "gyoku"],
10
+ '05' => ["sorry"],
11
+ '06' => ["sigh"],
12
+ '07' => ["angry"],
13
+ '08' => ["no comment"],
14
+ '09' => ["cool"],
15
+ '10' => ["kappa"],
16
+ '11' => ["help"],
17
+ '12' => ["what", "question", "?"],
18
+ '13' => ["sleep", "sleepy"],
19
+ '14' => ["oh no"],
20
+ '15' => ["love"],
21
+ '16' => ["grin"],
22
+ '17' => ["bye"],
23
+ '18' => ["sneak"],
24
+ '19' => ["hide"],
25
+ '20' => ["peel"],
26
+ '21' => ["hot"],
27
+ '22' => ["fail", "dip"],
28
+ '23' => ["too much", "ikura"],
29
+ '24' => ["happy"],
30
+ '25' => ["smile"],
31
+ '26' => ["wat", "anago"],
32
+ '27' => ["tea", "content", "agari"],
33
+ '28' => ["gari", "don't forget"],
34
+ '29' => ["wasabi", "sabi"],
35
+ '30' => ["come on", "c'mon"],
36
+ '31' => ["sparkles"],
37
+ '32' => ["sweat"],
38
+ '33' => ["cry"],
39
+ '34' => ["surprised"],
40
+ '35' => ["idea"],
41
+ '36' => ["sad", "sob"],
42
+ '37' => ["chat"],
43
+ '38' => ["phone", "call"],
44
+ '39' => ["hello"],
45
+ '40' => ["see you"],
46
+ }
47
+
48
+ def find_sushi(query)
49
+ sushi = SUSHI_MAP.find{ |name, aliases| aliases.include?(query) }
50
+ return nil unless sushi
51
+ sushi[0]
52
+ end
53
+
54
+ def sushi_url(filename)
55
+ "https://d1zd1v0cxnbx2w.cloudfront.net/images/sets/sushiyuki/#{filename}.png"
56
+ end
57
+
58
+ route /\A(?:sushi)(?:\s+me)? (.+)\Z/, :query_sushiyuki, command: false,
59
+ help: { "sushi [neta]" => "reply sushiyuki for you." }
60
+ def query_sushiyuki(response)
61
+ query = response.matches[0][0].downcase
62
+ return if query == 'list'
63
+ filename = find_sushi(query)
64
+ response.reply sushi_url(filename) if filename
65
+ end
66
+
67
+ route /^(?:sushi)(?:\s+me)? list/, :list_sushiyuki, command: false,
68
+ help: { "sushi list" => "list sushi" }
69
+ def list_sushiyuki(response)
70
+ unless Lita.config.robot.adapter == :twitter
71
+ return response.reply SUSHI_MAP.values.flatten.join(', ')
72
+ end
73
+
74
+ batch = []
75
+ SUSHI_MAP.values.flatten.each do |name|
76
+ batch << name
77
+ next if batch.join(', ').length < 110
78
+ response.reply batch.join(', ')
79
+ batch = []
80
+ end
81
+ response.reply batch.join(', ') unless batch.empty?
82
+ end
83
+
84
+ route /🍣|寿司|すし|スシ|スシ/, :hear_sushi, command: false,
85
+ help: { "sushi list" => "list sushi" }
86
+ def hear_sushi(response)
87
+ response.reply sushi_url(find_sushi('sneak')) if rand(5) == 0
88
+ end
89
+ end
90
+ Lita.register_handler(Sushiyuki)
91
+ end
92
+ end
@@ -0,0 +1,5 @@
1
+ module Lita
2
+ module Sushiyuki
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ require 'lita'
2
+ require "lita/sushiyuki/version"
3
+ require "lita/handlers/sushiyuki"
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'lita/sushiyuki/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "lita-sushiyuki"
8
+ spec.version = Lita::Sushiyuki::VERSION
9
+ spec.authors = ["fukayatsu"]
10
+ spec.email = ["fukayatsu@gmail.com"]
11
+ spec.summary = %q{Give me sushi}
12
+ spec.description = %q{Give me sushi}
13
+ spec.homepage = "https://github.com/fukayatsu/lita-sushiyuki"
14
+ spec.license = "MIT"
15
+
16
+ spec.metadata = { "lita_plugin_type" => "handler" }
17
+
18
+ spec.files = `git ls-files -z`.split("\x0")
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_runtime_dependency "lita", ">= 3.1"
24
+ spec.add_runtime_dependency 'pebbles-suddenly_death_string', '~> 0.0.4'
25
+ spec.add_runtime_dependency 'flippy', '~> 0.1.2'
26
+ spec.add_runtime_dependency 'rufus-scheduler', '~> 3.0.7'
27
+
28
+ spec.add_development_dependency "bundler", "~> 1.6"
29
+ spec.add_development_dependency "rake"
30
+ spec.add_development_dependency "pry"
31
+ end
metadata ADDED
@@ -0,0 +1,152 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lita-sushiyuki
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - fukayatsu
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-06 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: '3.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '3.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pebbles-suddenly_death_string
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.0.4
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.0.4
41
+ - !ruby/object:Gem::Dependency
42
+ name: flippy
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.1.2
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.1.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: rufus-scheduler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 3.0.7
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 3.0.7
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.6'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.6'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
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: pry
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
+ description: Give me sushi
112
+ email:
113
+ - fukayatsu@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - Gemfile
120
+ - LICENSE.txt
121
+ - README.md
122
+ - Rakefile
123
+ - lib/lita-sushiyuki.rb
124
+ - lib/lita/handlers/sushiyuki.rb
125
+ - lib/lita/sushiyuki/version.rb
126
+ - lita-sushiyuki.gemspec
127
+ homepage: https://github.com/fukayatsu/lita-sushiyuki
128
+ licenses:
129
+ - MIT
130
+ metadata:
131
+ lita_plugin_type: handler
132
+ post_install_message:
133
+ rdoc_options: []
134
+ require_paths:
135
+ - lib
136
+ required_ruby_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ required_rubygems_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ requirements: []
147
+ rubyforge_project:
148
+ rubygems_version: 2.2.2
149
+ signing_key:
150
+ specification_version: 4
151
+ summary: Give me sushi
152
+ test_files: []