xlogin 0.6.21 → 0.6.22

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: 47f3058dd9339c091bdfff25b681721bc12a3164
4
- data.tar.gz: 170601572b1f0fabc104e9d3dc847b72735d520c
3
+ metadata.gz: d528317f3613b805a7a2fda9e0050f3cc1742509
4
+ data.tar.gz: c494dd3ce0a54764c8b705df31b46627a3b2bc35
5
5
  SHA512:
6
- metadata.gz: a580d56638b1efafa8aadd7341f1ea45a959043b9eae32de525ab773f9d5d6e9da7b627206282a350600709591e4c4b9ac485fe1d627e259d5f33dc0d0e96ded
7
- data.tar.gz: a4c26e95726386820c49f42429555bfaef6546ffe2f596257a114b04597dbb32b61865289cd60b8f1d3bdeecbbf6a31f628386bf614e5bed8d37e82a2764f3b0
6
+ metadata.gz: caefd1b0d95cffc7e937ac6b1038a3973f8f1e332d3685090aa427c8f2fac584c07b9a1e8226fd45ce00343e3957d56d8b4f0b534b93bdafdd5c7edc0c34f73d
7
+ data.tar.gz: 2bfcf0d7db14de250343f23b7862eb7f13ec1b0cf89629d5fabbbece99b8c68d998364e04eff3ab17f0c3f35b3cdde0c46df701988cc35696af837f31b7d4c64
@@ -56,38 +56,27 @@ module Xlogin
56
56
  end
57
57
 
58
58
  def invoke
59
+ buffer = StringIO.new
59
60
  loggers = []
61
+ loggers << buffer if Rake.application.options.always_multitask
62
+ loggers << $stdout unless Rake.application.options.always_multitask || silent
60
63
 
61
64
  if log
62
65
  mkdir_p(File.dirname(log), verbose: Rake.application.options.trace)
63
66
  loggers << log
64
67
  end
65
68
 
66
- if Rake.application.options.always_multitask
67
- buffer = StringIO.new
68
- loggers << buffer unless silent
69
-
70
- begin
71
- session = Xlogin.factory.build_from_hostname(name, log: loggers)
72
- @runner.call(session)
73
- session.close if session
74
- lines = buffer.string.lines.map { |line| "#{name}\t" + line.gsub("\r", '') }
75
- lines.each { |line| $stdout.print line.chomp + "\n" }
76
- rescue => e
77
- lines = buffer.string.lines.map { |line| "#{name}\t" + line.gsub("\r", '') }
78
- lines.each { |line| $stdout.print line.chomp + "\n" }
79
- $stderr.print "#{name}\t#{e}\n"
80
- end
81
- else
82
- loggers << $stdout unless silent
69
+ begin
70
+ session = Xlogin.factory.build_from_hostname(name, log: loggers)
71
+ @runner.call(session)
72
+ session.close if session
73
+ rescue => e
74
+ $stderr.print "#{name}\t#{e}\n"
75
+ end
83
76
 
84
- begin
85
- session = Xlogin.factory.build_from_hostname(name, log: loggers)
86
- @runner.call(session)
87
- session.close if session
88
- rescue => e
89
- $stderr.print "#{e}\n"
90
- end
77
+ if Rake.application.options.always_multitask && not silent
78
+ lines = buffer.string.lines.map { |line| "#{name}\t" + line.gsub("\r", '') }
79
+ lines.each { |line| $stdout.print "#{line.chomp}\n" }
91
80
  end
92
81
  end
93
82
 
@@ -55,8 +55,7 @@ module Xlogin
55
55
  end
56
56
 
57
57
  def exec(*args)
58
- resp = cmd(*args)
59
- yield resp if block_given?
58
+ cmd(*args).tap { |resp| yield resp if block_given? }
60
59
  end
61
60
 
62
61
  def puts(line, &block)
@@ -1,3 +1,3 @@
1
1
  module Xlogin
2
- VERSION = "0.6.21"
2
+ VERSION = "0.6.22"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xlogin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.21
4
+ version: 0.6.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - haccht