blower 4.3 → 4.4

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
  SHA1:
3
- metadata.gz: a923b0167ae5ee7acc8461d3929b7001134f93a2
4
- data.tar.gz: 2647d91696288ef1ea8cba942c6dc9b467e36f23
3
+ metadata.gz: 3c6367491fa2a0b915044247edee33154deb5868
4
+ data.tar.gz: dd912a9d63a01284959b004aa9b3939a4c33a604
5
5
  SHA512:
6
- metadata.gz: de25c87aadad63fa9b007224836be6bc2c83b0a5c62bea88f3a00c972e8ed3cdb00f7c5de1668802915a33bb63294ed57ed5b7d1190a6b937b572df03ecd7b34
7
- data.tar.gz: bfeab889da3cdde2b2f5e9b26a1ddfecb948699b2095918cfd1103d7b17607fd0ae615abd0d96580f2bee0c5f4771cd1a829997dc02e8638767c7f75416c981d
6
+ metadata.gz: 91a4979929ad2f8e36b6ee0a1c0ff92bbc7b75abbd8033d07fa2e9aeb5d6068aae4ab02360c33116d330dde7e20e087e34885582b4b753edb5b315e110538b69
7
+ data.tar.gz: 8324bbf1b404b50d6a922e5c60d75fbf63d2b49ab4dd517ffdeabaa5c9a60cb6d750692fbe2dcdb067e1fabb1ecd1938343c9dae30b88343151cc9f9e395b01e
@@ -265,8 +265,24 @@ module Blower
265
265
 
266
266
  private
267
267
 
268
+ class HostHash < Hash
269
+
270
+ def to_s
271
+ map do |host, data|
272
+ "#{host.name.blue} (#{host.address.green})\n" + data.strip.to_s.gsub(/^/, " ")
273
+ end.join("\n")
274
+ end
275
+
276
+ def stash (key)
277
+ each do |host, data|
278
+ host[key] = data.strip
279
+ end
280
+ end
281
+
282
+ end
283
+
268
284
  def hash_map (hosts = self.hosts)
269
- {}.tap do |result|
285
+ HostHash.new.tap do |result|
270
286
  each(hosts) do |host|
271
287
  result[host] = yield(host)
272
288
  end
data/lib/blower/host.rb CHANGED
@@ -17,23 +17,22 @@ module Blower
17
17
  # The host adress.
18
18
  attr_accessor :address
19
19
 
20
+ attr_accessor :name
21
+
20
22
  # The gateway host
21
23
  attr_accessor :via
22
24
 
23
25
  def_delegators :data, :[], :[]=
24
26
 
25
- def initialize (address, data: {}, user: "root", via: nil)
27
+ def initialize (address, data: {}, user: "root", via: nil, name: address)
26
28
  @address = address
29
+ @name = name
27
30
  @user = user
28
31
  @data = data
29
32
  @via = via
30
33
  super()
31
34
  end
32
35
 
33
- def name
34
- to_s
35
- end
36
-
37
36
  # Represent the host as a string.
38
37
  def to_s
39
38
  "#{@user}@#{@address}"
@@ -1,3 +1,3 @@
1
1
  module Blower
2
- VERSION = "4.3"
2
+ VERSION = "4.4"
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: '4.3'
4
+ version: '4.4'
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-08-11 00:00:00.000000000 Z
11
+ date: 2016-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh