lita-ambush 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -14
- data/lib/lita/handlers/ambush.rb +1 -1
- data/lita-ambush.gemspec +1 -1
- data/spec/lita/handlers/ambush_spec.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aae89189322cc97c87fa2264ae4be004da5c75c7
|
4
|
+
data.tar.gz: cfc777349ea31853e7ec3a417bf2698343c7a5a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be1cee30fbc133d4aab87ba74055068f5d971669b388efa090ef5c6bc5cca22d6d6642af398d80636a53b151fe14156ae4cc7efcad63fe13c059537aee9e3697
|
7
|
+
data.tar.gz: 72c53bfd7959f7c76e63b8cbc2d5c9b7450f7767571b349eaf026fa6d5b39993bc83bd2aa98a0722dcc8605ee9832761aadad1fb9c85ed12b66ec70fa93bc53b
|
data/README.md
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
# lita-ambush
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/jjasghar/lita-ambush.svg?branch=master)](https://travis-ci.org/jjasghar/lita-ambush)[![Coverage Status](https://coveralls.io/repos/jjasghar/lita-ambush/badge.svg?branch=master)](https://coveralls.io/r/jjasghar/lita-ambush?branch=master)
|
3
4
|
|
4
5
|
**lita-ambush** is a handler for [Lita](http://lita.io/) that stores messages for a user and displays
|
5
6
|
them the next time they say something.
|
6
7
|
|
8
|
+
We also recorded the three of us making this plugin. You can watch it [here](http://youtu.be/mQ6ULfjewE0).
|
9
|
+
|
7
10
|
## Installation
|
8
11
|
|
9
12
|
Add lita-ambush to your Lita instance's Gemfile:
|
@@ -16,30 +19,40 @@ gem "lita-ambush"
|
|
16
19
|
|
17
20
|
### Optional attributes
|
18
21
|
|
19
|
-
|
20
|
-
* `preview_join_messages` (Symbol) - Post a message for the user when they
|
21
|
-
just join the room. Options are `:on`, and `:off`. Default: `:off`.
|
22
|
-
|
23
|
-
### Example
|
24
|
-
|
25
|
-
Still TODO
|
26
|
-
```
|
27
|
-
Lita.configure do |config|
|
28
|
-
config.handlers.ambush.preview_join_messages = :off
|
29
|
-
end
|
30
|
-
```
|
22
|
+
None
|
31
23
|
|
32
24
|
## Usage
|
33
25
|
|
34
26
|
```
|
35
27
|
user1> lita ambush user2: Ohai! You forgot your card at lunch!
|
36
28
|
Lita> Ambush Prepared
|
37
|
-
User2 joined the channel
|
38
|
-
Lita> User2 you have 1 message(s) waiting (Still TODO)
|
39
29
|
user2> That was a great lunch!
|
40
30
|
Lita> user2: while you were out, user1 said: Ohai! You forgot your card at lunch!
|
41
31
|
```
|
42
32
|
|
33
|
+
## TODO
|
34
|
+
|
35
|
+
- Have the plugin tell the time elapsed since the ambush was created, example:
|
36
|
+
`user2: while you were out, user1 said: Ohai! You forgot your card at lunch! was sent 10 minutes ago`
|
37
|
+
|
38
|
+
- Have the plugin report the number of waiting messages you have when a `JOIN` action happens, example:
|
39
|
+
|
40
|
+
```
|
41
|
+
User2 joined the channel
|
42
|
+
Lita> User2 you have 1 message(s) waiting
|
43
|
+
```
|
44
|
+
|
45
|
+
Configuration can happen via:
|
46
|
+
|
47
|
+
* `preview_join_messages` (Symbol) - Post a message for the user when they
|
48
|
+
just join the room. Options are `:on`, and `:off`. Default: `:off`.
|
49
|
+
|
50
|
+
```
|
51
|
+
Lita.configure do |config|
|
52
|
+
config.handlers.ambush.preview_join_messages = :off
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
43
56
|
## License
|
44
57
|
|
45
58
|
[MIT](http://opensource.org/licenses/MIT)
|
data/lib/lita/handlers/ambush.rb
CHANGED
@@ -4,7 +4,7 @@ module Lita
|
|
4
4
|
module Handlers
|
5
5
|
class Ambush < Handler
|
6
6
|
|
7
|
-
route(/^ambush
|
7
|
+
route(/^ambush\s+(\S+):\s(.+)/, :ambush, command: true, help: { "ambush USER: message" => "Ambushes the USER with the message you leave."} )
|
8
8
|
route(/./, :response)
|
9
9
|
|
10
10
|
def ambush(request)
|
data/lita-ambush.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "lita-ambush"
|
3
|
-
spec.version = "1.0.
|
3
|
+
spec.version = "1.0.1"
|
4
4
|
spec.authors = ["JJ Asghar","Chris Baker","Greg Kitson"]
|
5
5
|
spec.email = ["jjasghar@gmail.com","dosman711@gmail.com","greg.kitson@gmail.com"]
|
6
6
|
spec.description = %q{Allow lita to ambush your users}
|
@@ -7,7 +7,7 @@ describe Lita::Handlers::Ambush, lita_handler: true do
|
|
7
7
|
|
8
8
|
it "testing the storage into redis" do
|
9
9
|
user1 = Lita::User.create(123, name: "user1")
|
10
|
-
send_command("ambush
|
10
|
+
send_command("ambush user1: this is a taco!", as: user1)
|
11
11
|
expect(replies.last).to eq("#{user1.name} I've stored the ambush")
|
12
12
|
redis_rpop=Lita.redis.rpop("handlers:ambush:#{user1.name}")
|
13
13
|
outputted_yaml=YAML.load(redis_rpop)
|
@@ -17,8 +17,8 @@ describe Lita::Handlers::Ambush, lita_handler: true do
|
|
17
17
|
|
18
18
|
it "should send store two messages" do
|
19
19
|
user1 = Lita::User.create(123, name: "user1")
|
20
|
-
send_command("ambush
|
21
|
-
send_command("ambush
|
20
|
+
send_command("ambush user1: this is a taco!", as: user1)
|
21
|
+
send_command("ambush user1: this is a burruto!", as: user1)
|
22
22
|
expect(replies.last).to eq("#{user1.name} I've stored the ambush")
|
23
23
|
expect(replies.last).to eq("#{user1.name} I've stored the ambush")
|
24
24
|
redis_rpop=Lita.redis.rpop("handlers:ambush:#{user1.name}")
|
@@ -37,7 +37,7 @@ describe Lita::Handlers::Ambush, lita_handler: true do
|
|
37
37
|
it "should respond with the message stored" do
|
38
38
|
user1 = Lita::User.create(123, name: "user1")
|
39
39
|
user2 = Lita::User.create(456, name: "user2")
|
40
|
-
send_command("ambush
|
40
|
+
send_command("ambush #{user2.name}: this is a taco!", as: user1)
|
41
41
|
send_message("I like to watch Sulvester Stalone!", as: user2)
|
42
42
|
expect(replies.last).to eq("#{user2.name}: While you were out, #{user1.name} said: this is a taco!")
|
43
43
|
end
|
@@ -52,8 +52,8 @@ describe Lita::Handlers::Ambush, lita_handler: true do
|
|
52
52
|
it "should respond with the multiple messages stored" do
|
53
53
|
user1 = Lita::User.create(123, name: "user1")
|
54
54
|
user2 = Lita::User.create(456, name: "user2")
|
55
|
-
send_command("ambush
|
56
|
-
send_command("ambush
|
55
|
+
send_command("ambush #{user2.name}: this is a taco!", as: user1)
|
56
|
+
send_command("ambush #{user2.name}: this is a burrito!", as: user1)
|
57
57
|
send_message("I like to watch Sulvester Stalone!", as: user2)
|
58
58
|
expect(replies[2]).to eq("#{user2.name}: While you were out, #{user1.name} said: this is a taco!")
|
59
59
|
expect(replies[3]).to eq("#{user2.name}: While you were out, #{user1.name} said: this is a burrito!")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-ambush
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JJ Asghar
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-03-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: lita
|