capistrano-slack_notification 0.2.0 → 0.2.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d0bc0aa6c554da193b7984daf527581b702591b
|
4
|
+
data.tar.gz: 2e1b4100c0b0b327e7a915bc7339046dc0c92e85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 536f88d610936a7b6801107d4842b0d756659084c17a57b3e3c599566d3008a7639cedc811199cedae519b048b4ae698b91e9251336b144b0df573ba49a38407
|
7
|
+
data.tar.gz: b81a1bc786d16cb50b5ece701aee93a214bfdf8f1cf279d0d9af40fa9f836e61696cf193e5ca514c71901e8c95b28b86a29e5f52934dfdaabf8723b4dc65467d
|
@@ -56,11 +56,7 @@ namespace :slack do
|
|
56
56
|
mrkdwn_in: ['text']
|
57
57
|
}]
|
58
58
|
|
59
|
-
|
60
|
-
fetch(:slack_default_body).merge(attachments: JSON.dump(attachments))
|
61
|
-
else
|
62
|
-
JSON.dump(fetch(:slack_default_body).merge(attachments: attachments))
|
63
|
-
end
|
59
|
+
build_http_body attachments
|
64
60
|
}
|
65
61
|
|
66
62
|
set :slack_failure_body, -> {
|
@@ -75,11 +71,7 @@ namespace :slack do
|
|
75
71
|
mrkdwn_in: ['text']
|
76
72
|
}]
|
77
73
|
|
78
|
-
|
79
|
-
fetch(:slack_default_body).merge(attachments: JSON.dump(attachments))
|
80
|
-
else
|
81
|
-
JSON.dump(fetch(:slack_default_body).merge(attachments: attachments))
|
82
|
-
end
|
74
|
+
build_http_body attachments
|
83
75
|
}
|
84
76
|
|
85
77
|
set :slack_success_body, -> {
|
@@ -95,11 +87,7 @@ namespace :slack do
|
|
95
87
|
mrkdwn_in: ['text']
|
96
88
|
}]
|
97
89
|
|
98
|
-
|
99
|
-
fetch(:slack_default_body).merge(attachments: JSON.dump(attachments))
|
100
|
-
else
|
101
|
-
JSON.dump(fetch(:slack_default_body).merge(attachments: attachments))
|
102
|
-
end
|
90
|
+
build_http_body attachments
|
103
91
|
}
|
104
92
|
|
105
93
|
set :slack_client, -> {
|
@@ -115,6 +103,14 @@ namespace :slack do
|
|
115
103
|
end
|
116
104
|
}
|
117
105
|
|
106
|
+
def build_http_body(attachments)
|
107
|
+
if fetch(:slack_token)
|
108
|
+
fetch(:slack_default_body).merge(attachments: JSON.dump(attachments))
|
109
|
+
else
|
110
|
+
JSON.dump(fetch(:slack_default_body).merge(attachments: attachments))
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
118
114
|
def post_to_slack_with(body)
|
119
115
|
run_locally do
|
120
116
|
res = fetch(:slack_client).post fetch(:slack_path), body
|
@@ -127,9 +123,10 @@ namespace :slack do
|
|
127
123
|
end
|
128
124
|
end
|
129
125
|
|
130
|
-
desc 'Post message to Slack (ex. cap production "slack:
|
126
|
+
desc 'Post message to Slack (ex. cap production "slack:post[yo!]")'
|
131
127
|
task :post, :message do |t, args|
|
132
|
-
|
128
|
+
attachments = [{ text: args[:message] }]
|
129
|
+
post_to_slack_with build_http_body(attachments)
|
133
130
|
end
|
134
131
|
|
135
132
|
desc 'Get channel ID by channel name from Slack (ex. cap production "slack:channel[general])"'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-slack_notification
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- linyows
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|