gh-events 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a2f1f15ff3e50f457d1c86050a21ef042af76ee2c59820a68067987f4cc5b1f
4
- data.tar.gz: 49a81a46d9686ebbaac5ef6c52479daed0958f8f084d54651e72d944b6857a67
3
+ metadata.gz: b774f605d292c79af1d4b7b38622df8360cd5ca934b62ee6bbdae1775f49db35
4
+ data.tar.gz: c7f193cce6c5ef1f92ca967754b7f324bcf3f545356abb986a13ef27800528f5
5
5
  SHA512:
6
- metadata.gz: 9d555434b035b93b350cb306a88b0371dec3906f32b30f16d1bfc41dc610e6ef93d967abc5a8ace2d0097f3ca9543af6786d4223203d960141aa286a6135b7c6
7
- data.tar.gz: 1b41ea18fb947778b868cefe913667ee013f9361072427995b41d2d23ab9a6b8ad6725249b3a08fc4355ec756325c2b2d03c139824d4ba8aa7db92d6d657b169
6
+ metadata.gz: 37aaeaea6f87d2d3c4140d8ac77bd520c7f4189eced408c16386da9ddfef8dd6da22b0b9e9b088e8870ddfdecbe6cf5c8a5b19930fbd675f4826548e1d2824d2
7
+ data.tar.gz: 25ad209a0beebdfd89739b786fe04f80cd1bc84e5ac0a8118145f30ccff45cc3951e6a0956b058ca246285eef58663b6c2a16b1d2582abc59620d4adca8424d8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gh-events (0.3.1)
4
+ gh-events (0.3.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -11,9 +11,10 @@ module GH::Events::Slack
11
11
  event = JSON.parse(payload, object_class: OpenStruct)
12
12
  type = GH::Events.typeof(event).to_s
13
13
 
14
- # transform
15
- event.ref.gsub!(/^refs\/heads\/(.+)$/, 'branch `\1`')
16
- event.ref.gsub!(/^refs\/tags\/(.+)$/, 'tag `\1`')
14
+ # unify
15
+ event.ref_type = 'branch' if event.ref.match(/^refs\/heads\//)
16
+ event.ref_type = 'tag' if event.ref.match(/^refs\/tags\//)
17
+ event.ref = event.ref.split('/').last
17
18
 
18
19
  template = (templates[type] || "No template for type: #{type}.")
19
20
  render(template, event)
@@ -1,5 +1,5 @@
1
1
  module GH
2
2
  module Events
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
4
4
  end
5
5
  end
data/res/slack.yml CHANGED
@@ -1,21 +1,33 @@
1
+ # refs are unified. So all events have `ref` and `ref_type`.
2
+
1
3
  unknown: >-
2
4
  An unknown event occurred.
5
+
3
6
  push: >-
4
- _<%= pusher.name %>_ pushed <%= ref %>
5
- to `<%= repository.full_name %>`
7
+ _<%= pusher.name %>_ <%= forced ? 'force-' : '' %>pushed
8
+ <%= size %> commits
9
+ to <%= ref_type %> `<%= ref %>`
10
+ on <<%= repository.html_url %>|<%= repository.full_name %>>
6
11
  :star: <%= repository.stargazers_count %>
7
12
  :eye: <%= repository.watchers_count %>
8
13
  (<<%= compare %>|compare>)
14
+
9
15
  commit_comment: >-
10
16
  _<%= comment.user.login %>_ commented the
11
17
  <%= comment.url %>|commit `<%= comment.commit_id %>`> on
12
18
  <<%= repository.html_url %>|<%= repository.full_name %>>: _<%= comment.body %>_
13
- watch: An event of type `watch` occurred.
14
- create: An event of type `create` occurred.
19
+
20
+ create: >-
21
+ _<%= sender.login %>_ created
22
+ the <%= ref_type %> `<%= ref %>`
23
+ on <<%= repository.html_url %>|<%= repository.full_name %>>
24
+
15
25
  delete: >-
16
- _<%= sender.login %>_ has deleted
26
+ _<%= sender.login %>_ deleted
17
27
  the <%= ref_type %> `<%= ref %>`
18
28
  on <<%= repository.html_url %>|<%= repository.full_name %>>
29
+
30
+ watch: An event of type `watch` occurred.
19
31
  deployment: An event of type `deployment` occurred.
20
32
  deployment_status: An event of type `deployment_status` occurred.
21
33
  fork: An event of type `fork` occurred.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gh-events
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phil Hofmann