gh-events 0.6.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +27 -7
- data/exe/gh-events +11 -0
- data/lib/gh/events.rb +1 -0
- data/lib/gh/events/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 816a9b68c1d37a66b90de0a48614bd57b94715faa53a5edd8245a2fe5e5a2d5b
|
4
|
+
data.tar.gz: 752dc0d3e42566b280b75fc39cacf4c456b4c16e7132366516fe5dd77166b138
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ee613e1900e42bfe45554e8d4cf36800bcb6fb14524d24faf89b2d8a20213603960f5f1c7c0ad47149bf51bd3bd48f5b0da5473e9dbb75e26a88ad31efc95d3
|
7
|
+
data.tar.gz: f273b92f4fe2124555e42c5c60391e75a6c7d941825047ea6ea1613b2324036f44c536763f7c9da36a93c7d3f2cea83687f4cd0ba09f16020b24801a8d41791c
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,32 @@
|
|
1
|
-
# Github
|
1
|
+
# Github Events
|
2
2
|
|
3
|
-
|
3
|
+
Via Webhooks Github can send a plethora of events, which can be used to facilitate all kinds of automation.
|
4
4
|
|
5
|
-
|
5
|
+
These events are _untyped_, meaning they clearly lack a property `type` to identify the type of event received. (The rationale here might be that one would have differen webhook endpoints for each type of events. But maintaining lots of endpoints is cumbersome. When all the events end up in one endpoint, this library helps by adding a property `type` to the event.)
|
6
|
+
|
7
|
+
Additionally this library provides means of translating the plain event into a human readable textutal representation. This functionality is wrapped in a command line utility, for your convenience.
|
8
|
+
|
9
|
+
## Example Usage
|
10
|
+
|
11
|
+
You can use the command `gh-events` to list the types of events stortef in JSON files.
|
12
|
+
|
13
|
+
```
|
14
|
+
% gh-events spec/fixtures/*.json
|
15
|
+
events/001.json: commit_comment
|
16
|
+
events/002.json: create
|
17
|
+
events/003.json: delete
|
18
|
+
events/004.json: deployment
|
19
|
+
events/005.json: deployment_status
|
20
|
+
events/006.json: fork
|
21
|
+
...
|
22
|
+
```
|
23
|
+
|
24
|
+
Let's say you have a github _commit_comment_ event stored in a file `event.json`
|
25
|
+
|
26
|
+
```
|
27
|
+
% cat event.json | gh-event2text
|
28
|
+
...
|
29
|
+
```
|
6
30
|
|
7
31
|
## Installation
|
8
32
|
|
@@ -20,10 +44,6 @@ Or install it yourself as:
|
|
20
44
|
|
21
45
|
$ gem install gh-events
|
22
46
|
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
47
|
## References
|
28
48
|
|
29
49
|
- https://developer.github.com/v3/activity/events/types/
|
data/exe/gh-events
ADDED
data/lib/gh/events.rb
CHANGED
@@ -14,6 +14,7 @@ module GH
|
|
14
14
|
HEURISTICS = YAML.load_file(PATH)
|
15
15
|
|
16
16
|
def typeof(payload)
|
17
|
+
payload = JSON.parse(payload) if payload.is_a?(String)
|
17
18
|
payload = payload.marshal_dump if payload.is_a?(OpenStruct)
|
18
19
|
keys = payload.keys.map(&:to_s)
|
19
20
|
HEURISTICS.each do |type, characteristics|
|
data/lib/gh/events/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gh-events
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phil Hofmann
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -57,6 +57,7 @@ email:
|
|
57
57
|
- phil@200ok.ch
|
58
58
|
executables:
|
59
59
|
- gh-event2slack
|
60
|
+
- gh-events
|
60
61
|
extensions: []
|
61
62
|
extra_rdoc_files: []
|
62
63
|
files:
|
@@ -70,6 +71,7 @@ files:
|
|
70
71
|
- bin/console
|
71
72
|
- bin/setup
|
72
73
|
- exe/gh-event2slack
|
74
|
+
- exe/gh-events
|
73
75
|
- gh-events.gemspec
|
74
76
|
- lib/gh-events.rb
|
75
77
|
- lib/gh/events.rb
|