gh-events 0.8.0 → 0.8.1

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: e1cff1386c5673a98772cf99e50149162e0f010f65c8e59a6bb40779fbc10233
4
- data.tar.gz: fede3370b5bd12f80c75a6cc4b239e324df11bbc0d970419ef4a44eab3f4a7bc
3
+ metadata.gz: d72e0e3c68c3ae74cb92b5cdb3f88a62bdc580ae17c218dc7a95f826384919fa
4
+ data.tar.gz: 7243fd7c7e131e0b92aca3007437cabe2cfa748ff97f64fca48d7571526a4fcf
5
5
  SHA512:
6
- metadata.gz: 70e2bd1df73c6641d6645d40804e7526de092512fd068d02924f7d8a5966d1cb2a120a6d3e38894f77ee4cb390992dfc63b3db81c6f10c401cc620fed61b9944
7
- data.tar.gz: 8dd77aaaed11e14dccb267a86f9ce211998cd91bb45de3c8db8f53dec76d8fbc837e45d9a4a0551489ac79a14f6e50f9f9f64ebc7e9984c789b037ceed9fd489
6
+ metadata.gz: 6d9ef168472148d3c411a7b2f94b03f671784afc5dacfde8cf92bb0384a0a619cd12dd5367e7552510ce2fa710300d626da23cbe6337a08e7fe2f5acd5ab17b2
7
+ data.tar.gz: a1ab78c4b59b1cb67c78a9436a212f91043d98dc330f75742cc66c163cc844c9d942361e1217bb575c33779d674cb66a6b62326216a02acbafca432b2cbaebf4
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gh-events (0.8.0)
4
+ gh-events (0.8.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -35,4 +35,4 @@ DEPENDENCIES
35
35
  rspec_junit_formatter (~> 0.4)
36
36
 
37
37
  BUNDLED WITH
38
- 2.0.2
38
+ 2.1.4
@@ -0,0 +1,7 @@
1
+ Copyright 2020 Phil Hofmann
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,14 +1,50 @@
1
1
  # Github Events
2
2
 
3
- Via Webhooks Github can send a plethora of events, which can be used to facilitate all kinds of automation.
3
+ Via Webhooks Github can send a plethora of events, which can be used
4
+ to facilitate all kinds of automation.
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
+ These events are _untyped_, meaning they clearly lack a property
7
+ `type` to identify the type of event received. The rationale here
8
+ might be that one would have different webhook endpoints for each type
9
+ of events. But maintaining lots of endpoints is cumbersome. When all
10
+ the events end up in one endpoint, this library helps by adding a
11
+ property `type` to the event.
6
12
 
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.
13
+ Additionally this library provides means of translating the plain
14
+ event (a deeply nested data structure serialized to JSON) into a human
15
+ readable textutal representation. Some functionality is wrapped in a
16
+ command line utilites, for your convenience.
8
17
 
9
- ## Example Usage
10
18
 
11
- You can use the command `gh-events` to list the types of events stortef in JSON files.
19
+ ## Installation
20
+
21
+ ### To use the command line utilities
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install gh-events
26
+
27
+ ### To use as a library in your own project
28
+
29
+ Add this line to your application's Gemfile:
30
+
31
+ ```ruby
32
+ gem 'gh-events'
33
+ ```
34
+
35
+ And then execute:
36
+
37
+ $ bundle
38
+
39
+
40
+ ## Usage
41
+
42
+ ### CLI Util
43
+
44
+ #### Typing
45
+
46
+ You can use the command `gh-events` to list the types of events
47
+ stored in JSON files.
12
48
 
13
49
  ```
14
50
  % gh-events spec/fixtures/*.json
@@ -21,28 +57,37 @@ events/006.json: fork
21
57
  ...
22
58
  ```
23
59
 
24
- Let's say you have a github _commit_comment_ event stored in a file `event.json`
60
+ #### Translating
61
+
62
+ The `gh-event2text` util will receive one event via stdin. Let's say
63
+ you have a github _commit_comment_ event stored in a file named
64
+ `event.json`. With you can to this:
25
65
 
26
66
  ```
27
67
  % cat event.json | gh-event2text
28
- ...
68
+ "[Codertocat/Hello-World] Codertocat commented on commit `6113728f27ae82c7b1a177c8d03f9e96e0adf246`>: \"This is a really good change! :+1:\""
29
69
  ```
30
70
 
31
- ## Installation
71
+ For translating the event into its textual representation
72
+ `gh-event2text` uses a dictionary. The dictionary can be given as an
73
+ argument to `gh-event2text`, which can either be a name of a packaged
74
+ dict (currently `plain` (default) or `slack`) or a path to a
75
+ dictionary file.
32
76
 
33
- Add this line to your application's Gemfile:
77
+ Dictionary files are YAML files with ERB for templating. The playload
78
+ is fed to the templates as nested Ruby OpenStructs. For an elaborate
79
+ example have a look at the dictionary for Slack.
34
80
 
35
- ```ruby
36
- gem 'gh-events'
37
- ```
81
+ If you write your own dictionary for other target systems, please
82
+ consider to contribute.
38
83
 
39
- And then execute:
84
+ TODO: elaborate on how the lookup of types works
40
85
 
41
- $ bundle
42
86
 
43
- Or install it yourself as:
87
+ ### Library
88
+
89
+ TODO: add an example
44
90
 
45
- $ gem install gh-events
46
91
 
47
92
  ## References
48
93
 
@@ -47,7 +47,7 @@ module GH::Events::Text
47
47
  # if there is no template use a default
48
48
  template ||= templates['no_template']
49
49
 
50
- render(template, event)
50
+ render(template, event).gsub("\n", "\\n")
51
51
  end
52
52
 
53
53
  def templates_file(dict)
@@ -1,5 +1,5 @@
1
1
  module GH
2
2
  module Events
3
- VERSION = "0.8.0"
3
+ VERSION = "0.8.1"
4
4
  end
5
5
  end
@@ -74,6 +74,15 @@ issues:
74
74
  issue <<%= issue.html_url %>|<%= issue.title %>>
75
75
  on <<%= repository.html_url %>|<%= repository.full_name %>>
76
76
 
77
+ issues.assigned:
78
+ text: >-
79
+ :inbox_tray:
80
+ <<%= sender.html_url %>|<%= sender.login %>>
81
+ <%= action %>
82
+ issue <<%= issue.html_url %>|<%= issue.title %>>
83
+ on <<%= repository.html_url %>|<%= repository.full_name %>>
84
+ to [TODO whom]
85
+
77
86
  issues.opened:
78
87
  text: >-
79
88
  :inbox_tray:
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.8.0
4
+ version: 0.8.1
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-12-02 00:00:00.000000000 Z
11
+ date: 2020-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -81,6 +81,7 @@ files:
81
81
  - ".ruby-version"
82
82
  - Gemfile
83
83
  - Gemfile.lock
84
+ - LICENSE.md
84
85
  - README.md
85
86
  - Rakefile
86
87
  - bin/console