aerosol 1.0.2 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7f88639e8e26f2fbd0e6d084dc7cf892fe64a64
4
- data.tar.gz: 1900da4e6336f5ddcc1f5afc25c749983697bf22
3
+ metadata.gz: 31c767638dd285ff3db576f4dacdaff662ca52e8
4
+ data.tar.gz: 4052d794ed7b58ab82fd571a28ce9e9c52255458
5
5
  SHA512:
6
- metadata.gz: 110a201822e5fb9f48de030db928065630d9a11c183854c93e0862b628f1a567e36b8d1342bebbb5ce0b5ef722ef86c2aa02bc38f716063b1fd41282e410d0c8
7
- data.tar.gz: a1397e305836e09a0cf8022c5fdc69cde103e39c3e1f2ebaaf9a62275a8a7ba7e6e4a1892fbdfde456d7a09c3ee50d9c808955645807202c3f0fecba61bc697d
6
+ metadata.gz: f4b7fcfcb3958c646d6c2707a91fb9cff4b72186f679d63129872cb5d2dcfb4694282c6b0fb3b73d211dabb33cfaf77e2ddd54357c95d4aa37fd8ff2a652d92d
7
+ data.tar.gz: f1240b253337fd73fd9316808ceb08d0d12676905f539c6d25469ae5431b6be43453d25a4647f080593bf0e5c948616b17f4f4c8cca0b5b11441107bed0c575a
@@ -36,8 +36,10 @@ class Aerosol::Deploy
36
36
  @live_check
37
37
  end
38
38
 
39
- def is_alive?(&block)
40
- @is_alive = block unless block.nil?
39
+ def is_alive?(command = nil, &block)
40
+ fail 'Command and block specified' if command && block
41
+ @is_alive = block if block
42
+ @is_alive = command if command
41
43
  @is_alive
42
44
  end
43
45
 
@@ -106,13 +106,18 @@ class Aerosol::Runner
106
106
  ssh.with_connection(instance) do |session|
107
107
  start_tailing_logs(ssh, instance) if log_pids[instance.instance_id].nil?
108
108
  debug "checking if #{instance.instance_id} is healthy"
109
- success = if is_alive?.nil?
110
- debug 'Using default site live check'
111
- check_site_live(session)
112
- else
113
- debug 'Using custom site live check'
114
- is_alive?.call(session, self)
115
- end
109
+ success =
110
+ case is_alive?
111
+ when Proc
112
+ debug 'Using custom site live check'
113
+ is_alive?.call(session, self)
114
+ when String
115
+ debug "Using custom site live check: #{is_alive?}"
116
+ check_live_with(session, is_alive?)
117
+ else
118
+ debug 'Using default site live check'
119
+ check_site_live(session)
120
+ end
116
121
  end
117
122
 
118
123
  if success
@@ -136,7 +141,10 @@ class Aerosol::Runner
136
141
  '-O',
137
142
  '/dev/null'
138
143
  ].compact.join(' ')
144
+ check_live_with(session, command)
145
+ end
139
146
 
147
+ def check_live_with(session, command)
140
148
  debug "running #{command}"
141
149
  ret = ssh_exec!(session, command)
142
150
  debug "finished running #{command}"
@@ -1,5 +1,5 @@
1
1
  # Copyright Swipely, Inc. All rights reserved.
2
2
 
3
3
  module Aerosol
4
- VERSION = '1.0.2'
4
+ VERSION = '1.1.0'
5
5
  end
@@ -180,7 +180,24 @@ describe Aerosol::Deploy do
180
180
  end
181
181
  end
182
182
 
183
- context 'when an argument is given' do
183
+ context 'when a command and block are given' do
184
+ it 'fails' do
185
+ expect { subject.is_alive?('true', &check) }.to raise_error
186
+ end
187
+ end
188
+
189
+ context 'when a command is given' do
190
+ let(:command) { 'bash -lc "[[ -e /tmp/up ]]"' }
191
+
192
+ it 'sets is_alive? to that value' do
193
+ expect { subject.is_alive?(command) }
194
+ .to change { subject.is_alive? }
195
+ .from(nil)
196
+ .to(command)
197
+ end
198
+ end
199
+
200
+ context 'when a block is given' do
184
201
  it 'sets is_alive? to that value' do
185
202
  expect { subject.is_alive?(&check) }
186
203
  .to change { subject.is_alive? }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aerosol
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Swipely, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-01 00:00:00.000000000 Z
11
+ date: 2015-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -275,7 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
275
275
  version: '0'
276
276
  requirements: []
277
277
  rubyforge_project:
278
- rubygems_version: 2.2.2
278
+ rubygems_version: 2.4.5
279
279
  signing_key:
280
280
  specification_version: 4
281
281
  summary: Instance-based deploys made easy
@@ -293,3 +293,4 @@ test_files:
293
293
  - spec/aerosol_spec.rb
294
294
  - spec/spec_helper.rb
295
295
  - spec/support/vcr.rb
296
+ has_rdoc: