File tree Expand file tree Collapse file tree 4 files changed +54
-2
lines changed Expand file tree Collapse file tree 4 files changed +54
-2
lines changed Original file line number Diff line number Diff line change @@ -28,3 +28,4 @@ Thanks to the following people for making this possible
28
28
- Grant Limberg
29
29
- Jess Martin
30
30
- Édouard Brière
31
+ - Teng Siong Ong
Original file line number Diff line number Diff line change 2
2
3
3
{
4
4
"data" => {
5
- "username" => "foo",
6
- "password" => "bar"
5
+ "token" => "token",
6
+ "url" => "https://youraccount.talkerapp.com/rooms/ROOM_ID",
7
+ "digest" => 1
7
8
},
8
9
9
10
"payload" => {
Original file line number Diff line number Diff line change
1
+ Talker
2
+ ========
3
+
4
+ Install Notes
5
+ -------------
6
+
7
+ 1. url should be your room url, for example https://youraccount.talkerapp.com/rooms/ROOM_ID
8
+ 2. token should be on your settings page
9
+ 3. if digest is checked, all commits will be compressed in one message
10
+
11
+ Note: replace https with http on the url if you're on the Free plan as it doesn't include enhanced security (SSL).
12
+
13
+ Developer Notes
14
+ ---------------
15
+
16
+ data
17
+ - url
18
+ - token
19
+ - digest (boolean)
20
+
21
+ payload
22
+ - refer to docs/github_payload
Original file line number Diff line number Diff line change
1
+ service :talker do |data , payload |
2
+ repository = payload [ 'repository' ] [ 'name' ]
3
+ branch = payload [ 'ref' ] . split ( '/' ) . last
4
+ commits = payload [ 'commits' ]
5
+ token = data [ 'token' ]
6
+ url = URI . parse ( "#{ data [ 'url' ] } /messages.json" )
7
+
8
+ if data [ 'digest' ] == 1
9
+ commit = commits . last
10
+ message = "[#{ repository } /#{ branch } ] #{ commit [ 'message' ] } (+#{ commits . size - 1 } more commits...) - #{ commit [ 'author' ] [ 'name' ] } (#{ commit [ 'url' ] } ))"
11
+
12
+ req = Net ::HTTP ::Post . new ( url . path )
13
+ req [ "X-Talker-Token" ] = "#{ token } "
14
+ req . set_form_data ( 'message' => message )
15
+
16
+ Net ::HTTP . new ( url . host , url . port ) . start { |http | http . request ( req ) }
17
+ else
18
+ commits . each do |commit |
19
+ message = "[#{ repository } /#{ branch } ] #{ commit [ 'message' ] } - #{ commit [ 'author' ] [ 'name' ] } (#{ commit [ 'url' ] } )"
20
+
21
+ req = Net ::HTTP ::Post . new ( url . path )
22
+ req [ "X-Talker-Token" ] = "#{ token } "
23
+ req . set_form_data ( 'message' => message )
24
+
25
+ Net ::HTTP . new ( url . host , url . port ) . start { |http | http . request ( req ) }
26
+ end
27
+ end
28
+ end
You can’t perform that action at this time.
0 commit comments