blower 4.2 → 4.3
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/bin/blow +1 -4
- data/lib/blower/context.rb +9 -6
- data/lib/blower/host.rb +10 -2
- data/lib/blower/plugin.rb +22 -0
- data/lib/blower/version.rb +1 -1
- data/lib/blower.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a923b0167ae5ee7acc8461d3929b7001134f93a2
|
4
|
+
data.tar.gz: 2647d91696288ef1ea8cba942c6dc9b467e36f23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de25c87aadad63fa9b007224836be6bc2c83b0a5c62bea88f3a00c972e8ed3cdb00f7c5de1668802915a33bb63294ed57ed5b7d1190a6b937b572df03ecd7b34
|
7
|
+
data.tar.gz: bfeab889da3cdde2b2f5e9b26a1ddfecb948699b2095918cfd1103d7b17607fd0ae615abd0d96580f2bee0c5f4771cd1a829997dc02e8638767c7f75416c981d
|
data/bin/blow
CHANGED
@@ -6,6 +6,7 @@ require 'optparse'
|
|
6
6
|
path = []
|
7
7
|
|
8
8
|
OptionParser.new do |opts|
|
9
|
+
Version = Blower::VERSION
|
9
10
|
opts.banner = "Usage: blow [options] task..."
|
10
11
|
opts.on "-d DIR", "Set working directory" do |v|
|
11
12
|
Dir.chdir v
|
@@ -16,10 +17,6 @@ OptionParser.new do |opts|
|
|
16
17
|
opts.on "-I DIR", "Add directory to search path" do |v|
|
17
18
|
path << v
|
18
19
|
end
|
19
|
-
opts.on "-v", "Show version and exit" do |v|
|
20
|
-
puts "blow (blower) #{Blower::VERSION}"
|
21
|
-
exit
|
22
|
-
end
|
23
20
|
end.order!
|
24
21
|
|
25
22
|
$: << File.join(Dir.pwd, "lib")
|
data/lib/blower/context.rb
CHANGED
@@ -275,14 +275,17 @@ module Blower
|
|
275
275
|
|
276
276
|
def each (hosts = self.hosts)
|
277
277
|
fail "No hosts" if hosts.empty?
|
278
|
-
[hosts].flatten.
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
278
|
+
threads = [hosts].flatten.map do |host|
|
279
|
+
Thread.new do
|
280
|
+
begin
|
281
|
+
yield host
|
282
|
+
rescue => e
|
283
|
+
host.log.error e.message
|
284
|
+
hosts.delete host
|
285
|
+
end
|
284
286
|
end
|
285
287
|
end
|
288
|
+
threads.each(&:join)
|
286
289
|
fail "No hosts remaining" if hosts.empty?
|
287
290
|
end
|
288
291
|
|
data/lib/blower/host.rb
CHANGED
@@ -62,7 +62,7 @@ module Blower
|
|
62
62
|
[froms].flatten.each do |from|
|
63
63
|
if from.is_a?(String)
|
64
64
|
to += "/" if to[-1] != "/" && from.is_a?(Array)
|
65
|
-
command = ["rsync", "-e",
|
65
|
+
command = ["rsync", "-e", ssh_command, "-r"]
|
66
66
|
command += [*from, "#{as}@#{@address}:#{to}"]
|
67
67
|
log.trace command.shelljoin, quiet: quiet
|
68
68
|
IO.popen(command, in: :close, err: %i(child out)) do |io|
|
@@ -147,13 +147,21 @@ module Blower
|
|
147
147
|
# Connect to the host as a Gateway
|
148
148
|
# @api private
|
149
149
|
def gateway ()
|
150
|
-
Net::SSH::Gateway(address, user)
|
150
|
+
Net::SSH::Gateway.new(address, user)
|
151
151
|
end
|
152
152
|
|
153
153
|
private
|
154
154
|
|
155
155
|
attr_accessor :data
|
156
156
|
|
157
|
+
def ssh_command
|
158
|
+
if via
|
159
|
+
"ssh -t -A -oStrictHostKeyChecking=no #{via} ssh -oStrictHostKeyChecking=no"
|
160
|
+
else
|
161
|
+
"ssh -oStrictHostKeyChecking=no"
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
157
165
|
def ssh (user)
|
158
166
|
@sessions ||= {}
|
159
167
|
if @sessions[user] && @sessions[user].closed?
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Blower
|
2
|
+
|
3
|
+
class Plugin
|
4
|
+
extend Forwardable
|
5
|
+
|
6
|
+
def_delegators :@context, *%i(get unset set with on as run sh cp read write render ping once)
|
7
|
+
|
8
|
+
def initialize (context)
|
9
|
+
@context = context
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.plugin (name, &body)
|
15
|
+
Class.new(Plugin, &body).tap do |klass|
|
16
|
+
Context.send :define_method, name do
|
17
|
+
klass.new(self)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
data/lib/blower/version.rb
CHANGED
data/lib/blower.rb
CHANGED
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: '4.
|
4
|
+
version: '4.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Baum
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- lib/blower/errors.rb
|
94
94
|
- lib/blower/host.rb
|
95
95
|
- lib/blower/logger.rb
|
96
|
+
- lib/blower/plugin.rb
|
96
97
|
- lib/blower/util.rb
|
97
98
|
- lib/blower/version.rb
|
98
99
|
homepage: http://www.github.org/nbaum/blower
|