lita-pullrequests 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/lita/handlers/pullrequests.rb +4 -4
- data/lita-pullrequests.gemspec +1 -1
- data/spec/lita/handlers/pullrequests_spec.rb +8 -6
- 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: 4dd5b417518a055224ceff19fc93b4855fa72a6e
|
4
|
+
data.tar.gz: 2e9da1a4c86869447103c22114875958ac284756
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2ea4f78b1e1f4df961474fea3e9ee0f20a6f7cba6c07b6641a4c49fce7fb796c54e8875a102aa4ddda34e11d5c7f0a32fa4c02094a2cb6783de97369bafdd7a
|
7
|
+
data.tar.gz: 322ad9afa953af2626987d06257429caf6b7b38799daf31c1c250a592634f77f7ed711f3b0d28fc6847cc160052714ceb1a02f722c6c7b0ad5cf82432baec5c0
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ Add the following configuration lines to your `lita_config`:
|
|
18
18
|
config.handlers.pullrequests.access_token = "a-github-api-access-token"
|
19
19
|
config.handlers.pullrequests.repo = "username/reponame"
|
20
20
|
config.handlers.pullrequests.review_label = "title of a label that represents a pr ready for review"
|
21
|
-
config.handlers.pullrequests.
|
21
|
+
config.handlers.pullrequests.merge_label = "title of a label that represents a pr ready for merge"
|
22
22
|
```
|
23
23
|
|
24
24
|
## Usage
|
@@ -1,24 +1,24 @@
|
|
1
1
|
module Lita
|
2
2
|
module Handlers
|
3
3
|
class Pullrequests < Handler
|
4
|
-
config :access_token, type: String, required: true
|
4
|
+
config :access_token, type: String, required: true
|
5
5
|
config :repo, type: String, required: true
|
6
6
|
config :review_label, type: String, required: false
|
7
7
|
config :merge_label, type: String, required: false
|
8
8
|
|
9
|
-
route(
|
9
|
+
route(/^(pull request( me)?)|(give me something to review)$/, :get_random_pr, command: true, help: {
|
10
10
|
"give me something to review" => "Shows you a random pull request that needs reviewing.",
|
11
11
|
"pull request (me)" => "Shows you a random pull request that needs reviewing."
|
12
12
|
})
|
13
13
|
|
14
|
-
route(
|
14
|
+
route(/^(summarize|all) pull requests$/, :list_all_pull_requests, command: true, help: {
|
15
15
|
"(summarize|all) pull requests" => "Lists all pull requests that need action."
|
16
16
|
})
|
17
17
|
|
18
18
|
|
19
19
|
# Helper method
|
20
20
|
def truncate(str, truncate_at, options = {})
|
21
|
-
return
|
21
|
+
return str unless str.length > truncate_at
|
22
22
|
|
23
23
|
omission = options[:omission] || '...'
|
24
24
|
length_with_room_for_omission = truncate_at - omission.length
|
data/lita-pullrequests.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "lita-pullrequests"
|
3
|
-
spec.version = "0.0.
|
3
|
+
spec.version = "0.0.2"
|
4
4
|
spec.authors = ["Taylor Lapeyre"]
|
5
5
|
spec.email = ["taylorlapeyre@gmail.com"]
|
6
6
|
spec.description = %q{A Lita handler to help you keep track of your pull requests.}
|
@@ -2,17 +2,19 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Lita::Handlers::Pullrequests, lita_handler: true do
|
4
4
|
before do
|
5
|
-
Lita.config.handlers.pullrequests.access_token = "
|
5
|
+
Lita.config.handlers.pullrequests.access_token = ENV["GITHUB_ACCESS_TOKEN"]
|
6
6
|
Lita.config.handlers.pullrequests.repo = "taylorlapeyre/lita-pullrequests"
|
7
7
|
Lita.config.handlers.pullrequests.review_label = "Needs Review"
|
8
8
|
Lita.config.handlers.pullrequests.merge_label = "Ready To Merge"
|
9
9
|
end
|
10
10
|
|
11
|
-
it { is_expected.to route_command("pull request") }
|
12
|
-
it { is_expected.to route_command("pull request me") }
|
13
|
-
it { is_expected.to route_command("give me something to review") }
|
14
|
-
it { is_expected.to route_command("all pull requests") }
|
15
|
-
it { is_expected.to route_command("summarize pull requests") }
|
11
|
+
it { is_expected.to route_command("pull request").to(:get_random_pr) }
|
12
|
+
it { is_expected.to route_command("pull request me").to(:get_random_pr) }
|
13
|
+
it { is_expected.to route_command("give me something to review").to(:get_random_pr) }
|
14
|
+
it { is_expected.to route_command("all pull requests").to(:list_all_pull_requests) }
|
15
|
+
it { is_expected.to route_command("summarize pull requests").to(:list_all_pull_requests) }
|
16
|
+
|
17
|
+
it { is_expected.to_not route_command("all pull requests").to(:get_random_pr) }
|
16
18
|
|
17
19
|
it "can respond with a random pull request" do
|
18
20
|
send_command("give me something to review")
|