hocho 0.3.6 → 0.3.7

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: fc1d89aba4bdb301b19444dc5d87cbe529b75cd7fd2a5862af8a0e0eee0f06c9
4
- data.tar.gz: a1e4308126d79cb3b4365c0dda2737ff2c57ca1f9a71ff74ba86948a0d4e4ab7
3
+ metadata.gz: 2f5398ffdb759cbfa7f06c5d388d5fa4b5455e81229f7546a302f9a97d9aeb8d
4
+ data.tar.gz: d07ddf5a3b23e81ba9b9d2eda67a909c3a4e84bd2a60a69bffcd682cad7db1e2
5
5
  SHA512:
6
- metadata.gz: e9a5930caf9ce31ba052af069126bb6230b275ab007c00a0edbaf08a8d30fc0b4135aeae57899ebc8428a068a0f7221dd4249f1fa6af240830fb98b045aaeef5
7
- data.tar.gz: 89d2ac75f09f14d2e569a7a229cfa61a625dbda5e1da6d035d54ac240d9cb78fd6272a85cc686166004404994a98384b1e6466d86ee349ab4d28270ad33c5e45
6
+ metadata.gz: 7e41c1eaa65f335385d5dead37cd1784500576f4ad3dfbb39e316771d28517b909097fafa687799e80067d2568a83ada90baa1db2e9030c3bcc6ddaca30020da
7
+ data.tar.gz: fdb35fd1103394c48602a766db80bcc90bec1777fb6d62dc562aebf0be2dfe6f73e3af6618679547d91ab92a07626a0e8c1616033e28f32e7017f5aa72deb31f
@@ -109,30 +109,36 @@ module Hocho
109
109
  end
110
110
 
111
111
  def set_ssh_output_hook(c)
112
- outbuf, errbuf = [], []
113
- check = ->(prefix,data,buf) do
114
- has_newline = data.include?("\n")
112
+ check = ->(prefix, data, buf) do
113
+ data = buf + data unless buf.empty?
114
+ return if data.empty?
115
+
115
116
  lines = data.lines
116
- last = lines.pop
117
- if last[-1] == "\n"
118
- buf << last
119
- end
120
- if has_newline
121
- (buf+lines).join.each_line do |line|
122
- puts "#{prefix} #{line}"
123
- end
124
- buf.replace([])
117
+
118
+ # If data is not NL-terminated, its last line is carried over to next check.call
119
+ if lines.last.end_with?("\n")
120
+ buf.clear
121
+ else
122
+ buf.replace(lines.pop)
125
123
  end
126
- if last[-1] != "\n"
127
- buf << last
124
+
125
+ lines.each do |line|
126
+ puts "#{prefix}#{line}"
128
127
  end
129
128
  end
130
129
 
130
+ outbuf, errbuf = +"", +""
131
+ outpre, errpre = "[#{host.name}] ", "[#{host.name}/ERR] "
132
+
131
133
  c.on_data do |c, data|
132
- check.call "[#{host.name}] ", data, outbuf
134
+ check.call outpre, data, outbuf
133
135
  end
134
136
  c.on_extended_data do |c, _, data|
135
- check.call "[#{host.name}/ERR] ", data, errbuf
137
+ check.call errpre, data, errbuf
138
+ end
139
+ c.on_close do
140
+ puts "#{outpre}#{outbuf}" unless outbuf.empty?
141
+ puts "#{errpre}#{errbuf}" unless errbuf.empty?
136
142
  end
137
143
  end
138
144
 
@@ -107,7 +107,7 @@ module Hocho
107
107
  when :encryption
108
108
  [["Ciphers", [*value].join(?,)]]
109
109
  when :compression
110
- [["Compression", value]]
110
+ [["Compression", value ? 'yes' : 'no']]
111
111
  when :compression_level
112
112
  [["CompressionLevel", value]]
113
113
  when :timeout
@@ -1,3 +1,3 @@
1
1
  module Hocho
2
- VERSION = "0.3.6"
2
+ VERSION = "0.3.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hocho
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - sorah (Shota Fukumori)
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-25 00:00:00.000000000 Z
11
+ date: 2020-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -108,7 +108,7 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
- description:
111
+ description:
112
112
  email:
113
113
  - her@sorah.jp
114
114
  executables:
@@ -153,7 +153,7 @@ homepage: https://github.com/sorah/hocho
153
153
  licenses:
154
154
  - MIT
155
155
  metadata: {}
156
- post_install_message:
156
+ post_install_message:
157
157
  rdoc_options: []
158
158
  require_paths:
159
159
  - lib
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  version: '0'
170
170
  requirements: []
171
171
  rubygems_version: 3.1.2
172
- signing_key:
172
+ signing_key:
173
173
  specification_version: 4
174
174
  summary: Server provisioning tool with itamae
175
175
  test_files: []