capistrano-rocket-chat 0.1.7 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -0
- data/lib/capistrano/rocket_chat/version.rb +1 -1
- data/lib/capistrano/tasks/rocket_chat.cap +14 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 524a5977c04171098078b6a63bff8787562ce124
|
4
|
+
data.tar.gz: 44ee1bab9a835d904d7bc1daeb022ec905a207bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5648b882ad1ad66146f40acb9b16937a154abd87aee2f8ca628b07649065fbcc2d38cbbb6806245c5e53daa2df8a30322a1cdd972b0e6dae3ebd1be1374d267a
|
7
|
+
data.tar.gz: 7e232c7a6c8e766aa37812b142dd76073764311c6e266a3b95ce4c932bfdb60b08be929b2ab12194a14e3bb50ddfac3182b679bc1b05798cae1a4f1eca100b7d
|
data/README.md
CHANGED
@@ -29,6 +29,15 @@ Add the rocket.chat webhook url including the webhook token to your *deploy.rb*
|
|
29
29
|
set :rocket_chat_webhook_url, "https://mychat.com/hooks/MYTOKEN"
|
30
30
|
```
|
31
31
|
|
32
|
+
|
33
|
+
_Optionnal_
|
34
|
+
|
35
|
+
If you want override the channel directly in the capistrano config:
|
36
|
+
|
37
|
+
```
|
38
|
+
set :rocket_chat_channel, "#CHANNEL"
|
39
|
+
```
|
40
|
+
|
32
41
|
And you are ready to go
|
33
42
|
|
34
43
|
## Usage
|
@@ -61,6 +70,7 @@ Possible 'event -> hook' states are:
|
|
61
70
|
},
|
62
71
|
"attributes": {
|
63
72
|
"rocket_chat_url": "http://mychat.com/mytoken",
|
73
|
+
"rocket_chat_channel": "#test",
|
64
74
|
"application": "my_application",
|
65
75
|
"branch": "master",
|
66
76
|
"repo_url": "git@my_git.com/repo/repo",
|
@@ -78,6 +88,8 @@ Possible 'event -> hook' states are:
|
|
78
88
|
}
|
79
89
|
```
|
80
90
|
|
91
|
+
The rocketchat channel is passed in the JSON if only you have defined it in the capistrano config.
|
92
|
+
|
81
93
|
## Development
|
82
94
|
|
83
95
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -26,6 +26,7 @@ end
|
|
26
26
|
def get_config_vars()
|
27
27
|
return {
|
28
28
|
rocket_chat_url: fetch(:rocket_chat_webhook_url),
|
29
|
+
rocket_chat_channel: fetch(:rocket_chat_channel),
|
29
30
|
application: fetch(:application),
|
30
31
|
branch: fetch(:branch),
|
31
32
|
repo_url: fetch(:repo_url),
|
@@ -50,6 +51,12 @@ def notify(event_hook)
|
|
50
51
|
|
51
52
|
notification_text = "#{event_hook} deployment to '#{config[:server][:name]}' on branch '#{config[:branch]}' to stage '#{config[:stage]}'"
|
52
53
|
|
54
|
+
if dry_run?
|
55
|
+
puts "[Rocket Chat] #{event_hook}"
|
56
|
+
puts "[Rocket Chat] #{notification_text}"
|
57
|
+
return
|
58
|
+
end
|
59
|
+
|
53
60
|
request_body = {
|
54
61
|
event: {
|
55
62
|
hook: event_hook,
|
@@ -58,6 +65,12 @@ def notify(event_hook)
|
|
58
65
|
attributes: config
|
59
66
|
}
|
60
67
|
|
61
|
-
|
68
|
+
begin
|
69
|
+
puts "[Rocket Chat] #{event_hook}"
|
70
|
+
HTTParty.post("#{config[:rocket_chat_url]}", body: request_body, timeout: 10).body
|
71
|
+
rescue => e
|
72
|
+
puts "[Rocket Chat] Error notifying Rocket chat!"
|
73
|
+
puts "[Rocket Chat] Error: #{e.inspect}"
|
74
|
+
end
|
62
75
|
end
|
63
76
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-rocket-chat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christoph Bajohr
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -106,9 +106,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.
|
109
|
+
rubygems_version: 2.6.7
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: rocket.chat webhook gem for capistrano 3
|
113
113
|
test_files: []
|
114
|
-
has_rdoc:
|