ops_deploy 0.1.7 → 0.1.8
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/ops_deploy/cli.rb +27 -22
- data/lib/ops_deploy/cli/notifier.rb +1 -0
- data/lib/ops_deploy/version.rb +1 -1
- 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: 3517b8d5c1981e1c84cf3c14a0e133f8bee3fbdc
|
4
|
+
data.tar.gz: 30061b9fdf4aefe02028c023138ea62d44a2f5d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 606ef71c9e74fc5f6b9944cdf291e312f76078433e070cb5c6155409a484fdb42d9d7afd3f35690ee0a31fa5efdbdf94f9fcde4704bdd4506d63da6debeb61b4
|
7
|
+
data.tar.gz: a511963e956bd5f4c894979b5a0e4c58794b9319f7c5654fecd8818b6f23025a0d34cba284550290fe22fb00412d99fd053543baa1d95c3ff84d899f0ab746f2
|
data/lib/ops_deploy/cli.rb
CHANGED
@@ -47,10 +47,9 @@ class OpsDeploy::CLI
|
|
47
47
|
stack = find_stack(stack_id_name_or_object)
|
48
48
|
|
49
49
|
if via_proxy
|
50
|
-
slack_webhook_url = OpsDeploy::CLI.argument('slack-webhook-url', 'SLACK_WEBHOOK_URL')
|
51
50
|
Pusher.url = OpsDeploy::CLI.argument('pusher-url', 'PUSHER_URL', true)
|
52
51
|
Pusher.trigger('OpsDeploy', 'wait_for_deployments', stack: stack.stack_id,
|
53
|
-
slack:
|
52
|
+
slack: @notifier.options[:slack])
|
54
53
|
else
|
55
54
|
step_msg('Checking deployments...')
|
56
55
|
@main.deployments_callback = proc { |deployment|
|
@@ -82,10 +81,9 @@ class OpsDeploy::CLI
|
|
82
81
|
stack = find_stack(stack_id_name_or_object)
|
83
82
|
|
84
83
|
if via_proxy
|
85
|
-
slack_webhook_url = OpsDeploy::CLI.argument('slack-webhook-url', 'SLACK_WEBHOOK_URL')
|
86
84
|
Pusher.url = OpsDeploy::CLI.argument('pusher-url', 'PUSHER_URL', true)
|
87
85
|
Pusher.trigger('OpsDeploy', 'check_instances', stack: stack.stack_id,
|
88
|
-
slack:
|
86
|
+
slack: @notifier.options[:slack])
|
89
87
|
else
|
90
88
|
@main.instances_check_callback = proc { |instance, response, error|
|
91
89
|
puts
|
@@ -123,12 +121,10 @@ class OpsDeploy::CLI
|
|
123
121
|
socket['OpsDeploy'].bind('check_instances') do |data|
|
124
122
|
begin
|
125
123
|
info = data
|
126
|
-
info = JSON.parse(data) if data.is_a?(String)
|
127
|
-
stack_id = info['stack'] || info[:stack]
|
128
|
-
slack_webhook_url = info['slack'] || info[:slack]
|
124
|
+
info = symbolize_keys(JSON.parse(data)) if data.is_a?(String)
|
129
125
|
|
130
|
-
|
131
|
-
check_instances(
|
126
|
+
with_slack(info[:slack]) do
|
127
|
+
check_instances(info[:stack])
|
132
128
|
end
|
133
129
|
rescue StandardError => e
|
134
130
|
puts e
|
@@ -138,12 +134,10 @@ class OpsDeploy::CLI
|
|
138
134
|
socket['OpsDeploy'].bind('wait_for_deployments') do |data|
|
139
135
|
begin
|
140
136
|
info = data
|
141
|
-
info = JSON.parse(data) if data.is_a?(String)
|
142
|
-
stack_id = info['stack'] || info[:stack]
|
143
|
-
slack_webhook_url = info['slack'] || info[:slack]
|
137
|
+
info = symbolize_keys(JSON.parse(data)) if data.is_a?(String)
|
144
138
|
|
145
|
-
|
146
|
-
wait_for_deployments(
|
139
|
+
with_slack(info[:slack]) do
|
140
|
+
wait_for_deployments(info[:stack])
|
147
141
|
end
|
148
142
|
rescue StandardError => e
|
149
143
|
puts e
|
@@ -154,13 +148,9 @@ class OpsDeploy::CLI
|
|
154
148
|
socket.connect
|
155
149
|
end
|
156
150
|
|
157
|
-
def
|
151
|
+
def with_slack(slack_options = nil)
|
158
152
|
old_notifier = @notifier
|
159
|
-
|
160
|
-
@notifier = OpsDeploy::CLI::Notifier.new(slack: {
|
161
|
-
webhook_url: slack_webhook_url
|
162
|
-
})
|
163
|
-
end
|
153
|
+
@notifier = OpsDeploy::CLI::Notifier.new(slack: slack_options) if slack_options
|
164
154
|
|
165
155
|
yield
|
166
156
|
|
@@ -251,14 +241,29 @@ class OpsDeploy::CLI
|
|
251
241
|
end
|
252
242
|
|
253
243
|
def puts(message = nil)
|
254
|
-
$stdout.puts(message)
|
244
|
+
$stdout.puts(message)
|
255
245
|
$stdout.flush
|
256
246
|
end
|
257
247
|
|
258
248
|
def print(message = nil)
|
259
|
-
$stdout.print(message)
|
249
|
+
$stdout.print(message)
|
260
250
|
$stdout.flush
|
261
251
|
end
|
252
|
+
|
253
|
+
def symbolize_keys(hash)
|
254
|
+
hash.inject({}){|result, (key, value)|
|
255
|
+
new_key = case key
|
256
|
+
when String then key.to_sym
|
257
|
+
else key
|
258
|
+
end
|
259
|
+
new_value = case value
|
260
|
+
when Hash then symbolize_keys(value)
|
261
|
+
else value
|
262
|
+
end
|
263
|
+
result[new_key] = new_value
|
264
|
+
result
|
265
|
+
}
|
266
|
+
end
|
262
267
|
end
|
263
268
|
|
264
269
|
require_relative 'cli/notifier'
|
data/lib/ops_deploy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ops_deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mahdi Bchetnia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|