lita-github-commits 0.2.0 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 62d3af13c9629ccc9fef8b40294388070a79914b
4
- data.tar.gz: be0c36a16d5170e34848a1bdadf798c25c1ce7f0
3
+ metadata.gz: 02a58dc021b14028fbff6758717f24cf1d732215
4
+ data.tar.gz: 226039126fb238d5e26f4f3dd437a798e848724e
5
5
  SHA512:
6
- metadata.gz: 1a529b5a42050646669d629c6e40eb21e9e42af20a7e5366174dac88f8b66e01b1f4bea465bd3057a1936f30d23b568641733231bbaf294b819ab5a865009d9a
7
- data.tar.gz: 8925a46036b47e8eef19264384b29939129cc43597d819239f5572a00e651497a77d86a92c96b5b8218d656702b08be39d65dc5697e74b06e283d71df5a20ac7
6
+ metadata.gz: 58a2748f1011214f1d13a9f400d6c768021c35d0c3856f2173c2e037bc3cecfa797b9c8306fbc4972090f110dbbdf756a1be9a903baa5b0cb9c48fa975106df8
7
+ data.tar.gz: 567cbfebcebcd971e236743b0833b5bb11d1dec9c6cba33f94649da3335b9c81d0cbdd1be406d5806b049be265037bbe759c8d505a31699fb299d973e617cff0
data/.gitignore CHANGED
@@ -15,4 +15,6 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
- .ruby-version
18
+ .ruby-version
19
+ *.sublime-*
20
+ lita_config.rb
data/.travis.yml CHANGED
@@ -2,8 +2,9 @@ language: ruby
2
2
  rvm:
3
3
  - 2.0.0
4
4
  - 2.1.2
5
- script: bundle exec rake
6
- before_install:
7
- - gem update --system
5
+ bundler_args: --binstubs
6
+ script: bundle exec rake --trace
7
+ #before_install:
8
+ # - gem update --system
8
9
  services:
