hotdog 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hotdog/commands/pssh.rb +2 -3
- data/lib/hotdog/commands/ssh.rb +23 -7
- data/lib/hotdog/commands/version.rb +16 -0
- data/lib/hotdog/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5b7de644e20c6baece23e0cfb092c648f450e86
|
4
|
+
data.tar.gz: 5e12b97c01d76aa8b9a7d5ede0cf5fe3371dda3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 390fcdb204d802c1ed9a49e7657233d6d2581d7b910c22d5370ffa722d934ba9dc4aacc1b199a525694962bc435c2ded7d9bf7d9056c3e51ed6ad959cb58366c
|
7
|
+
data.tar.gz: 42fe7102b0c6cb9564fbdc1acb3f7dd739bacc1d59d7b7e82c7ad8391d71bb46007ea4386d76a228adc163b5fdc40ac0ef58e8422e3ac541d4e6b5fb30163cc2
|
data/lib/hotdog/commands/pssh.rb
CHANGED
@@ -11,10 +11,9 @@ module Hotdog
|
|
11
11
|
class Pssh < SshAlike
|
12
12
|
private
|
13
13
|
def run_main(hosts, options={})
|
14
|
-
|
15
|
-
stats = Parallel.map(hosts, in_threads: parallelism(hosts)) { |host|
|
14
|
+
stats = Parallel.map(hosts.each_with_index.to_a, in_threads: parallelism(hosts)) { |host, i|
|
16
15
|
cmdline = build_command_string(host, @remote_command, options)
|
17
|
-
exec_command(host, cmdline,
|
16
|
+
exec_command(host, cmdline, index: i, output: true)
|
18
17
|
}
|
19
18
|
if stats.all?
|
20
19
|
exit(0)
|
data/lib/hotdog/commands/ssh.rb
CHANGED
@@ -74,10 +74,9 @@ module Hotdog
|
|
74
74
|
|
75
75
|
def filter_hosts(hosts)
|
76
76
|
if options[:filter_command]
|
77
|
-
use_color_p = use_color?
|
78
77
|
filtered_hosts = Parallel.map(hosts, in_threads: parallelism(hosts)) { |host|
|
79
78
|
cmdline = build_command_string(host, options[:filter_command], options)
|
80
|
-
[host, exec_command(host, cmdline, false
|
79
|
+
[host, exec_command(host, cmdline, output: false)]
|
81
80
|
}.select { |host, stat|
|
82
81
|
stat
|
83
82
|
}.map { |host, stat|
|
@@ -148,15 +147,32 @@ module Hotdog
|
|
148
147
|
end
|
149
148
|
end
|
150
149
|
|
151
|
-
def exec_command(identifier, cmdline,
|
150
|
+
def exec_command(identifier, cmdline, options={})
|
151
|
+
output = options.fetch(:output, true)
|
152
152
|
logger.debug("execute: #{cmdline}")
|
153
|
+
if use_color?
|
154
|
+
if options.key?(:index)
|
155
|
+
color = 31 + (options[:index] % 6)
|
156
|
+
else
|
157
|
+
color = 36
|
158
|
+
end
|
159
|
+
else
|
160
|
+
color = nil
|
161
|
+
end
|
153
162
|
IO.popen(cmdline, in: :close, err: [:child, :out]) do |io|
|
154
163
|
io.each_with_index do |s, i|
|
155
164
|
if output
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
STDOUT.write(
|
165
|
+
if color
|
166
|
+
STDOUT.write("\e[0;#{color}m")
|
167
|
+
end
|
168
|
+
STDOUT.write(identifier)
|
169
|
+
STDOUT.write(":")
|
170
|
+
STDOUT.write(i.to_s)
|
171
|
+
STDOUT.write(":")
|
172
|
+
if color
|
173
|
+
STDOUT.write("\e[0m")
|
174
|
+
end
|
175
|
+
STDOUT.puts(s)
|
160
176
|
end
|
161
177
|
end
|
162
178
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "rbconfig"
|
4
|
+
|
5
|
+
module Hotdog
|
6
|
+
module Commands
|
7
|
+
class Version < BaseCommand
|
8
|
+
def run(args=[], options={})
|
9
|
+
ruby = File.join(RbConfig::CONFIG["bindir"], RbConfig::CONFIG["ruby_install_name"])
|
10
|
+
exit(system(ruby, $0, "--version") ? 0 : 1)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# vim:set ft=ruby :
|
data/lib/hotdog/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hotdog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yamashita Yuu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -163,6 +163,7 @@ files:
|
|
163
163
|
- lib/hotdog/commands/ssh.rb
|
164
164
|
- lib/hotdog/commands/tags.rb
|
165
165
|
- lib/hotdog/commands/up.rb
|
166
|
+
- lib/hotdog/commands/version.rb
|
166
167
|
- lib/hotdog/formatters.rb
|
167
168
|
- lib/hotdog/formatters/csv.rb
|
168
169
|
- lib/hotdog/formatters/json.rb
|
@@ -213,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
213
214
|
version: '0'
|
214
215
|
requirements: []
|
215
216
|
rubyforge_project:
|
216
|
-
rubygems_version: 2.4.5
|
217
|
+
rubygems_version: 2.4.5.1
|
217
218
|
signing_key:
|
218
219
|
specification_version: 4
|
219
220
|
summary: Yet another command-line tool for Datadog
|
@@ -239,4 +240,3 @@ test_files:
|
|
239
240
|
- spec/parser/regexp_expression_spec.rb
|
240
241
|
- spec/parser/string_expression_spec.rb
|
241
242
|
- spec/spec_helper.rb
|
242
|
-
has_rdoc:
|