capistrano-stride 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/capistrano/stride/version.rb +2 -2
- data/lib/capistrano/tasks/stride.rake +54 -108
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b42944ec66bc82377d4f627287ef780fcca0eb59
|
|
4
|
+
data.tar.gz: 43ef8f99caa6521c709cdd6d4410e23404202c29
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 39b163013f2c5d7c4db1f2f18973c6ea362aa5c9f0f337ca9657ce117a974d660d45ecc6f8631d6786ef7589d1a1123ccd3b30ca5a6eb7eca834a13553541a63
|
|
7
|
+
data.tar.gz: c371531765661c58a341885a3600a77d630723ad0a10789a6cf1bb2ea86e5316622b319413bd054d8981eabc3039ac0ceca2524a2a5e9ab4b2b2d94afedfaf85
|
|
@@ -6,139 +6,85 @@ require 'json'
|
|
|
6
6
|
namespace :stride do
|
|
7
7
|
task :notify_deploy_failed do
|
|
8
8
|
message = "#{fetch(:local_user, local_user).strip} cancelled deployment of #{fetch(:application)} to #{fetch(:stage)}."
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
version: 1,
|
|
13
|
-
type: "doc",
|
|
14
|
-
content: [
|
|
15
|
-
{
|
|
16
|
-
type: "panel",
|
|
17
|
-
attrs: {
|
|
18
|
-
panelType: "warning"
|
|
19
|
-
},
|
|
20
|
-
content: [
|
|
21
|
-
{
|
|
22
|
-
type: "paragraph",
|
|
23
|
-
content: [
|
|
24
|
-
{
|
|
25
|
-
type: "text",
|
|
26
|
-
text: message
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
]
|
|
31
|
-
}
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
uri = URI.parse(fetch(:stride_url))
|
|
37
|
-
https = Net::HTTP.new(uri.host, uri.port)
|
|
38
|
-
https.use_ssl = true
|
|
39
|
-
header = {
|
|
40
|
-
'Content-Type' => 'application/json',
|
|
41
|
-
'Authorization' => "Bearer #{fetch(:stride_token)}"
|
|
42
|
-
}
|
|
43
|
-
req = Net::HTTP::Post.new(uri.path, header)
|
|
44
|
-
req.body = body.to_json
|
|
45
|
-
https.request(req)
|
|
9
|
+
url = fetch(:stride_url)
|
|
10
|
+
token = fetch(:stride_token)
|
|
11
|
+
send(url, token, message, 'removed')
|
|
46
12
|
end
|
|
47
13
|
|
|
48
14
|
task :notify_deploy_started do
|
|
49
15
|
commits = `git log --no-color --max-count=5 --pretty=format:' - %an: %s' --abbrev-commit --no-merges #{fetch(:previous_revision, "HEAD")}..#{fetch(:current_revision, "HEAD")}`
|
|
50
|
-
message = "#{fetch(:local_user, local_user).strip} is deploying #{fetch(:application)} to #{fetch(:stage)} \n"
|
|
16
|
+
message = "#{fetch(:local_user, local_user).strip} is deploying #{fetch(:application)} to #{fetch(:stage)} \n\n#{commits}"
|
|
17
|
+
url = fetch(:stride_url)
|
|
18
|
+
token = fetch(:stride_token)
|
|
19
|
+
send(url, token, message)
|
|
20
|
+
end
|
|
51
21
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
]
|
|
80
|
-
}
|
|
81
|
-
]
|
|
82
|
-
}
|
|
83
|
-
]
|
|
84
|
-
}
|
|
85
|
-
}
|
|
22
|
+
task :notify_deploy_finished do
|
|
23
|
+
message = "#{fetch(:local_user, local_user).strip} finished deploying #{fetch(:application)} to #{fetch(:stage)}."
|
|
24
|
+
url = fetch(:stride_url)
|
|
25
|
+
token = fetch(:stride_token)
|
|
26
|
+
send(url, token, message, 'success')
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
before "deploy:updated", "stride:notify_deploy_started"
|
|
30
|
+
after "deploy:finished", "stride:notify_deploy_finished"
|
|
31
|
+
before "deploy:reverted", "stride:notify_deploy_failed"
|
|
32
|
+
|
|
33
|
+
def send(stride_url, stride_token, message = '', status = 'inprogress')
|
|
34
|
+
@status = status
|
|
35
|
+
@message = message
|
|
36
|
+
if status == 'inprogress'
|
|
37
|
+
@status_text = 'Started'
|
|
38
|
+
elsif status == 'success'
|
|
39
|
+
@status_text = 'Successful'
|
|
40
|
+
elsif status == 'removed'
|
|
41
|
+
@status_text = 'Failed'
|
|
42
|
+
else
|
|
43
|
+
@status = 'default'
|
|
44
|
+
@status_text = 'Unknown'
|
|
45
|
+
end
|
|
86
46
|
|
|
87
|
-
uri = URI.parse(
|
|
47
|
+
uri = URI.parse(stride_url)
|
|
88
48
|
https = Net::HTTP.new(uri.host, uri.port)
|
|
89
49
|
https.use_ssl = true
|
|
90
50
|
header = {
|
|
91
51
|
'Content-Type' => 'application/json',
|
|
92
|
-
'Authorization' => "Bearer #{
|
|
52
|
+
'Authorization' => "Bearer #{stride_token}"
|
|
93
53
|
}
|
|
94
54
|
req = Net::HTTP::Post.new(uri.path, header)
|
|
95
55
|
req.body = body.to_json
|
|
96
56
|
https.request(req)
|
|
97
57
|
end
|
|
98
58
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
body = {
|
|
59
|
+
def body
|
|
60
|
+
{
|
|
103
61
|
body: {
|
|
104
62
|
version: 1,
|
|
105
|
-
type:
|
|
63
|
+
type: 'doc',
|
|
106
64
|
content: [
|
|
107
65
|
{
|
|
108
|
-
type:
|
|
66
|
+
type: 'applicationCard',
|
|
109
67
|
attrs: {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
68
|
+
text: @message,
|
|
69
|
+
collapsible: true,
|
|
70
|
+
title: {
|
|
71
|
+
text: 'Deployment Status'
|
|
72
|
+
},
|
|
73
|
+
description: {
|
|
74
|
+
text: @message
|
|
75
|
+
},
|
|
76
|
+
details: [
|
|
77
|
+
{
|
|
78
|
+
lozenge: {
|
|
79
|
+
text: @status_text,
|
|
80
|
+
appearance: @status
|
|
119
81
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
}
|
|
124
85
|
}
|
|
125
86
|
]
|
|
126
87
|
}
|
|
127
88
|
}
|
|
128
|
-
|
|
129
|
-
uri = URI.parse(fetch(:stride_url))
|
|
130
|
-
https = Net::HTTP.new(uri.host, uri.port)
|
|
131
|
-
https.use_ssl = true
|
|
132
|
-
header = {
|
|
133
|
-
'Content-Type' => 'application/json',
|
|
134
|
-
'Authorization' => "Bearer #{fetch(:stride_token)}"
|
|
135
|
-
}
|
|
136
|
-
req = Net::HTTP::Post.new(uri.path, header)
|
|
137
|
-
req.body = body.to_json
|
|
138
|
-
https.request(req)
|
|
139
89
|
end
|
|
140
|
-
|
|
141
|
-
before "deploy:updated", "stride:notify_deploy_started"
|
|
142
|
-
after "deploy:finished", "stride:notify_deploy_finished"
|
|
143
|
-
before "deploy:reverted", "stride:notify_deploy_failed"
|
|
144
90
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: capistrano-stride
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Arsen Bespalov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-06-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: capistrano
|