9
10
  - redis-server
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![Code Climate](https://codeclimate.com/github/webdestroya/lita-github-commits.png)](https://codeclimate.com/github/webdestroya/lita-github-commits)
5
5
  [![Coverage Status](https://coveralls.io/repos/webdestroya/lita-github-commits/badge.png)](https://coveralls.io/r/webdestroya/lita-github-commits)
6
6
 
7
- **lita-github-commits** is a handler for [Lita](https://github.com/jimmycuadra/lita) that listens for github commits and posts them in the channel.
7
+ **lita-github-commits** is a handler for [Lita](https://github.com/jimmycuadra/lita) that listens for github commits and posts them in the channel. You can also ask lita for information about a commit it remembers.
8
8
 
9
9
  ## Installation
10
10
 
@@ -18,16 +18,23 @@ gem "lita-github-commits"
18
18
 
19
19
  ### Required attributes
20
20
 
21
- * `repos` (Hash) - A map of repositories to allow notifications for and the chat rooms to post them in. The keys should be strings in the format "github_username/repository_name" and the values should be either a string room name or an array of string room names. Default: `{}`.
21
+ * `repos` (Hash) - A map of repositories to allow notifications for and the chat rooms to post them in. The keys should be strings in the format "github_username/repository_name" and the values should be either a string room name or an array of string room names. If you do not wish to have notifications for a particular repository, set it's room array to "". Default: `{}`.
22
22
 
23
- ### Example
23
+ * remember_commits_for (Integer) - Number of days lita will remember information about commits it as heard about. Setting it to 0 effectively disables the "commit/SHA" command handling. Default: 0 (no memory)
24
+
25
+ * github_webhook_secret (String) - Optional secret that github uses to sign the webhook requests with. Currently the configuration's presence only requires that the requests from GitHub be signed. Default: nil (no signature required)
26
+
27
+ ### Example Config
24
28
 
25
29
  ``` ruby
26
30
  Lita.configure do |config|
27
31
  config.handlers.github_commits.repos = {
28
32
  "username/repo1" => "#someroom",
29
- "username/repo2" => ["#someroom", "#someotherroom"]
33
+ "username/repo2" => ["#someroom", "#someotherroom"],
34
+ "username/muted_repo3" => ""
30
35
  }
36
+ config.handlers.github_commits.remember_commits_for = 7
37
+ config.handlers.github_commits.github_webhook_secret = "secr3tC0de"
31
38
  end
32
39
  ```
33
40
 
@@ -37,14 +44,22 @@ The output from Lita would look something like:
37
44
 
38
45
  ```
39
46
  [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
47
+ * 32e3221: Test
48
+ * adc2112: This is me testing the windows client.
49
+ * 441ab6c: Rename madame-bovary.txt to words/madame-bovary.txt
43
50
  ```
44
51
 
45
52
  ## Usage
46
53
 
47
- You will need to add a GitHub Webhook url that points to: `http://address.of.lita/github-commits`
54
+ You will need to add a [GitHub Webhook](https://developer.github.com/webhooks/) url that points to: `http://address.of.lita:8080/github-commits`
55
+
56
+ In any room that Lita is listening, it will look for statements of the following form and provide the details of the commit if it remembers them. If it doesn't remember the commit (or has heard about it), it will remain silent unless its a direct command.
57
+ ```
58
+ ... commit/<SHA1>... - Search for a commit and return the details if found
59
+
60
+ ```
61
+
62
+ Note that it only searches the commits that it has heard about and remembers so that the bot needs no more access to the repo than a webhook.
48
63
 
49
64
  ## License
50
65
 
@@ -1,19 +1,62 @@
1
1
  require "lita"
2
+ require 'time'
2
3
 
3
4
  module Lita
4
5
  module Handlers
5
6
  class GithubCommits < Handler
7
+ template_root File.expand_path("../../../../templates", __FILE__)
6
8
 
9
+
10
+ #todo: change this to lita4 config http://docs.lita.io/releases/4/
11
+ # config :repos, type: Hash, default: {}
12
+ # config :remember_commits_for, type: Integer, default: 1
13
+ # config :github_webhook_secret, type: String, default: nil
14
+
7
15
  def self.default_config(config)
8
16
  config.repos = {}
17
+ config.remember_commits_for = 1
18
+ config.github_webhook_secret = nil
9
19
  end
10
20
 
11
- http.post "/github-commits", :receive
21
+ def self.install_routes()
22
+ http.post "/github-commits", :receive
23
+ end
24
+ install_routes()
25
+
26
+ REDIS_KEY_PREFIX = "GH_COMMTIS:"
27
+ SHA_ABBREV_LENGTH = 7 #note the regex below needs to match this constant
28
+ def self.install_commands
29
+ route(/commit\/([a-f0-9]{7,})\s?/i, :check_for_commit, command: false,
30
+ help: { "...commit/<SHA1>..." => "Displays the details of commit SHA1 if known (requires at least #{SHA_ABBREV_LENGTH} digits of the SHA)."}
31
+ )
32
+ end
33
+ install_commands
34
+
35
+ def check_for_commit(response)
36
+ sha = abbrev_sha(response.match_data[1])
37
+ if sha.nil? || sha.empty?
38
+ #this shouldn't match regex
39
+ response.reply("[GitHub] I need at least #{SHA_ABBREV_LENGTH} characters of the commit SHA") if response.message.command?
40
+ elsif sha.size <= 6 && response.message.command?
41
+ #this shouldn't match regex
42
+ response.reply("[GitHub] Can you be more precise?")
43
+ elsif (commit=redis.get(REDIS_KEY_PREFIX + sha))
44
+ response.reply(render_template("commit_details", commit: parse_payload(commit)))
45
+ elsif response.message.command?
46
+ response.reply("[GitHub] Sorry Boss, I can't find that commit")
47
+ #else
48
+ # response.reply("I got nothing to say about #{sha}.")
49
+ end
50
+ end
12
51
 
13
52
  def receive(request, response)
14
53
  event_type = request.env['HTTP_X_GITHUB_EVENT'] || 'unknown'
15
- if event_type == "push"
16
- payload = parse_payload(request.params['payload']) or return
54
+ Lita.logger.debug("Received GitHub #{event_type} event") rescue ""
55
+ if !valid_signature(request)
56
+ response.status = 404
57
+ elsif event_type == "push"
58
+ payload = parse_payload(request.body) or return
59
+ store_commits(payload)
17
60
  repo = get_repo(payload)
18
61
  notify_rooms(repo, payload)
19
62
  elsif event_type == "ping"
@@ -26,10 +69,24 @@ module Lita
26
69
 
27
70
  private
28
71
 
72
+ def valid_signature(request)
73
+ #not actually validating yet, just checking for presence of signature
74
+ #should look something like
75
+ #payload_body = request.body.read
76
+ #signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), config.github_webhook_secret, payload_body)
77
+ #Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])
78
+ if config.github_webhook_secret.nil? || config.github_webhook_secret.empty? || (request.env['HTTP_X_HUB_SIGNATURE'] && !request.env['HTTP_X_HUB_SIGNATURE'].empty?)
79
+ return true
80
+ else
81
+ Lita.logger.debug("Message sender validation failed") rescue ""
82
+ return false
83
+ end
84
+ end
85
+
29
86
  def parse_payload(payload)
30
87
  MultiJson.load(payload)
31
88
  rescue MultiJson::LoadError => e
32
- Lita.logger.error("Could not parse JSON payload from Github: #{e.message}")
89
+ Lita.logger.warn("Could not parse JSON payload from Github: #{e.message}")
33
90
  return
34
91
  end
35
92
 
@@ -43,6 +100,18 @@ module Lita
43
100
  end
44
101
  end
45
102
 
103
+ def store_commits(payload)
104
+ ttl = remember_commits_for*86400
105
+ return if ttl == 0
106
+ commits = payload['commits']
107
+ branch = branch_from_ref(payload['ref'])
108
+ commits.each do |commit|
109
+ key = REDIS_KEY_PREFIX + commit['id'][0,SHA_ABBREV_LENGTH]
110
+ commit[:branch] = branch
111
+ redis.setex(key,ttl,commit.to_json)
112
+ end
113
+ end
114
+
46
115
  def format_message(payload)
47
116
  commits = payload['commits']
48
117
  branch = branch_from_ref(payload['ref'])
@@ -61,6 +130,10 @@ module Lita
61
130
  return
62
131
  end
63
132
 
133
+ def abbrev_sha(sha)
134
+ sha.nil? ? nil : sha[0,SHA_ABBREV_LENGTH]
135
+ end
136
+
64
137
  def branch_from_ref(ref)
65
138
  ref.split('/').last
66
139
  end
@@ -76,14 +149,14 @@ module Lita
76
149
 
77
150
  def commit_messages(commits)
78
151
  commits.collect do |commit|
79
- " * #{commit['message']}"
152
+ " * #{abbrev_sha(commit['id'])}: #{commit['message']}"
80
153
  end
81
154
  end
82
155
 
83
156
  def rooms_for_repo(repo)
84
157
  rooms = Lita.config.handlers.github_commits.repos[repo]
85
158
 
86
- if rooms
159
+ if rooms && rooms.size > 0
87
160
  Array(rooms)
88
161
  else
89
162
  Lita.logger.warn "Notification from GitHub Commits for unconfigured project: #{repo}"
@@ -91,11 +164,13 @@ module Lita
91
164
  end
92
165
  end
93
166
 
94
-
95
167
  def get_repo(payload)
96
168
  "#{payload['repository']['owner']['name']}/#{payload['repository']['name']}"
97
169
  end
98
-
170
+
171
+ def remember_commits_for
172
+ Lita.config.handlers.github_commits.remember_commits_for
173
+ end
99
174
  end
100
175
 
101
176
  Lita.register_handler(GithubCommits)
@@ -1,8 +1,8 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-github-commits"
3
- spec.version = "0.2.0"
4
- spec.authors = ["Mitch Dempsey"]
5
- spec.email = ["mrdempsey@gmail.com"]
3
+ spec.version = "0.2.5"
4
+ spec.authors = ["Mitch Dempsey", "Steve Jernigan"]
5
+ spec.email = ["mrdempsey@gmail.com","steve.jernigan@gmail.com"]
6
6
  spec.description = %q{A Lita handler that will display GitHub commit messages in the channel}
7
7
  spec.summary = %q{A Lita handler that will display GitHub commit messages in the channel}
8
8
  spec.homepage = "https://github.com/webdestroya/lita-github-commits"
@@ -23,7 +23,7 @@ describe Lita::Handlers::GithubCommits, lita_handler: true do
23
23
  context "request with commits" do
24
24
  before do
25
25
  Lita.config.handlers.github_commits.repos["octokitty/testing"] = "#baz"
26
- allow(params).to receive(:[]).with("payload").and_return(valid_payload)
26
+ allow(request).to receive(:body).and_return(valid_payload)
27
27
  end
28
28
 
29
29
  it "sends a notification message to the applicable rooms" do
@@ -31,12 +31,13 @@ describe Lita::Handlers::GithubCommits, lita_handler: true do
31
31
  expect(target.room).to eq("#baz")
32
32
  expect(message).to eq(<<-RESPONSE.chomp
33
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
34
+ * c441029: Test
35
+ * 36c5f22: This is me testing the windows client.
36
+ * 1481a2d: Rename madame-bovary.txt to words/madame-bovary.txt
37
37
  RESPONSE
38
38
  )
39
39
  end
40
+ expect(subject.redis).to receive(:setex).exactly(3).times
40
41
  subject.receive(request, response)
41
42
  end
42
43
  end
@@ -44,8 +45,8 @@ describe Lita::Handlers::GithubCommits, lita_handler: true do
44
45
  context "request with one commit" do
45
46
  before do
46
47
  Lita.config.handlers.github_commits.repos["octokitty/testing"] = "#baz"
47
- allow(params).to receive(:[]).with("payload").and_return(
48
- valid_payload_one_commit)
48
+ Lita.config.handlers.github_commits.remember_commits_for = 1
49
+ allow(request).to receive(:body).and_return(valid_payload_one_commit)
49
50
  end
50
51
 
51
52
  it "sends a singular commit notification message to the applicable rooms" do
@@ -53,10 +54,58 @@ describe Lita::Handlers::GithubCommits, lita_handler: true do
53
54
  expect(target.room).to eq("#baz")
54
55
  expect(message).to eq(<<-RESPONSE.chomp
55
56
  [GitHub] Got 1 new commit from Garen Torikian on octokitty/testing on the master branch
56
- * Test
57
+ * c441029: Test
57
58
  RESPONSE
58
59
  )
59
60
  end
61
+ expect(subject.redis).to receive(:setex).once
62
+ subject.receive(request, response)
63
+ end
64
+
65
+ it "stores the message to redis with ttl" do
66
+ expect(subject.redis).to receive(:setex).once.with(Lita::Handlers::GithubCommits::REDIS_KEY_PREFIX + "c441029",86400,anything)
67
+ subject.receive(request, response)
68
+ end
69
+
70
+ it { is_expected.to route_command("zzcommit/1234567").to(:check_for_commit) }
71
+ it { is_expected.to route_command("abf commit/1234567").to(:check_for_commit) }
72
+ it { is_expected.to route_command("__commit/abcdef1?").to(:check_for_commit) }
73
+ it { is_expected.to_not route_command("commit/").to(:check_for_commit) }
74
+ it { is_expected.to_not route_command("commit/123456").to(:check_for_commit) }
75
+ it { is_expected.to_not route_command("commit/ornottocommit").to(:check_for_commit) }
76
+
77
+
78
+ it "stores the message to redis and can retrieve it from redis" do
79
+ subject.receive(request, response)
80
+ expect(subject.redis.ttl(Lita::Handlers::GithubCommits::REDIS_KEY_PREFIX + "c441029")).to be
81
+ expect(subject.redis.get(Lita::Handlers::GithubCommits::REDIS_KEY_PREFIX + "c441029")).to eq first_commit.merge({:branch=>"master"}).to_json
82
+ expect(subject.redis.get(Lita::Handlers::GithubCommits::REDIS_KEY_PREFIX + "c44102")).to be nil
83
+ end
84
+ end
85
+
86
+ context "request without memory" do
87
+ before do
88
+ Lita.config.handlers.github_commits.repos["octokitty/testing"] = "#baz"
89
+ Lita.config.handlers.github_commits.remember_commits_for = 0
90
+ allow(request).to receive(:body).and_return(valid_payload_one_commit)
91
+ end
92
+
93
+ it "stores does not store the message to redis" do
94
+ expect(subject.redis).to receive(:setex).never
95
+ subject.receive(request, response)
96
+ end
97
+ end
98
+
99
+ context "request with signature" do
100
+ before do
101
+ Lita.config.handlers.github_commits.repos["octokitty/testing"] = "#baz"
102
+ Lita.config.handlers.github_commits.remember_commits_for = 1
103
+ Lita.config.handlers.github_commits.github_webhook_secret = "something"
104
+ allow(request).to receive(:body).and_return(valid_payload_one_commit)
105
+ end
106
+
107
+ it "stores does not store the message to redis" do
108
+ expect(subject.redis).to receive(:setex).never
60
109
  subject.receive(request, response)
61
110
  end
62
111
  end
@@ -64,16 +113,16 @@ describe Lita::Handlers::GithubCommits, lita_handler: true do
64
113
  context "request with commits" do
65
114
  before do
66
115
  Lita.config.handlers.github_commits.repos["octokitty/testing"] = "#baz"
67
- allow(params).to receive(:[]).with("payload").and_return(valid_payload_diff_committer)
116
+ allow(request).to receive(:body).and_return(valid_payload_diff_committer)
68
117
  end
69
118
 
70
119
  it "sends a notification message to the applicable rooms" do
71
120
  expect(robot).to receive(:send_message) do |target, message|
72
121
  expect(message).to eq(<<-RESPONSE.chomp
73
122
  [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
123
+ * c441029: Test
124
+ * 36c5f22: This is me testing the windows client.
125
+ * 1481a2d: Rename madame-bovary.txt to words/madame-bovary.txt
77
126
  RESPONSE
78
127
  )
79
128
  end
@@ -81,11 +130,42 @@ describe Lita::Handlers::GithubCommits, lita_handler: true do
81
130
  end
82
131
  end
83
132
 
133
+ context "request with commits on a repo with no room" do
134
+ before do
135
+ Lita.config.handlers.github_commits.repos["octokitty/testing"] = ""
136
+ allow(request).to receive(:body).and_return(valid_payload_diff_committer)
137
+ end
138
+
139
+ it "it should not send messages on webhook requests" do
140
+ expect(robot).not_to receive(:send_message)
141
+ subject.receive(request, response)
142
+ end
143
+
144
+ it "it should respond to a previously unseen commit if its a command" do
145
+ send_command("stuff commit/36c5f2243ed24de5 stuff")
146
+ expect(replies).to include("[GitHub] Sorry Boss, I can't find that commit")
147
+ end
148
+
149
+ it "it should not respond to a previously unseen commit if its not a command" do
150
+ send_message("github commit/36c5f2243ed24de5")
151
+ expect(replies).to eq []
152
+ end
153
+
154
+ it "it should respond to a previously seen commit" do
155
+ subject.receive(request, response)
156
+ send_message("do you know about commit/36c5f2243ed24de5?")
157
+ expect(replies).to include(a_string_starting_with("[GitHub] Commit 36c5f22: This is me testing the windows client."))
158
+ #expect(replies).to include(a_string_starting_with("[GitHub] Commit 36c5f22 committed by Repository Owner on branch master at"))
159
+ #expect(replies).to include(a_string_ending_with("Files Modified\n README.md\n\nMore info https://github.com/octokitty/testing/commit/36c5f2243ed24de58284a96f2a643bed8c028658"))
160
+ end
161
+ end
162
+
84
163
 
85
164
  context "create payload" do
86
165
  before do
87
166
  Lita.config.handlers.github_commits.repos["octokitty/testing"] = "#baz"
88
167
  allow(params).to receive(:[]).with("payload").and_return(created_payload)
168
+ allow(request).to receive(:body).and_return(created_payload)
89
169
  end
90
170
 
91
171
  it "sends a notification message to the applicable rooms" do
@@ -101,7 +181,7 @@ describe Lita::Handlers::GithubCommits, lita_handler: true do
101
181
  context "delete payload" do
102
182
  before do
103
183
  Lita.config.handlers.github_commits.repos["octokitty/testing"] = "#baz"
104
- allow(params).to receive(:[]).with("payload").and_return(deleted_payload)
184
+ allow(request).to receive(:body).and_return(deleted_payload)
105
185
  end
106
186
 
107
187
  it "sends a notification message to the applicable rooms" do
@@ -117,12 +197,12 @@ describe Lita::Handlers::GithubCommits, lita_handler: true do
117
197
  context "bad payload" do
118
198
  before do
119
199
  Lita.config.handlers.github_commits.repos["octokitty/testing"] = "#baz"
120
- allow(params).to receive(:[]).with("payload").and_return("yaryary")
200
+ allow(request).to receive(:body).and_return("yaryary")
121
201
  end
122
202
 
123
203
  it "sends a notification message to the applicable rooms" do
124
- expect(Lita.logger).to receive(:error) do |error|
125
- expect(error).to include("Could not parse JSON payload from Github")
204
+ expect(Lita.logger).to receive(:warn) do |warn|
205
+ expect(warn).to include("Could not parse JSON payload from Github")
126
206
  end
127
207
  subject.receive(request, response)
128
208
  end
@@ -132,7 +212,7 @@ describe Lita::Handlers::GithubCommits, lita_handler: true do
132
212
  context "ping event" do
133
213
  before do
134
214
  Lita.config.handlers.github_commits.repos["octokitty/testing"] = "#baz"
135
- allow(params).to receive(:[]).with("payload").and_return(ping_payload)
215
+ allow(request).to receive(:body).and_return(ping_payload)
136
216
  allow(request).to receive(:env).and_return({"HTTP_X_GITHUB_EVENT" => "ping"})
137
217
  end
138
218
 
@@ -146,7 +226,7 @@ describe Lita::Handlers::GithubCommits, lita_handler: true do
146
226
  context "unknown event" do
147
227
  before do
148
228
  Lita.config.handlers.github_commits.repos["octokitty/testing"] = "#baz"
149
- allow(params).to receive(:[]).with("payload").and_return(ping_payload)
229
+ allow(request).to receive(:body).and_return(ping_payload)
150
230
  allow(request).to receive(:env).and_return({"HTTP_X_GITHUB_EVENT" => "fakefake"})
151
231
  end
152
232
 
@@ -160,7 +240,7 @@ describe Lita::Handlers::GithubCommits, lita_handler: true do
160
240
 
161
241
  context "improper config" do
162
242
  before do
163
- allow(params).to receive(:[]).with("payload").and_return(deleted_payload)
243
+ allow(request).to receive(:body).and_return(deleted_payload)
164
244
  end
165
245
 
166
246
  it "sends a notification message to the applicable rooms" do
@@ -6,6 +6,11 @@ module Payload
6
6
  payload.to_json
7
7
  end
8
8
 
9
+ def first_commit
10
+ payload = MultiJson.load(valid_payload, symbolize_keys: true)
11
+ payload[:commits].first
12
+ end
13
+
9
14
  def valid_payload_diff_committer
10
15
  payload = MultiJson.load(valid_payload, symbolize_keys: true)
11
16
  payload[:commits] = payload[:commits].map do |commit|
data/spec/spec_helper.rb CHANGED
@@ -9,4 +9,4 @@ SimpleCov.start { add_filter "/spec/" }
9
9
  require "lita-github-commits"
10
10
  require "lita/rspec"
11
11
 
12
- Lita.version_3_compatibility_mode = true
12
+ Lita.version_3_compatibility_mode = true
@@ -0,0 +1 @@
1
+ [GitHub] Commit <%= @commit['id'][0,Lita::Handlers::GithubCommits::SHA_ABBREV_LENGTH]%>: <%=@commit['message']%>
@@ -0,0 +1,16 @@
1
+ [GitHub] Commit <%= @commit['id'][0,Lita::Handlers::GithubCommits::SHA_ABBREV_LENGTH]%> committed by <%=@commit['committer'] ? @commit['committer']['name'] : "<unknown>"%> on branch <%=@commit['branch']%> at <%=Time.parse(@commit['timestamp']).getlocal.to_s%> with message
2
+ '<%=@commit['message']%>'
3
+ <%if !@commit['added'].empty? %>
4
+ Files Added
5
+ <%=@commit['added'].join("\n ")%>
6
+ <%end %>
7
+ <%if !@commit['removed'].empty? %>
8
+ Files Removed
9
+ <%=@commit['removed'].join("\n ")%>
10
+ <%end %>
11
+ <%if !@commit['modified'].empty? %>
12
+ Files Modified
13
+ <%=@commit['modified'].join("\n ")%>
14
+ <%end %>
15
+
16
+ More info <%=@commit['url']%>
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-github-commits
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mitch Dempsey
8
+ - Steve Jernigan
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-05-24 00:00:00.000000000 Z
12
+ date: 2015-11-24 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: lita
@@ -103,6 +104,7 @@ dependencies:
103
104
  description: A Lita handler that will display GitHub commit messages in the channel
104
105
  email:
105
106
  - mrdempsey@gmail.com
107
+ - steve.jernigan@gmail.com
106
108
  executables: []
107
109
  extensions: []
108
110
  extra_rdoc_files: []
@@ -119,6 +121,8 @@ files:
119
121
  - spec/lita/handlers/github_commits_spec.rb
120
122
  - spec/lita/handlers/payload.rb
121
123
  - spec/spec_helper.rb
124
+ - templates/commit_details.erb
125
+ - templates/commit_details.hipchat.erb
122
126
  homepage: https://github.com/webdestroya/lita-github-commits
123
127
  licenses:
124
128
  - MIT