lita-capistrano 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lita/handlers/capistrano.rb +65 -32
- data/lita-capistrano.gemspec +2 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3c19a8b4e1c2c29eeea20d0900ec200abecc545
|
4
|
+
data.tar.gz: d4d457dbf0e1162edf8d94adaead7fedf93edebd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 570635dd217d78445f09ea31570dcaf5ec6cf3feaaf02961e70c128e3a233288c0cffe9939d1f3e97cc1f0cc449d347cd679a399ac470bdd3b672a370e437267
|
7
|
+
data.tar.gz: e9c00cfafe4d5020c3b29149200ad7e98e7360b910427af8e428103f45b87c0799f5c60b2404234587082aca3651682e5fdff1d9c38465911731eefa42dba120
|
@@ -9,39 +9,14 @@ module Lita
|
|
9
9
|
config :server_password, type: String, required: true
|
10
10
|
config :deploy_tree, type: Hash, required: true
|
11
11
|
|
12
|
+
on :loaded, :define_routes
|
13
|
+
|
12
14
|
on :deploy_checked, :deploy_exec
|
13
15
|
on :deploy_aborted, :deploy_abort
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
restrict_to: [:admins, :deploy],
|
19
|
-
help: { "deploy list [APP] " => "List available apps for deploy"}
|
20
|
-
)
|
21
|
-
|
22
|
-
route(
|
23
|
-
/^deploy\s+(.+)\s+(.+)\s+(.+)\s+(.+)/,
|
24
|
-
:deploy_request, command: true,
|
25
|
-
restrict_to: [:admins, :deploy],
|
26
|
-
help: { "deploy APP AREA ENV TAG " => "Executa deploy"}
|
27
|
-
)
|
28
|
-
|
29
|
-
# Not in use
|
30
|
-
def teste
|
31
|
-
p "teste"
|
32
|
-
config.deploy_tree.each do |key, value|
|
33
|
-
route(
|
34
|
-
/^deploy\s+#{key.to_s}\s+(.+)\s+(.+)\s+(.+)/,
|
35
|
-
:deploy_request, command: true,
|
36
|
-
restrict_to: [:admins, value[:deploy_group]],
|
37
|
-
help: { "deploy #{key.to_s} AREA ENV TAG " => "Executa deploy"}
|
38
|
-
)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def deploy_list_apps(response)
|
43
|
-
response.reply_privately('Available apps:')
|
44
|
-
response.reply_privately(config.deploy_tree.keys)
|
17
|
+
def define_routes(payload)
|
18
|
+
define_static_routes
|
19
|
+
define_dinamic_routes(config.deploy_tree)
|
45
20
|
end
|
46
21
|
|
47
22
|
def deploy_list(response)
|
@@ -55,6 +30,17 @@ module Lita
|
|
55
30
|
end
|
56
31
|
end
|
57
32
|
|
33
|
+
def deploy_auth_list(response)
|
34
|
+
requested_app = response.args[2]
|
35
|
+
if requested_app.nil?
|
36
|
+
apps_auth_tree = get_apps_auth_groups(config.deploy_tree)
|
37
|
+
response.reply_privately("Auth groups for apps:\n#{apps_auth_tree}")
|
38
|
+
else
|
39
|
+
app_tree = get_app_auth_group(config.deploy_tree[requested_app.to_sym])
|
40
|
+
response.reply_privately("Auth group needed to deploy #{requested_app}: \n #{app_tree}")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
58
44
|
def deploy_request(response)
|
59
45
|
app = response.matches[0][0]
|
60
46
|
area = response.matches[0][1]
|
@@ -89,6 +75,22 @@ module Lita
|
|
89
75
|
app_tree.flatten.map { |e| "#{e}\n" }.join
|
90
76
|
end
|
91
77
|
|
78
|
+
def get_apps_auth_groups(config_tree)
|
79
|
+
app_tree = {}
|
80
|
+
config_tree.each do |key, value|
|
81
|
+
app_tree.store(key.to_s, value.map { |e| ">#{e[0]}: #{e[1][:auth_group]}\n" }.join)
|
82
|
+
end
|
83
|
+
app_tree.flatten.map { |e| "#{e}\n" }.join
|
84
|
+
end
|
85
|
+
|
86
|
+
def get_app_auth_group(config_tree)
|
87
|
+
app_tree = []
|
88
|
+
config_tree.each do |key, value|
|
89
|
+
app_tree << "#{key.to_s}: #{value[:auth_group]}"
|
90
|
+
end
|
91
|
+
app_tree.flatten.map { |e| "#{e}\n" }.join
|
92
|
+
end
|
93
|
+
|
92
94
|
# If a deploy is in progress the deploy_tracker handler will return a
|
93
95
|
# reponse to chat and will interrupt further using the interrupt_deploy
|
94
96
|
# method
|
@@ -162,6 +164,37 @@ module Lita
|
|
162
164
|
end
|
163
165
|
end
|
164
166
|
|
167
|
+
private
|
168
|
+
|
169
|
+
def define_static_routes
|
170
|
+
self.class.route(
|
171
|
+
%r{^deploy\s+list},
|
172
|
+
:deploy_list,
|
173
|
+
command: false,
|
174
|
+
help: { "deploy list [APP] " => "List available apps for deploy"}
|
175
|
+
)
|
176
|
+
self.class.route(
|
177
|
+
%r{^deploy\s+auth\s+list},
|
178
|
+
:deploy_auth_list,
|
179
|
+
command: false,
|
180
|
+
help: { "deploy auth list [APP] " => "List available apps for deploy"}
|
181
|
+
)
|
182
|
+
end
|
183
|
+
|
184
|
+
def define_dinamic_routes(deploy_tree)
|
185
|
+
deploy_tree.each do |app, areas|
|
186
|
+
areas.each do |area, value|
|
187
|
+
self.class.route(
|
188
|
+
%r{^deploy\s+(#{app})\s+(#{area})\s+(.+)\s+(.+)},
|
189
|
+
:deploy_request,
|
190
|
+
command: true,
|
191
|
+
restrict_to: [:admins, value[:auth_group].to_sym],
|
192
|
+
help: { "deploy #{app} #{area} ENV TAG " => "Executa deploy da app #{app} na area #{area}"}
|
193
|
+
)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
165
198
|
def deploy(dir, env, tag)
|
166
199
|
output = ssh_exec("cd #{dir}; cap #{env} deploy tag=#{tag}")
|
167
200
|
end
|
@@ -173,8 +206,8 @@ module Lita
|
|
173
206
|
end
|
174
207
|
@output
|
175
208
|
end
|
176
|
-
|
177
|
-
Lita.register_handler(self)
|
178
209
|
end
|
210
|
+
|
211
|
+
Lita.register_handler(Capistrano)
|
179
212
|
end
|
180
213
|
end
|
data/lita-capistrano.gemspec
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "lita-capistrano"
|
3
|
-
spec.version = "0.1.
|
3
|
+
spec.version = "0.1.3"
|
4
4
|
spec.authors = ["Alexandre Gomes"]
|
5
5
|
spec.email = ["alejdg@outlook.com.br"]
|
6
6
|
spec.summary = "A Lita handler to integrate with Capistrano.rb"
|
7
|
+
spec.description = "A Lita handler to integrate with Capistrano.rb"
|
7
8
|
spec.homepage = "https://github.com/alejdg/lita-capistrano.git"
|
8
9
|
spec.metadata = { "lita_plugin_type" => "handler" }
|
9
10
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-capistrano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandre Gomes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '3.0'
|
125
|
-
description:
|
125
|
+
description: A Lita handler to integrate with Capistrano.rb
|
126
126
|
email:
|
127
127
|
- alejdg@outlook.com.br
|
128
128
|
executables: []
|
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
160
160
|
version: '0'
|
161
161
|
requirements: []
|
162
162
|
rubyforge_project:
|
163
|
-
rubygems_version: 2.
|
163
|
+
rubygems_version: 2.5.1
|
164
164
|
signing_key:
|
165
165
|
specification_version: 4
|
166
166
|
summary: A Lita handler to integrate with Capistrano.rb
|