lita-github-pinger 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/lib/lita/handlers/github_pinger.rb +5 -4
- data/lita-github-pinger.gemspec +1 -1
- data/spec/lita/handlers/github_pinger_spec.rb +42 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0d0c43ce18fa74ef02ff02f9bc9aaae3abdc75b
|
4
|
+
data.tar.gz: 57d70755df2863c234c2c9a94f74f6f51a89be62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b139be3fe17a3f570a832db23cb43bb7dc8a904454da0ba08a739343fc6164a8cb020260dbd07f1a56ab6ea329b8bc21a93016cbd653e2970ac3b0120d11a770
|
7
|
+
data.tar.gz: b8f90a271e5ab566f30fee252f0e69fbe277c2476cbcdcf08463055501f1c9b26d835102651e3774877fcc215970a0d0c4b82be52df8d9476bfb3e50f92686bf
|
@@ -2,18 +2,19 @@ module Lita
|
|
2
2
|
module Handlers
|
3
3
|
class GithubPinger < Handler
|
4
4
|
|
5
|
-
config :
|
5
|
+
config :engineers, type: Array, required: true
|
6
6
|
|
7
|
-
route(
|
7
|
+
route(/@(\w*)/, :detect_comment, command: false)
|
8
8
|
|
9
9
|
def detect_comment(message)
|
10
10
|
log(message.user.metadata["name"] + " was detected as a github bot")
|
11
|
+
|
11
12
|
return unless message.user.metadata["name"] == "github"
|
12
|
-
|
13
|
+
mentioned_username = message.matches[0][0]
|
13
14
|
|
14
15
|
# side effects intentional
|
15
16
|
found = config.engineers.any? do |eng|
|
16
|
-
message.reply("@" + eng[:slack]) if eng[:github] ==
|
17
|
+
message.reply("@" + eng[:slack]) if eng[:github] == mentioned_username
|
17
18
|
end
|
18
19
|
|
19
20
|
unless found
|
data/lita-github-pinger.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "lita-github-pinger"
|
3
|
-
spec.version = "0.1.
|
3
|
+
spec.version = "0.1.2"
|
4
4
|
spec.authors = ["Taylor Lapeyre"]
|
5
5
|
spec.email = ["taylorlapeyre@gmail.com"]
|
6
6
|
spec.description = "A Lita handler that detects github comment notifications and regurgitates a ping to the correct slack username."
|
@@ -1,8 +1,49 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Lita::Handlers::GithubPinger, lita_handler: true do
|
4
|
+
before do
|
5
|
+
registry.config.handlers.github_pinger.engineers = [
|
6
|
+
{
|
7
|
+
slack: "taylor",
|
8
|
+
github: "taylorlapeyre"
|
9
|
+
},
|
10
|
+
{
|
11
|
+
slack: "petergao",
|
12
|
+
github: "peteygao"
|
13
|
+
},
|
14
|
+
{
|
15
|
+
slack: "matt",
|
16
|
+
github: "mtthgn"
|
17
|
+
},
|
18
|
+
{
|
19
|
+
slack: "bigsean",
|
20
|
+
github: "telaviv"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
slack: "urich",
|
24
|
+
github: "maalur"
|
25
|
+
},
|
26
|
+
{
|
27
|
+
slack: "evan",
|
28
|
+
github: "evantarrh"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
slack: "bsturd",
|
32
|
+
github: "bsturdivan"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
slack: "jeff",
|
36
|
+
github: "jeffmicklos"
|
37
|
+
},
|
38
|
+
{
|
39
|
+
slack: "nan",
|
40
|
+
github: "thenanyu"
|
41
|
+
}
|
42
|
+
]
|
43
|
+
end
|
44
|
+
|
4
45
|
it "will respond" do
|
5
|
-
send_message("
|
46
|
+
send_message("comments up @taylorlapeyre)")
|
6
47
|
expect(replies.count).to eq 0
|
7
48
|
end
|
8
49
|
end
|