blower 5.0a2 → 5.0a3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec965321ff38be8f45808a36e9174f7d8ef27f4207201c7c8f7f153a5c977c0b
4
- data.tar.gz: 8ff462f864d712147fc83564b1e48bb3ce787f4e7a1731a6246350b049c8b4cb
3
+ metadata.gz: 6369e5b4ff95c392dbe748cf592958afe1964df32bf53207e82c3a21f7e8c071
4
+ data.tar.gz: 193302c6641c9ce020bde5f52e2c06da7d3df84cdd57c1a2a222f2f4a5f06752
5
5
  SHA512:
6
- metadata.gz: 8cfb4f1e296092e7476cab1c6d195de9ea711f02507d0afd9d6e6f7c58624db8f554ee1de58ed9e1c126b8c1cedd494306de8156294d4ab180bee4435a2eab9b
7
- data.tar.gz: eb210231185c828dc6d6d4ff38fdde6a03fcce32e470fb1c675949eecb76af2d3e62cc011f49ce878e21990c1cd0bbbc901bac87d168cb69a1dc5d5e640ec6c6
6
+ metadata.gz: 39655aa9b776541e74953935aa5201041c530e4847c62a4972dd0b8048b65cdf75d23880dc7d8064e6160305c2654a51f9f71853f2808f5753170c288a34703a
7
+ data.tar.gz: f0987ab1d943d0285ac29bdd6afcc9ff19548b833ac7350cee853ffabd6086d6bf2dd09e634ecb2e4bbf28803bac15bd3b22847eb6ac75445fbd8c60b587367c
@@ -95,7 +95,7 @@ module Blower
95
95
  def on (*hosts, quiet: false)
96
96
  let :@hosts => hosts.flatten do
97
97
  log.info "on #{@hosts.map(&:name).join(", ")}", quiet: quiet do
98
- yield
98
+ yield *hosts
99
99
  end
100
100
  end
101
101
  end
@@ -142,6 +142,12 @@ module Blower
142
142
  raise e
143
143
  end
144
144
 
145
+ def sh? (command, as: user, on: hosts, quiet: false, once: nil)
146
+ sh command, as: as, on: on, quiet: quiet, once: once
147
+ rescue
148
+ nil
149
+ end
150
+
145
151
  # Execute a shell command on each host
146
152
  # @macro onable
147
153
  # @macro asable
@@ -347,7 +353,7 @@ module Blower
347
353
  end
348
354
 
349
355
  def on_each (hosts = self.hosts, serial: true)
350
- each(hosts, serial: serial) do |host, i|
356
+ each(hosts.dup, serial: serial) do |host, i|
351
357
  on host do
352
358
  singularly do
353
359
  yield host, i
data/lib/blower/host.rb CHANGED
@@ -55,6 +55,7 @@ module Blower
55
55
  # Copy files or directories to the host.
56
56
  # @api private
57
57
  def cp (froms, to, as: nil, quiet: false, delete: false)
58
+ sleep DELAY if DELAY
58
59
  as ||= @user
59
60
  output = ""
60
61
  synchronize do
@@ -110,6 +111,7 @@ module Blower
110
111
  # Execute a command on the host and return its output.
111
112
  # @api private
112
113
  def sh (command, as: nil, quiet: false)
114
+ sleep DELAY if DELAY
113
115
  as ||= @user
114
116
  output = ""
115
117
  synchronize do
data/lib/blower/local.rb CHANGED
@@ -27,7 +27,14 @@ module Blower
27
27
 
28
28
  def sh (command, as: nil, quiet: false)
29
29
  command = "#{@proxy} #{command.shellescape}" if @proxy
30
- IO.popen(command).read
30
+ result = IO.popen(command) do |io|
31
+ io.read
32
+ end
33
+ if $?.success?
34
+ result
35
+ else
36
+ raise "Command failed"
37
+ end
31
38
  end
32
39
 
33
40
  # Produce a Logger prefixed with the host name.
data/lib/blower/util.rb CHANGED
@@ -26,3 +26,9 @@ class Object
26
26
  end
27
27
 
28
28
  end
29
+
30
+ def try (err = nil, &block)
31
+ block.()
32
+ rescue
33
+ err
34
+ end
@@ -1,3 +1,3 @@
1
1
  module Blower
2
- VERSION = "5.0a2"
2
+ VERSION = "5.0a3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blower
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0a2
4
+ version: 5.0a3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Baum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-22 00:00:00.000000000 Z
11
+ date: 2019-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  - !ruby/object:Gem::Version
160
160
  version: 1.3.1
161
161
  requirements: []
162
- rubygems_version: 3.0.2
162
+ rubygems_version: 3.0.3
163
163
  signing_key:
164
164
  specification_version: 4
165
165
  summary: Really simple server orchestration