lita-karotz_actions 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: 4992d6ae31de304074576f6eb41c9d8d0472de23
4
+ data.tar.gz: be186c4b51b5e0ba6955c0c50cc4f228b0a6a0d6
5
+ SHA512:
6
+ metadata.gz: c23146c5be86f24027ee4c918ff0a9147758c6d58fa854c52a7a90825fb1c0dccb8d8bb2251dda4ae99f6197581074d51ee30a6b62c56d45d87d3efb7226d610
7
+ data.tar.gz: b9f4027f94069f9031851a8f40116c454deeea749bafe7d60c6a30c11ae67586367efb0060e2fa7134afe5de130ab1f98219c648dc29a7dc94d03dc64bbafc0c
data/.gitignore ADDED
@@ -0,0 +1,18 @@
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
+ .env*
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --require spec_helper
3
+ --require rspec/instafail
4
+ --format documentation
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
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 Ryan Jones
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,40 @@
1
+ # lita-karotz_actions
2
+
3
+ Sends actions to the karot kake application
4
+
5
+ ## Installation
6
+
7
+ Add lita-karotz_actions to your Lita instance's Gemfile:
8
+
9
+ ``` ruby
10
+ gem "lita-karotz_actions"
11
+ ```
12
+
13
+
14
+ ## Configuration
15
+
16
+ ```
17
+ Lita.configure do |config|
18
+ ...
19
+ Lita.config.handlers.karotz_actions.karot_kake_url = ENV['KAROT_KAKE_URL']
20
+ ...
21
+ end
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ ``` lita message i like waffles ```
27
+
28
+ Tells karotz to say 'i like waffles'
29
+
30
+ ``` lita karotz ears ```
31
+
32
+ Moves karotz ears
33
+
34
+ ``` lita karotz nyan ```
35
+
36
+ Plays nyan cat *meow meow*
37
+
38
+ ## License
39
+
40
+ [MIT](http://opensource.org/licenses/MIT)
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/rake ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rake' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rake', 'rake')
@@ -0,0 +1,43 @@
1
+ require 'rest-client'
2
+
3
+ module Lita
4
+ module Handlers
5
+ class KarotzActions < Handler
6
+
7
+ def self.default_config(config)
8
+ config.karot_kake_url = nil
9
+ end
10
+
11
+ MESSAGE_REGEX = /(karotz|k) message (.*)/i
12
+ route(MESSAGE_REGEX, :message, command: true,
13
+ help: { "karotz message <message>" => "Tell karotz what to say" }
14
+ )
15
+ route(/(karotz|k) ears/i, :ears, command: true,
16
+ help: { "karotz ears" => "Move karotz ears" }
17
+ )
18
+ route(/(karotz|k) nyan/i, :nyan, command: true,
19
+ help: { "karotz nyan" => "Play nyan cat *meow meow*" }
20
+ )
21
+
22
+ def message(response)
23
+ message = response.message.body.match(MESSAGE_REGEX).captures[1]
24
+ RestClient.post "#{karot_kake_url}/speak", { message: message }
25
+ end
26
+
27
+ def ears(response)
28
+ RestClient.post "#{karot_kake_url}/ears", {}
29
+ end
30
+
31
+ def nyan(response)
32
+ RestClient.post "#{karot_kake_url}/nyan", {}
33
+ end
34
+
35
+ private
36
+ def karot_kake_url
37
+ Lita.config.handlers.karotz_actions.karot_kake_url || raise('karot_kake_url not set')
38
+ end
39
+ end
40
+
41
+ Lita.register_handler(KarotzActions)
42
+ end
43
+ end
@@ -0,0 +1,7 @@
1
+ require "lita"
2
+
3
+ Lita.load_locales Dir[File.expand_path(
4
+ File.join("..", "..", "locales", "*.yml"), __FILE__
5
+ )]
6
+
7
+ require "lita/handlers/karotz_actions"
@@ -0,0 +1,26 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = "lita-karotz_actions"
3
+ spec.version = "0.0.1"
4
+ spec.authors = ["Michael van den Beuken", "Ruben Estevez", "Jordan Babe", "Mathieu Gilbert", "Ryan Jones", "Darko Dosenovic"]
5
+ spec.email = ["michael.beuken@gmail.com", "ruben.a.estevez@gmail.com", "jorbabe@gmail.com", "mathieu.gilbert@ama.ab.ca", "ryan.michael.jones@gmail.com", "darko.dosenovic@ama.ab.ca"]
6
+ spec.description = %q{Send actions to the karot kake app}
7
+ spec.summary = %q{Send actions to the karot kake app}
8
+ spec.homepage = "https://github.com/amaabca/lita-karotz_actions"
9
+ spec.license = "MIT"
10
+ spec.metadata = { "lita_plugin_type" => "handler" }
11
+
12
+ spec.files = `git ls-files`.split($/)
13
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
14
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
+ spec.require_paths = ["lib"]
16
+
17
+ spec.add_runtime_dependency "lita", ">= 3.3"
18
+ spec.add_runtime_dependency "rest-client"
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 "rspec-instafail"
25
+ spec.add_development_dependency "pry"
26
+ end
data/locales/en.yml ADDED
@@ -0,0 +1,4 @@
1
+ en:
2
+ lita:
3
+ handlers:
4
+ karotz_actions:
@@ -0,0 +1,17 @@
1
+ require "spec_helper"
2
+
3
+ describe Lita::Handlers::KarotzActions, lita_handler: true do
4
+ before :each do
5
+ Lita.config.handlers.karotz_actions.karot_kake_url = "http://example.com/waffles"
6
+ allow(RestClient).to receive(:post)
7
+ end
8
+
9
+ it { routes_command("k ears").to(:ears) }
10
+ it { routes_command("k message i like waffles").to(:message) }
11
+ it { routes_command("k nyan").to(:nyan) }
12
+
13
+ it "call karot kake with a message" do
14
+ expect(RestClient).to receive(:post)
15
+ send_command("k message i like waffles")
16
+ end
17
+ end
@@ -0,0 +1,11 @@
1
+ require "simplecov"
2
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
3
+ SimpleCov::Formatter::HTMLFormatter
4
+ ]
5
+ SimpleCov.start do
6
+ add_filter "/spec/"
7
+ add_filter "/vendor/"
8
+ end
9
+
10
+ require "lita-karotz_actions"
11
+ require "lita/rspec"
metadata ADDED
@@ -0,0 +1,184 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lita-karotz_actions
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Michael van den Beuken
8
+ - Ruben Estevez
9
+ - Jordan Babe
10
+ - Mathieu Gilbert
11
+ - Ryan Jones
12
+ - Darko Dosenovic
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+ date: 2014-07-28 00:00:00.000000000 Z
17
+ dependencies:
18
+ - !ruby/object:Gem::Dependency
19
+ name: lita
20
+ requirement: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: '3.3'
25
+ type: :runtime
26
+ prerelease: false
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: '3.3'
32
+ - !ruby/object:Gem::Dependency
33
+ name: rest-client
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '1.3'
53
+ type: :development
54
+ prerelease: false
55
+ version_requirements: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '1.3'
60
+ - !ruby/object:Gem::Dependency
61
+ name: rake
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ type: :development
68
+ prerelease: false
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ - !ruby/object:Gem::Dependency
75
+ name: rspec
76
+ requirement: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 3.0.0
81
+ type: :development
82
+ prerelease: false
83
+ version_requirements: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: 3.0.0
88
+ - !ruby/object:Gem::Dependency
89
+ name: simplecov
90
+ requirement: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ type: :development
96
+ prerelease: false
97
+ version_requirements: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ - !ruby/object:Gem::Dependency
103
+ name: rspec-instafail
104
+ requirement: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ type: :development
110
+ prerelease: false
111
+ version_requirements: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ - !ruby/object:Gem::Dependency
117
+ name: pry
118
+ requirement: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ type: :development
124
+ prerelease: false
125
+ version_requirements: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ description: Send actions to the karot kake app
131
+ email:
132
+ - michael.beuken@gmail.com
133
+ - ruben.a.estevez@gmail.com
134
+ - jorbabe@gmail.com
135
+ - mathieu.gilbert@ama.ab.ca
136
+ - ryan.michael.jones@gmail.com
137
+ - darko.dosenovic@ama.ab.ca
138
+ executables:
139
+ - rake
140
+ extensions: []
141
+ extra_rdoc_files: []
142
+ files:
143
+ - ".gitignore"
144
+ - ".rspec"
145
+ - ".travis.yml"
146
+ - Gemfile
147
+ - LICENSE
148
+ - README.md
149
+ - Rakefile
150
+ - bin/rake
151
+ - lib/lita-karotz_actions.rb
152
+ - lib/lita/handlers/karotz_actions.rb
153
+ - lita-karotz_actions.gemspec
154
+ - locales/en.yml
155
+ - spec/lita/handlers/karotz_actions_spec.rb
156
+ - spec/spec_helper.rb
157
+ homepage: https://github.com/amaabca/lita-karotz_actions
158
+ licenses:
159
+ - MIT
160
+ metadata:
161
+ lita_plugin_type: handler
162
+ post_install_message:
163
+ rdoc_options: []
164
+ require_paths:
165
+ - lib
166
+ required_ruby_version: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - ">="
169
+ - !ruby/object:Gem::Version
170
+ version: '0'
171
+ required_rubygems_version: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ version: '0'
176
+ requirements: []
177
+ rubyforge_project:
178
+ rubygems_version: 2.2.2
179
+ signing_key:
180
+ specification_version: 4
181
+ summary: Send actions to the karot kake app
182
+ test_files:
183
+ - spec/lita/handlers/karotz_actions_spec.rb
184
+ - spec/spec_helper.rb