lita-github-commits 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/lib/lita/handlers/github_commits.rb +8 -1
- data/lita-github-commits.gemspec +1 -1
- data/spec/lita/handlers/github_commits_spec.rb +19 -7
- 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: 62d3af13c9629ccc9fef8b40294388070a79914b
|
4
|
+
data.tar.gz: be0c36a16d5170e34848a1bdadf798c25c1ce7f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a529b5a42050646669d629c6e40eb21e9e42af20a7e5366174dac88f8b66e01b1f4bea465bd3057a1936f30d23b568641733231bbaf294b819ab5a865009d9a
|
7
|
+
data.tar.gz: 8925a46036b47e8eef19264384b29939129cc43597d819239f5572a00e651497a77d86a92c96b5b8218d656702b08be39d65dc5697e74b06e283d71df5a20ac7
|
data/README.md
CHANGED
@@ -33,6 +33,15 @@ end
|
|
33
33
|
|
34
34
|
**Note**: For HipChat, the room should be the JID of the HipChat room (eg. `123_development@conf.hipchat.com`)
|
35
35
|
|
36
|
+
The output from Lita would look something like:
|
37
|
+
|
38
|
+
```
|
39
|
+
[GitHub] Got 3 new commits from Garen Torikian on octokitty/testing on the master branch
|
40
|
+
* Test
|
41
|
+
* This is me testing the windows client.
|
42
|
+
* Rename madame-bovary.txt to words/madame-bovary.txt
|
43
|
+
```
|
44
|
+
|
36
45
|
## Usage
|
37
46
|
|
38
47
|
You will need to add a GitHub Webhook url that points to: `http://address.of.lita/github-commits`
|
@@ -48,8 +48,9 @@ module Lita
|
|
48
48
|
branch = branch_from_ref(payload['ref'])
|
49
49
|
if commits.size > 0
|
50
50
|
author = committer_and_author(commits.first)
|
51
|
+
messages = commit_messages(commits)
|
51
52
|
commit_pluralization = commits.size > 1 ? 'commits' : 'commit'
|
52
|
-
"[GitHub] Got #{commits.size} new #{commit_pluralization} #{author} on #{payload['repository']['owner']['name']}/#{payload['repository']['name']} on the #{branch} branch"
|
53
|
+
"[GitHub] Got #{commits.size} new #{commit_pluralization} #{author} on #{payload['repository']['owner']['name']}/#{payload['repository']['name']} on the #{branch} branch\n" + messages.join("\n")
|
53
54
|
elsif payload['created']
|
54
55
|
"[GitHub] #{payload['pusher']['name']} created: #{payload['ref']}: #{payload['base_ref']}"
|
55
56
|
elsif payload['deleted']
|
@@ -73,6 +74,12 @@ module Lita
|
|
73
74
|
end
|
74
75
|
end
|
75
76
|
|
77
|
+
def commit_messages(commits)
|
78
|
+
commits.collect do |commit|
|
79
|
+
" * #{commit['message']}"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
76
83
|
def rooms_for_repo(repo)
|
77
84
|
rooms = Lita.config.handlers.github_commits.repos[repo]
|
78
85
|
|
data/lita-github-commits.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "lita-github-commits"
|
3
|
-
spec.version = "0.
|
3
|
+
spec.version = "0.2.0"
|
4
4
|
spec.authors = ["Mitch Dempsey"]
|
5
5
|
spec.email = ["mrdempsey@gmail.com"]
|
6
6
|
spec.description = %q{A Lita handler that will display GitHub commit messages in the channel}
|
@@ -29,8 +29,13 @@ describe Lita::Handlers::GithubCommits, lita_handler: true do
|
|
29
29
|
it "sends a notification message to the applicable rooms" do
|
30
30
|
expect(robot).to receive(:send_message) do |target, message|
|
31
31
|
expect(target.room).to eq("#baz")
|
32
|
-
expect(message).to eq(
|
33
|
-
|
32
|
+
expect(message).to eq(<<-RESPONSE.chomp
|
33
|
+
[GitHub] Got 3 new commits from Garen Torikian on octokitty/testing on the master branch
|
34
|
+
* Test
|
35
|
+
* This is me testing the windows client.
|
36
|
+
* Rename madame-bovary.txt to words/madame-bovary.txt
|
37
|
+
RESPONSE
|
38
|
+
)
|
34
39
|
end
|
35
40
|
subject.receive(request, response)
|
36
41
|
end
|
@@ -46,8 +51,11 @@ describe Lita::Handlers::GithubCommits, lita_handler: true do
|
|
46
51
|
it "sends a singular commit notification message to the applicable rooms" do
|
47
52
|
expect(robot).to receive(:send_message) do |target, message|
|
48
53
|
expect(target.room).to eq("#baz")
|
49
|
-
expect(message).to eq(
|
50
|
-
|
54
|
+
expect(message).to eq(<<-RESPONSE.chomp
|
55
|
+
[GitHub] Got 1 new commit from Garen Torikian on octokitty/testing on the master branch
|
56
|
+
* Test
|
57
|
+
RESPONSE
|
58
|
+
)
|
51
59
|
end
|
52
60
|
subject.receive(request, response)
|
53
61
|
end
|
@@ -61,9 +69,13 @@ describe Lita::Handlers::GithubCommits, lita_handler: true do
|
|
61
69
|
|
62
70
|
it "sends a notification message to the applicable rooms" do
|
63
71
|
expect(robot).to receive(:send_message) do |target, message|
|
64
|
-
expect(message).to eq(
|
65
|
-
|
66
|
-
|
72
|
+
expect(message).to eq(<<-RESPONSE.chomp
|
73
|
+
[GitHub] Got 3 new commits authored by Garen Torikian and committed by Repository Owner on octokitty/testing on the master branch
|
74
|
+
* Test
|
75
|
+
* This is me testing the windows client.
|
76
|
+
* Rename madame-bovary.txt to words/madame-bovary.txt
|
77
|
+
RESPONSE
|
78
|
+
)
|
67
79
|
end
|
68
80
|
subject.receive(request, response)
|
69
81
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-github-commits
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mitch Dempsey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|