ops_deploy 0.1.4 → 0.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc78846ff1cda030d7cb916965026b0f0bbfcf00
4
- data.tar.gz: 6dc599136948bcee6c6e95669da2d370d0d3d1c9
3
+ metadata.gz: 1770134bbe27e803e4c5905c6bed626973443527
4
+ data.tar.gz: 97f6cd9f48cb327737fa4341e8ad3cee9d673dc8
5
5
  SHA512:
6
- metadata.gz: 6d53e6581e75976bf39642b6bde35ce421f848f7ded689e680d2fbc3112bc361f1ac354d053788ec30bb7ec8c4ab5349ff2aecba7d9c3bd5e88469fcd9931cd3
7
- data.tar.gz: 36f686bd784cc44905520182baaabe08d12649925d3805f07b4188d165bad4159d0639d8ecdb221919455d65647c3bc8219f69fc83578bc4b71b88d4f683765b
6
+ metadata.gz: 49001ff3e7e53d504719b0d02e6a59d352bb627791c449126c7ccf38d400ebba51781c55cc625ce2e1e5e2a70f66242165ecebecd9d134a33b00ba354dbc5336
7
+ data.tar.gz: cca776e64f629e8e4c022f53f3505c62669120ba04f95fe90d3c13f225fc002b37284c46fdeca405102491c46672fa8da18786912a95455da2439a709476e012
@@ -4,15 +4,19 @@ require 'ops_deploy'
4
4
 
5
5
  cli = OpsDeploy::CLI.new
6
6
 
7
- if OpsDeploy::CLI.argument("check-server")
8
- cli.start_check_server
7
+ if OpsDeploy::CLI.argument("server")
8
+ cli.start_server
9
+ elsif OpsDeploy::CLI.argument("check-server")
10
+ puts "The 'check-server' argument is deprecated. Please use 'server'."
11
+ cli.start_server
9
12
  else
10
13
  stack = OpsDeploy::CLI.argument("stack", "STACK_ID")
11
14
  app_id = OpsDeploy::CLI.argument("app-id", "APP_ID")
12
15
  migrate = OpsDeploy::CLI.argument("migrate")
13
16
  check_via_proxy = OpsDeploy::CLI.argument("check-via-proxy")
17
+ wait_via_proxy = OpsDeploy::CLI.argument("wait-via-proxy")
14
18
 
15
19
  cli.start_deployment(stack, app_id, migrate) if OpsDeploy::CLI.argument("deploy")
16
- cli.wait_for_deployments(stack) if OpsDeploy::CLI.argument("wait")
17
- cli.check_instances(stack, check_via_proxy) if OpsDeploy::CLI.argument("check") or check_via_proxy
20
+ cli.wait_for_deployments(stack, wait_via_proxy) if OpsDeploy::CLI.argument("wait") || wait_via_proxy
21
+ cli.check_instances(stack, check_via_proxy) if OpsDeploy::CLI.argument("check") || check_via_proxy
18
22
  end
@@ -45,35 +45,42 @@ class OpsDeploy::CLI
45
45
  end
46
46
  end
47
47
 
48
- def wait_for_deployments(stack_id_name_or_object)
48
+ def wait_for_deployments(stack_id_name_or_object, via_proxy = false)
49
49
  stack = find_stack(stack_id_name_or_object)
50
50
 
51
- step_msg("Checking deployments...")
52
- @main.deployments_callback = Proc.new {
53
- |deployment|
51
+ if via_proxy
52
+ Pusher.url = OpsDeploy::CLI.argument("pusher-url", "PUSHER_URL", true)
53
+ Pusher['OpsDeploy'].trigger('wait_for_deployments', {
54
+ stack: stack.stack_id
55
+ })
56
+ else
57
+ step_msg("Checking deployments...")
58
+ @main.deployments_callback = Proc.new {
59
+ |deployment|
54
60
 
55
- puts
61
+ puts
56
62
 
57
- if (deployment.status == "successful")
58
- success_msg("Deployment", "OK".green.bold, deployment.duration ? "(#{deployment.duration.to_s}s)" : "")
59
- else
60
- failure_msg("Deployment", "Failed".red.bold, deployment.duration ? "(#{deployment.duration.to_s}s)" : "")
61
- end
62
- }
63
+ if (deployment.status == "successful")
64
+ success_msg("Deployment", "OK".green.bold, deployment.duration ? "(#{deployment.duration.to_s}s)" : "")
65
+ else
66
+ failure_msg("Deployment", "Failed".red.bold, deployment.duration ? "(#{deployment.duration.to_s}s)" : "")
67
+ end
68
+ }
63
69
 
64
- waiter = @main.wait_for_deployments(stack)
65
- if waiter
66
- step_msg("Waiting for deployments to finish...")
70
+ waiter = @main.wait_for_deployments(stack)
71
+ if waiter
72
+ step_msg("Waiting for deployments to finish...")
67
73
 
68
- print ".".blue
69
- print ".".blue until waiter.join(1)
74
+ print ".".blue
75
+ print ".".blue until waiter.join(1)
70
76
 
71
- info_msg("Deployments finished")
72
- else
73
- info_msg("No running deployments on stack", "'#{stack_id_name_or_object.blue}'")
74
- end
77
+ info_msg("Deployments finished")
78
+ else
79
+ info_msg("No running deployments on stack", "'#{stack_id_name_or_object.blue}'")
80
+ end
75
81
 
76
- send_notification(stack)
82
+ send_notification(stack)
83
+ end
77
84
  end
78
85
 
79
86
  def check_instances(stack_id_name_or_object, via_proxy = false)
@@ -115,11 +122,12 @@ class OpsDeploy::CLI
115
122
  end
116
123
  end
117
124
 
118
- def start_check_server
125
+ def start_server
119
126
  pusher_comp = URI.parse(OpsDeploy::CLI.argument("pusher-url", "PUSHER_URL", true))
120
127
  PusherClient.logger.level = Logger::ERROR
121
128
  socket = PusherClient::Socket.new(pusher_comp.user, secure: true)
122
129
  socket.subscribe("OpsDeploy")
130
+
123
131
  socket["OpsDeploy"].bind("check_instances") do |data|
124
132
  begin
125
133
  info = data
@@ -132,6 +140,18 @@ class OpsDeploy::CLI
132
140
  end
133
141
  end
134
142
 
143
+ socket["OpsDeploy"].bind("wait_for_deployments") do |data|
144
+ begin
145
+ info = data
146
+ info = JSON.parse(data) if data.kind_of?(String)
147
+ stack_id = info["stack"] || info[:stack]
148
+
149
+ wait_for_deployments(stack_id)
150
+ rescue StandardError => e
151
+ puts e
152
+ end
153
+ end
154
+
135
155
  info_msg("Started OpsDeploy server")
136
156
  socket.connect
137
157
  end
@@ -1,3 +1,3 @@
1
1
  module OpsDeploy
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
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
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mahdi Bchetnia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-22 00:00:00.000000000 Z
11
+ date: 2015-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  version: 1.3.6
132
132
  requirements: []
133
133
  rubyforge_project: ops_deploy
134
- rubygems_version: 2.4.6
134
+ rubygems_version: 2.4.8
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: Perform deployment & checks on AWS OpsWorks