lita-github_pr_list 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lita/github_pr_list/comment_hook.rb +15 -18
- data/lib/lita/github_pr_list/version.rb +1 -1
- data/spec/fixtures/design/issue_comment_event_passed.json +1 -1
- data/spec/fixtures/issue_comment_event_passed.json +1 -1
- data/spec/fixtures/issue_comment_event_passed_design.json +2 -2
- data/spec/fixtures/issue_comment_event_passed_emoji.json +1 -1
- data/spec/lita/handlers/comment_hook_spec.rb +5 -16
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 538889f825d06f30a87200c3d0d500ba7efb3ed8
|
4
|
+
data.tar.gz: b0aca30a6d3c4927d08f614f2fc890d36b8fada5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 120c98b331ef3f20e8eabb92c6023149fc44e6e49a6ac4682c84da11ee63ab744065762507de71c9492237911cea4f2eaf9bcbc5e4a7020762ef7b558e9911f0
|
7
|
+
data.tar.gz: 207c0582466140f972f62d3513e6afa3216a03c51123ca31937a8ab89ea5e086d6481a6bacbbe2f0803984e49a4b641ecaaed0892872d588768ec446258f9ec3
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Lita
|
2
2
|
module GithubPrList
|
3
3
|
class CommentHook
|
4
|
-
attr_accessor :request, :response, :payload, :commenter, :issue_owner, :issue_title, :issue_body,
|
5
|
-
:issue_html_url, :redis, :github_organization, :github_client
|
4
|
+
attr_accessor :request, :response, :payload, :commenter, :issue_owner, :issue_title, :issue_body,
|
5
|
+
:status, :comment_body, :issue_html_url, :redis, :github_organization, :github_client
|
6
6
|
|
7
7
|
def initialize(params = {})
|
8
8
|
self.response = params.fetch(:response, nil)
|
@@ -20,21 +20,22 @@ module Lita
|
|
20
20
|
self.issue_owner = redis.get("alias:#{payload["issue"]["user"]["login"]}") || payload["issue"]["user"]["login"]
|
21
21
|
self.issue_title = payload["issue"]["title"]
|
22
22
|
self.issue_html_url = payload["issue"]["html_url"]
|
23
|
-
self.issue_body = payload["
|
23
|
+
self.issue_body = payload["issue"]["body"]
|
24
|
+
self.comment_body = payload["comment"]["body"]
|
24
25
|
end
|
25
26
|
|
26
27
|
def message
|
27
28
|
self.status = repo_status(payload["repository"]["full_name"], payload["issue"])
|
28
|
-
if !
|
29
|
-
if
|
29
|
+
if !comment_body.empty?
|
30
|
+
if comment_body.match Lita::GithubPrList::Status::REVIEW_REGEX
|
30
31
|
"@#{commenter} is currently reviewing: #{issue_title}. #{issue_html_url}, @#{commenter}++"
|
31
|
-
elsif
|
32
|
+
elsif comment_body.match Lita::GithubPrList::Status::FAIL_REGEX
|
32
33
|
"@#{issue_owner} your pull request: #{issue_title} has failed. #{issue_html_url}"
|
33
|
-
elsif
|
34
|
+
elsif comment_body.match Lita::GithubPrList::Status::FIXED_REGEX
|
34
35
|
"#{issue_title} has been fixed: #{issue_html_url}"
|
35
|
-
elsif
|
36
|
+
elsif comment_body.match Lita::GithubPrList::Status::PASS_DEV_REGEX
|
36
37
|
pass_dev?
|
37
|
-
elsif
|
38
|
+
elsif comment_body.match Lita::GithubPrList::Status::PASS_DESIGN_REGEX
|
38
39
|
pass_design?
|
39
40
|
end
|
40
41
|
else
|
@@ -44,20 +45,16 @@ module Lita
|
|
44
45
|
|
45
46
|
private
|
46
47
|
def pass_dev?
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
resp = "@#{issue_owner} your pull request: #{issue_title} has passed DEV REVIEW. #{issue_html_url}"
|
51
|
-
if self.status[:list].include?(Lita::GithubPrList::Status::DESIGN_REVIEW_REQUIRED) && !status[:list].include?(Lita::GithubPrList::Status::PASS_DESIGN_EMOJI)
|
52
|
-
resp += " - You still require DESIGN REVIEW"
|
53
|
-
end
|
54
|
-
resp
|
48
|
+
resp = "@#{issue_owner} your pull request: #{issue_title} has passed DEV REVIEW. #{issue_html_url}"
|
49
|
+
if issue_body.match(Lita::GithubPrList::Status::DESIGN_REVIEW_REGEX) && !status[:list].include?(Lita::GithubPrList::Status::PASS_DESIGN_EMOJI)
|
50
|
+
resp += " - You still require DESIGN REVIEW"
|
55
51
|
end
|
52
|
+
resp
|
56
53
|
end
|
57
54
|
|
58
55
|
def pass_design?
|
59
56
|
resp = "@#{issue_owner} your pull request: #{issue_title} has passed DESIGN. #{issue_html_url}"
|
60
|
-
if
|
57
|
+
if issue_body.match(Lita::GithubPrList::Status::DEV_REVIEW_REGEX) && !status[:list].include?(Lita::GithubPrList::Status::PASS_DEV_EMOJI)
|
61
58
|
resp += " - You still require DEV REVIEW"
|
62
59
|
end
|
63
60
|
resp
|
@@ -42,7 +42,7 @@
|
|
42
42
|
"created_at": "2014-07-01T17:21:15Z",
|
43
43
|
"updated_at": "2014-07-01T17:21:15Z",
|
44
44
|
"closed_at": null,
|
45
|
-
"body": "It looks like you accidently spelled 'commit' with two 't's."
|
45
|
+
"body": "It looks like you accidently spelled 'commit' with two 't's. :elephant: :art:"
|
46
46
|
},
|
47
47
|
"comment": {
|
48
48
|
"url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/47684681",
|
@@ -42,7 +42,7 @@
|
|
42
42
|
"created_at": "2014-07-01T17:21:15Z",
|
43
43
|
"updated_at": "2014-07-01T17:21:15Z",
|
44
44
|
"closed_at": null,
|
45
|
-
"body": "It looks like you accidently spelled 'commit' with two 't's."
|
45
|
+
"body": "It looks like you accidently spelled 'commit' with two 't's. :elephant: :art:"
|
46
46
|
},
|
47
47
|
"comment": {
|
48
48
|
"url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/47684681",
|
@@ -70,7 +70,7 @@
|
|
70
70
|
},
|
71
71
|
"created_at": "2014-07-01T17:21:15Z",
|
72
72
|
"updated_at": "2014-07-01T17:21:15Z",
|
73
|
-
"body": "Passed DESIGN :art
|
73
|
+
"body": "Passed DESIGN :art::art::art:"
|
74
74
|
},
|
75
75
|
"repository": {
|
76
76
|
"id": 20000106,
|
@@ -42,7 +42,7 @@
|
|
42
42
|
"created_at": "2014-07-01T17:21:15Z",
|
43
43
|
"updated_at": "2014-07-01T17:21:15Z",
|
44
44
|
"closed_at": null,
|
45
|
-
"body": "It looks like you accidently spelled 'commit' with two 't's."
|
45
|
+
"body": "It looks like you accidently spelled 'commit' with two 't's. :elephant: :art:"
|
46
46
|
},
|
47
47
|
"comment": {
|
48
48
|
"url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/47684681",
|
@@ -104,28 +104,29 @@ describe Lita::Handlers::GithubPrList, lita_handler: true do
|
|
104
104
|
github_handler = Lita::Handlers::GithubPrList.new robot
|
105
105
|
github_handler.comment_hook(request, response)
|
106
106
|
|
107
|
-
expect(replies.last).to include("@mcwaffle1234 your pull request: Spelling error in the README file has passed."\
|
107
|
+
expect(replies.last).to include("@mcwaffle1234 your pull request: Spelling error in the README file has passed DESIGN."\
|
108
108
|
" https://github.com/baxterthehacker/public-repo/issues/47")
|
109
109
|
expect(replies.last).to_not include(" - You still require DEV REVIEW")
|
110
110
|
end
|
111
|
+
|
111
112
|
context "Design/Dev passed and book is used" do
|
112
113
|
it "returns - currently reviewing" do
|
113
114
|
expect_any_instance_of(Octokit::Client).to receive(:issue_comments).and_return(issue_comments_passed_both_book_after)
|
114
115
|
|
115
|
-
request = Rack::Request.new("rack.input" => StringIO.new(
|
116
|
+
request = Rack::Request.new("rack.input" => StringIO.new(issue_comment_event_in_review))
|
116
117
|
response = Rack::Response.new(['Hello'], 200, { 'Content-Type' => 'text/plain' })
|
117
118
|
|
118
119
|
github_handler = Lita::Handlers::GithubPrList.new robot
|
119
120
|
github_handler.comment_hook(request, response)
|
120
121
|
|
121
122
|
expect(replies.last).to include("@baxterthehacker is currently reviewing: Spelling error in the README file."\
|
122
|
-
" https://github.com/baxterthehacker/public-repo/issues/47"
|
123
|
+
" https://github.com/baxterthehacker/public-repo/issues/47,"\
|
124
|
+
" @baxterthehacker++")
|
123
125
|
expect(replies.last).to_not include("@mcwaffle1234 your pull request: Spelling error in the README file has passed."\
|
124
126
|
" https://github.com/baxterthehacker/public-repo/issues/47")
|
125
127
|
end
|
126
128
|
end
|
127
129
|
|
128
|
-
|
129
130
|
it "mentions the github user in the room and tell them they failed" do
|
130
131
|
expect_any_instance_of(Octokit::Client).to receive(:issue_comments).and_return(issue_comments_failed)
|
131
132
|
|
@@ -179,18 +180,6 @@ describe Lita::Handlers::GithubPrList, lita_handler: true do
|
|
179
180
|
" https://github.com/baxterthehacker/public-repo/issues/47")
|
180
181
|
end
|
181
182
|
|
182
|
-
it "it says nothing" do
|
183
|
-
expect_any_instance_of(Octokit::Client).to receive(:issue_comments).and_return(issue_comments_trivial)
|
184
|
-
|
185
|
-
request = Rack::Request.new("rack.input" => StringIO.new(issue_comment_event_passed_design_context))
|
186
|
-
response = Rack::Response.new(['Hello'], 200, { 'Content-Type' => 'text/plain' })
|
187
|
-
|
188
|
-
github_handler = Lita::Handlers::GithubPrList.new robot
|
189
|
-
github_handler.comment_hook(request, response)
|
190
|
-
|
191
|
-
expect(replies.last).to eq(nil)
|
192
|
-
end
|
193
|
-
|
194
183
|
context "starting out with an initial elephant" do
|
195
184
|
it "mentions the github user in the room and tell them they passed" do
|
196
185
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-github_pr_list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael van den Beuken
|
@@ -15,7 +15,7 @@ authors:
|
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
|
-
date: 2017-07-
|
18
|
+
date: 2017-07-14 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: lita
|
@@ -230,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
230
230
|
version: '0'
|
231
231
|
requirements: []
|
232
232
|
rubyforge_project:
|
233
|
-
rubygems_version: 2.
|
233
|
+
rubygems_version: 2.5.1
|
234
234
|
signing_key:
|
235
235
|
specification_version: 4
|
236
236
|
summary: List open pull requests for an organization.
|