sshkit 1.5.1 → 1.6.1
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/CHANGELOG.md +14 -0
- data/EXAMPLES.md +2 -2
- data/README.md +9 -1
- data/Rakefile +5 -9
- data/Vagrantfile +6 -1
- data/lib/sshkit/backends/local.rb +1 -1
- data/lib/sshkit/backends/netssh.rb +6 -1
- data/lib/sshkit/color.rb +21 -7
- data/lib/sshkit/command.rb +5 -1
- data/lib/sshkit/command_map.rb +2 -1
- data/lib/sshkit/formatters/pretty.rb +11 -6
- data/lib/sshkit/formatters/simple_text.rb +1 -1
- data/lib/sshkit/runners/parallel.rb +1 -1
- data/lib/sshkit/runners/sequential.rb +14 -6
- data/lib/sshkit/version.rb +1 -1
- data/sshkit.gemspec +3 -3
- data/test/functional/backends/test_local.rb +1 -1
- data/test/unit/backends/test_netssh.rb +9 -6
- data/test/unit/formatters/test_pretty.rb +5 -5
- data/test/unit/test_color.rb +16 -0
- data/test/unit/test_command.rb +6 -0
- data/test/unit/test_command_map.rb +8 -0
- data/test/unit/test_coordinator.rb +12 -10
- metadata +30 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6b3d2a602578d1cea808691cd6a94345862e87e
|
4
|
+
data.tar.gz: 1f7d65fb072bb2c9e6fd830d49bfa354cf756296
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e0f22c3b4b0bf6e6af4bafc7d3d610c216fea810aebd29ab689819d3953da77f4aa3c5ea599453997f85b5f5bec5fae8fd629c370968a87580755bd23f6044b
|
7
|
+
data.tar.gz: c789d68ad2b9025a694dd41b58b55640d55443252729bdbbd7d8460419e5fbe9670fde840b437cf2416380a1e19c28613ddd92c1b55d5a27ae0f8fa1c47a5dc8
|
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,20 @@ appear at the top.
|
|
8
8
|
* Add your entries here, remember to credit yourself however you want to be
|
9
9
|
credited!
|
10
10
|
|
11
|
+
## 1.6.0
|
12
|
+
|
13
|
+
* Fix colorize to use the correct API (@fazibear)
|
14
|
+
* Lock colorize (sorry guys) version at >= 0.7.0
|
15
|
+
|
16
|
+
## 1.6.0 (Yanked, because of colorize.)
|
17
|
+
|
18
|
+
* Force dependency on colorize v0.6.0
|
19
|
+
* Add your entries here, remember to credit yourself however you want to be
|
20
|
+
credited!
|
21
|
+
* Remove strip from capture to preserve whitespace. Nick Townsend
|
22
|
+
* Add vmware_fusion Vagrant provider. Nick Townsend
|
23
|
+
* Add some padding to the pretty log formatter
|
24
|
+
|
11
25
|
## 1.5.1
|
12
26
|
|
13
27
|
* Use `sudo -u` rather than `sudo su` to switch users. Mat Trudel
|
data/EXAMPLES.md
CHANGED
@@ -103,7 +103,7 @@ etc, this will be improved as the library matures, but we're not there yet.
|
|
103
103
|
end
|
104
104
|
|
105
105
|
In this case the `recursive: true` option mirrors the same options which are
|
106
|
-
available to `Net::{SCP,SFTP}
|
106
|
+
available to [`Net::{SCP,SFTP}`](http://net-ssh.github.io/net-scp/).
|
107
107
|
|
108
108
|
## Setting global SSH options
|
109
109
|
|
@@ -198,7 +198,7 @@ joined according to the expectations of the machine receiving the commands.
|
|
198
198
|
execute!(:echo, '"Example Message!" 1>&2; false')
|
199
199
|
end
|
200
200
|
|
201
|
-
This will raise `SSHKit::Command
|
201
|
+
This will raise `SSHKit::Command::Failed` with the `#message` "Example Message!"
|
202
202
|
which will cause the command to abort.
|
203
203
|
|
204
204
|
## Make a test, or run a command which may fail without raising an error:
|
data/README.md
CHANGED
@@ -89,7 +89,7 @@ site_dir = '/opt/sites/example.com'
|
|
89
89
|
# Let's simulate a backup task, assuming that some servers take longer
|
90
90
|
# then others to complete
|
91
91
|
on all_servers do |host|
|
92
|
-
|
92
|
+
within site_dir do
|
93
93
|
execute :tar, '-czf', "backup-#{host.hostname}.tar.gz", 'current'
|
94
94
|
# Will run: "/usr/bin/env tar -czf backup-one.example.com.tar.gz current"
|
95
95
|
end
|
@@ -248,3 +248,11 @@ pooling behaviour entirely by setting the idle_timeout to zero:
|
|
248
248
|
```ruby
|
249
249
|
SSHKit::Backend::Netssh.pool.idle_timeout = 0 # disabled
|
250
250
|
```
|
251
|
+
|
252
|
+
## SSHKit Related Blog Posts
|
253
|
+
|
254
|
+
[SSHKit Gem Basics](http://www.rubyplus.com/articles/591)
|
255
|
+
|
256
|
+
[SSHKit Gem Part 2](http://www.rubyplus.com/articles/601)
|
257
|
+
|
258
|
+
[Embedded Capistrano with SSHKit](http://ryandoyle.net/posts/embedded-capistrano-with-sshkit/)
|
data/Rakefile
CHANGED
@@ -3,6 +3,11 @@
|
|
3
3
|
require 'bundler/gem_tasks'
|
4
4
|
require 'rake/testtask'
|
5
5
|
|
6
|
+
task :default => :test
|
7
|
+
|
8
|
+
desc "Run all tests"
|
9
|
+
task :test => ['test:units', 'test:functional']
|
10
|
+
|
6
11
|
namespace :test do
|
7
12
|
|
8
13
|
Rake::TestTask.new(:units) do |t|
|
@@ -15,17 +20,8 @@ namespace :test do
|
|
15
20
|
t.test_files = FileList['test/functional/**/test*.rb']
|
16
21
|
end
|
17
22
|
|
18
|
-
task :test do
|
19
|
-
Rake::Task['test:units'].execute
|
20
|
-
Rake::Task['test:functional'].execute
|
21
|
-
end
|
22
|
-
|
23
|
-
task default: :test
|
24
|
-
|
25
23
|
end
|
26
24
|
|
27
|
-
task :default => 'test:default'
|
28
|
-
|
29
25
|
Rake::Task["test:functional"].enhance do
|
30
26
|
warn "Remember there are still some VMs running, kill them with `vagrant halt` if you are finished using them."
|
31
27
|
end
|
data/Vagrantfile
CHANGED
@@ -2,7 +2,12 @@ VAGRANTFILE_API_VERSION = "2"
|
|
2
2
|
|
3
3
|
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
4
4
|
config.vm.box = 'precise64'
|
5
|
-
config.vm.
|
5
|
+
config.vm.provider "vmware_fusion" do |vmf|
|
6
|
+
vmf.box_url = "http://files.vagrantup.com/precise64_vmware.box"
|
7
|
+
end
|
8
|
+
config.vm.provider "virtualbox" do |vb|
|
9
|
+
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
|
10
|
+
end
|
6
11
|
|
7
12
|
json_config_path = File.join("test", "boxes.json")
|
8
13
|
list = File.open(json_config_path).read
|
@@ -108,12 +108,17 @@ module SSHKit
|
|
108
108
|
private
|
109
109
|
|
110
110
|
def transfer_summarizer(action)
|
111
|
+
last_name = nil
|
112
|
+
last_percentage = nil
|
111
113
|
proc do |ch, name, transferred, total|
|
112
114
|
percentage = (transferred.to_f * 100 / total.to_f)
|
113
115
|
unless percentage.nan?
|
114
116
|
message = "#{action} #{name} #{percentage.round(2)}%"
|
115
|
-
|
117
|
+
percentage_r = (percentage / 10).truncate * 10
|
118
|
+
if percentage_r > 0 && (last_name != name || last_percentage != percentage_r)
|
116
119
|
info message
|
120
|
+
last_name = name
|
121
|
+
last_percentage = percentage_r
|
117
122
|
else
|
118
123
|
debug message
|
119
124
|
end
|
data/lib/sshkit/color.rb
CHANGED
@@ -1,13 +1,27 @@
|
|
1
1
|
require 'colorize'
|
2
|
+
|
2
3
|
module Color
|
3
|
-
|
4
|
+
String.colors.each do |color|
|
5
|
+
instance_eval <<-RUBY, __FILE__, __LINE__
|
6
|
+
def #{color}(string = '')
|
7
|
+
string = yield if block_given?
|
8
|
+
colorize? ? string.colorize(:color => :#{color}) : string
|
9
|
+
end
|
10
|
+
RUBY
|
11
|
+
end
|
12
|
+
|
13
|
+
String.modes.each do |mode|
|
14
|
+
instance_eval <<-RUBY, __FILE__, __LINE__
|
15
|
+
def #{mode}(string = '')
|
16
|
+
string = yield if block_given?
|
17
|
+
colorize? ? string.colorize(:mode => :#{mode}) : string
|
18
|
+
end
|
19
|
+
RUBY
|
20
|
+
end
|
4
21
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
string = yield if block_given?
|
9
|
-
$stdout.tty? ? string.colorize(:#{style}) : string
|
22
|
+
class << self
|
23
|
+
def colorize?
|
24
|
+
ENV['SSHKIT_COLOR'] || $stdout.tty?
|
10
25
|
end
|
11
|
-
}
|
12
26
|
end
|
13
27
|
end
|
data/lib/sshkit/command.rb
CHANGED
@@ -152,7 +152,11 @@ module SSHKit
|
|
152
152
|
|
153
153
|
def environment_string
|
154
154
|
environment_hash.collect do |key,value|
|
155
|
-
|
155
|
+
if key.is_a? Symbol
|
156
|
+
"#{key.to_s.upcase}=#{value}"
|
157
|
+
else
|
158
|
+
"#{key.to_s}=#{value}"
|
159
|
+
end
|
156
160
|
end.join(' ')
|
157
161
|
end
|
158
162
|
|
data/lib/sshkit/command_map.rb
CHANGED
@@ -39,7 +39,8 @@ module SSHKit
|
|
39
39
|
|
40
40
|
def [](command)
|
41
41
|
if prefix[command].any?
|
42
|
-
prefixes = prefix[command].
|
42
|
+
prefixes = prefix[command].map{ |prefix| prefix.respond_to?(:call) ? prefix.call : prefix }
|
43
|
+
prefixes = prefixes.join(" ")
|
43
44
|
|
44
45
|
"#{prefixes} #{command}"
|
45
46
|
else
|
@@ -19,35 +19,40 @@ module SSHKit
|
|
19
19
|
|
20
20
|
def write_command(command)
|
21
21
|
unless command.started?
|
22
|
-
original_output <<
|
22
|
+
original_output << "%6s %s\n" % [level(command.verbosity),
|
23
|
+
uuid(command) + "Running #{c.yellow(c.bold(String(command)))} #{command.host.user ? "as #{c.blue(command.host.user)}@" : "on "}#{c.blue(command.host.to_s)}"]
|
23
24
|
if SSHKit.config.output_verbosity == Logger::DEBUG
|
24
|
-
original_output << level(Logger::DEBUG)
|
25
|
+
original_output << "%6s %s\n" % [level(Logger::DEBUG),
|
26
|
+
uuid(command) + "Command: #{c.blue(command.to_command)}"]
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
28
30
|
if SSHKit.config.output_verbosity == Logger::DEBUG
|
29
31
|
unless command.stdout.empty?
|
30
32
|
command.stdout.lines.each do |line|
|
31
|
-
original_output << level(Logger::DEBUG)
|
33
|
+
original_output << "%6s %s" % [level(Logger::DEBUG),
|
34
|
+
uuid(command) + c.green("\t" + line)]
|
32
35
|
original_output << "\n" unless line[-1] == "\n"
|
33
36
|
end
|
34
37
|
end
|
35
38
|
|
36
39
|
unless command.stderr.empty?
|
37
40
|
command.stderr.lines.each do |line|
|
38
|
-
original_output << level(Logger::DEBUG)
|
41
|
+
original_output << "%6s %s" % [level(Logger::DEBUG),
|
42
|
+
uuid(command) + c.red("\t" + line)]
|
39
43
|
original_output << "\n" unless line[-1] == "\n"
|
40
44
|
end
|
41
45
|
end
|
42
46
|
end
|
43
47
|
|
44
48
|
if command.finished?
|
45
|
-
original_output <<
|
49
|
+
original_output << "%6s %s\n" % [level(command.verbosity),
|
50
|
+
uuid(command) + "Finished in #{sprintf('%5.3f seconds', command.runtime)} with exit status #{command.exit_status} (#{c.bold { command.failure? ? c.red('failed') : c.green('successful') }})."]
|
46
51
|
end
|
47
52
|
end
|
48
53
|
|
49
54
|
def write_log_message(log_message)
|
50
|
-
original_output << level(log_message.verbosity)
|
55
|
+
original_output << "%6s %s\n" % [level(log_message.verbosity), log_message.to_s]
|
51
56
|
end
|
52
57
|
|
53
58
|
def c
|
@@ -20,7 +20,7 @@ module SSHKit
|
|
20
20
|
|
21
21
|
def write_command(command)
|
22
22
|
unless command.started?
|
23
|
-
original_output << "Running #{String(command)}
|
23
|
+
original_output << "Running #{String(command)} #{command.host.user ? "as #{command.host.user}@" : "on "}#{command.host}\n"
|
24
24
|
if SSHKit.config.output_verbosity == Logger::DEBUG
|
25
25
|
original_output << "Command: #{command.to_command}" + "\n"
|
26
26
|
end
|
@@ -13,7 +13,7 @@ module SSHKit
|
|
13
13
|
backend(h, &block).run
|
14
14
|
rescue Exception => e
|
15
15
|
e2 = ExecuteError.new e
|
16
|
-
raise e2, "Exception while executing on host #{host}: #{e.message}"
|
16
|
+
raise e2, "Exception while executing #{host.user ? "as #{host.user}@" : "on host "}#{host}: #{e.message}"
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -5,17 +5,25 @@ module SSHKit
|
|
5
5
|
class Sequential < Abstract
|
6
6
|
attr_writer :wait_interval
|
7
7
|
def execute
|
8
|
+
last_host = hosts.pop
|
9
|
+
|
8
10
|
hosts.each do |host|
|
9
|
-
|
10
|
-
backend(host, &block).run
|
11
|
-
rescue Exception => e
|
12
|
-
e2 = ExecuteError.new e
|
13
|
-
raise e2, "Exception while executing on host #{host}: #{e.message}"
|
14
|
-
end
|
11
|
+
run_backend(host, &block)
|
15
12
|
sleep wait_interval
|
16
13
|
end
|
14
|
+
|
15
|
+
unless last_host.nil?
|
16
|
+
run_backend(last_host, &block)
|
17
|
+
end
|
17
18
|
end
|
18
19
|
private
|
20
|
+
def run_backend(host, &block)
|
21
|
+
backend(host, &block).run
|
22
|
+
rescue Exception => e
|
23
|
+
e2 = ExecuteError.new e
|
24
|
+
raise e2, "Exception while executing #{host.user ? "as #{host.user}@" : "on host "}#{host}: #{e.message}"
|
25
|
+
end
|
26
|
+
|
19
27
|
def wait_interval
|
20
28
|
@wait_interval || options[:wait] || 2
|
21
29
|
end
|
data/lib/sshkit/version.rb
CHANGED
data/sshkit.gemspec
CHANGED
@@ -17,9 +17,9 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.require_paths = ["lib"]
|
18
18
|
gem.version = SSHKit::VERSION
|
19
19
|
|
20
|
-
gem.add_runtime_dependency('net-ssh',
|
21
|
-
gem.add_runtime_dependency('net-scp',
|
22
|
-
gem.add_runtime_dependency('colorize')
|
20
|
+
gem.add_runtime_dependency('net-ssh', '>= 2.8.0')
|
21
|
+
gem.add_runtime_dependency('net-scp', '>= 1.1.2')
|
22
|
+
gem.add_runtime_dependency('colorize', '>= 0.7.0')
|
23
23
|
|
24
24
|
gem.add_development_dependency('minitest', ['>= 2.11.3', '< 2.12.0'])
|
25
25
|
gem.add_development_dependency('rake')
|
@@ -14,7 +14,7 @@ module SSHKit
|
|
14
14
|
Local.new do
|
15
15
|
captured_command_result = capture(:echo, 'foo')
|
16
16
|
end.run
|
17
|
-
assert_equal
|
17
|
+
assert_equal "foo\n", captured_command_result
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_execute_raises_on_non_zero_exit_status_and_captures_stdout_and_stderr
|
@@ -38,12 +38,15 @@ module SSHKit
|
|
38
38
|
summarizer = netssh.send(:transfer_summarizer,'Transferring')
|
39
39
|
|
40
40
|
[
|
41
|
-
[1,
|
42
|
-
[1,
|
43
|
-
[
|
44
|
-
[
|
45
|
-
[
|
46
|
-
[
|
41
|
+
[1, 1000, :debug, 'Transferring afile 0.1%'],
|
42
|
+
[1, 100, :debug, 'Transferring afile 1.0%'],
|
43
|
+
[99, 1000, :debug, 'Transferring afile 9.9%'],
|
44
|
+
[15, 100, :info, 'Transferring afile 15.0%'],
|
45
|
+
[1, 3, :info, 'Transferring afile 33.33%'],
|
46
|
+
[0, 1, :debug, 'Transferring afile 0.0%'],
|
47
|
+
[1, 2, :info, 'Transferring afile 50.0%'],
|
48
|
+
[0, 0, :warn, 'percentage 0/0'],
|
49
|
+
[1023, 343, :info, 'Transferring'],
|
47
50
|
].each do |transferred,total,method,substring|
|
48
51
|
netssh.expects(method).with { |msg| msg.include?(substring) }
|
49
52
|
summarizer.call(nil,'afile',transferred,total)
|
@@ -24,27 +24,27 @@ module SSHKit
|
|
24
24
|
|
25
25
|
def test_logging_fatal
|
26
26
|
pretty << SSHKit::LogMessage.new(Logger::FATAL, "Test")
|
27
|
-
assert_equal output.strip, "\e[0;31;49mFATAL\e[
|
27
|
+
assert_equal output.strip, "\e[0;31;49mFATAL\e[0m Test"
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_logging_error
|
31
31
|
pretty << SSHKit::LogMessage.new(Logger::ERROR, "Test")
|
32
|
-
assert_equal output.strip, "\e[0;31;49mERROR\e[
|
32
|
+
assert_equal output.strip, "\e[0;31;49mERROR\e[0m Test"
|
33
33
|
end
|
34
34
|
|
35
35
|
def test_logging_warn
|
36
36
|
pretty << SSHKit::LogMessage.new(Logger::WARN, "Test")
|
37
|
-
assert_equal output.strip, "\e[0;33;49mWARN\e[
|
37
|
+
assert_equal output.strip, "\e[0;33;49mWARN\e[0m Test".strip
|
38
38
|
end
|
39
39
|
|
40
40
|
def test_logging_info
|
41
41
|
pretty << SSHKit::LogMessage.new(Logger::INFO, "Test")
|
42
|
-
assert_equal output.strip, "\e[0;34;49mINFO\e[
|
42
|
+
assert_equal output.strip, "\e[0;34;49mINFO\e[0m Test".strip
|
43
43
|
end
|
44
44
|
|
45
45
|
def test_logging_debug
|
46
46
|
pretty << SSHKit::LogMessage.new(Logger::DEBUG, "Test")
|
47
|
-
assert_equal output.strip, "\e[0;30;49mDEBUG\e[
|
47
|
+
assert_equal output.strip, "\e[0;30;49mDEBUG\e[0m Test".strip
|
48
48
|
end
|
49
49
|
|
50
50
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'sshkit'
|
3
|
+
|
4
|
+
module SSHKit
|
5
|
+
class TestColor < UnitTest
|
6
|
+
|
7
|
+
def test_responds_to_colorize?
|
8
|
+
assert Color.respond_to?(:colorize?)
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_not_fails_on_bold_mode
|
12
|
+
Color.stubs(:colorize?).returns true
|
13
|
+
assert_equal Color.bold("test"), 'test'.bold
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/test/unit/test_command.rb
CHANGED
@@ -41,6 +41,12 @@ module SSHKit
|
|
41
41
|
assert_equal "( RAILS_ENV=production FOO=bar /usr/bin/env rails server )", c.to_command
|
42
42
|
end
|
43
43
|
|
44
|
+
def test_including_the_env_with_string_keys
|
45
|
+
SSHKit.config = nil
|
46
|
+
c = Command.new(:rails, 'server', env: {'FACTER_env' => :production, foo: 'bar'})
|
47
|
+
assert_equal "( FACTER_env=production FOO=bar /usr/bin/env rails server )", c.to_command
|
48
|
+
end
|
49
|
+
|
44
50
|
def test_including_the_env_doesnt_addressively_escape
|
45
51
|
SSHKit.config = nil
|
46
52
|
c = Command.new(:rails, 'server', env: {path: '/example:$PATH'})
|
@@ -28,6 +28,14 @@ module SSHKit
|
|
28
28
|
assert_equal map[:rake], "/home/vagrant/.rbenv/bin/rbenv exec bundle exec rake"
|
29
29
|
end
|
30
30
|
|
31
|
+
def test_prefix_procs
|
32
|
+
map = CommandMap.new
|
33
|
+
map.prefix[:rake].push("/home/vagrant/.rbenv/bin/rbenv exec")
|
34
|
+
map.prefix[:rake].push(proc{ "bundle exec" })
|
35
|
+
|
36
|
+
assert_equal map[:rake], "/home/vagrant/.rbenv/bin/rbenv exec bundle exec rake"
|
37
|
+
end
|
38
|
+
|
31
39
|
def test_prefix_unshift
|
32
40
|
map = CommandMap.new
|
33
41
|
map.prefix[:rake].push("bundle exec")
|
@@ -5,6 +5,8 @@ module SSHKit
|
|
5
5
|
|
6
6
|
class TestCoordinator < UnitTest
|
7
7
|
|
8
|
+
CloseEnough = 0.01; # 10 msec
|
9
|
+
|
8
10
|
def setup
|
9
11
|
super
|
10
12
|
@s = String.new
|
@@ -17,7 +19,7 @@ module SSHKit
|
|
17
19
|
|
18
20
|
def block_to_run
|
19
21
|
lambda do |host|
|
20
|
-
execute "echo #{Time.now}"
|
22
|
+
execute "echo #{Time.now.to_f}"
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
@@ -56,7 +58,7 @@ module SSHKit
|
|
56
58
|
Coordinator.new(%w{1.example.com 2.example.com}).each &block_to_run
|
57
59
|
end
|
58
60
|
assert_equal 2, results.length
|
59
|
-
|
61
|
+
assert_in_delta *results, CloseEnough
|
60
62
|
end
|
61
63
|
|
62
64
|
def test_the_connection_manager_can_run_things_in_sequence
|
@@ -64,7 +66,7 @@ module SSHKit
|
|
64
66
|
Coordinator.new(%w{1.example.com 2.example.com}).each in: :sequence, &block_to_run
|
65
67
|
end
|
66
68
|
assert_equal 2, results.length
|
67
|
-
assert_operator results.first
|
69
|
+
assert_operator (results.last - results.first), :>, 1.0
|
68
70
|
end
|
69
71
|
|
70
72
|
def test_the_connection_manager_can_run_things_in_sequence_with_wait
|
@@ -73,7 +75,7 @@ module SSHKit
|
|
73
75
|
Coordinator.new(%w{1.example.com 2.example.com}).each in: :sequence, wait: 10, &block_to_run
|
74
76
|
end
|
75
77
|
stop = Time.now
|
76
|
-
assert_operator (stop
|
78
|
+
assert_operator (stop - start), :>=, 10.0
|
77
79
|
end
|
78
80
|
|
79
81
|
def test_the_connection_manager_can_run_things_in_groups
|
@@ -90,18 +92,18 @@ module SSHKit
|
|
90
92
|
).each in: :groups, &block_to_run
|
91
93
|
end
|
92
94
|
assert_equal 6, results.length
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
assert_operator results[
|
97
|
-
assert_operator results[
|
95
|
+
assert_in_delta *results[0..1], CloseEnough
|
96
|
+
assert_in_delta *results[2..3], CloseEnough
|
97
|
+
assert_in_delta *results[4..5], CloseEnough
|
98
|
+
assert_operator (results[2] - results[1]), :>, 1.0
|
99
|
+
assert_operator (results[4] - results[3]), :>, 1.0
|
98
100
|
end
|
99
101
|
|
100
102
|
private
|
101
103
|
|
102
104
|
def results
|
103
105
|
@s.lines.collect do |line|
|
104
|
-
|
106
|
+
line.split(' ').last.to_f
|
105
107
|
end
|
106
108
|
end
|
107
109
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sshkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Hambley
|
@@ -9,124 +9,124 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-12-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-ssh
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: 2.8.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 2.8.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: net-scp
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: 1.1.2
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: 1.1.2
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: colorize
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
48
|
+
version: 0.7.0
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: 0.7.0
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: minitest
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: 2.11.3
|
63
|
-
- - <
|
63
|
+
- - "<"
|
64
64
|
- !ruby/object:Gem::Version
|
65
65
|
version: 2.12.0
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
68
|
version_requirements: !ruby/object:Gem::Requirement
|
69
69
|
requirements:
|
70
|
-
- -
|
70
|
+
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: 2.11.3
|
73
|
-
- - <
|
73
|
+
- - "<"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 2.12.0
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
77
|
name: rake
|
78
78
|
requirement: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
type: :development
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
- !ruby/object:Gem::Dependency
|
91
91
|
name: turn
|
92
92
|
requirement: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
type: :development
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
105
|
name: unindent
|
106
106
|
requirement: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
type: :development
|
112
112
|
prerelease: false
|
113
113
|
version_requirements: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
- !ruby/object:Gem::Dependency
|
119
119
|
name: mocha
|
120
120
|
requirement: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
type: :development
|
126
126
|
prerelease: false
|
127
127
|
version_requirements: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
description: A comprehensive toolkit for remotely running commands in a structured
|
@@ -138,9 +138,9 @@ executables: []
|
|
138
138
|
extensions: []
|
139
139
|
extra_rdoc_files: []
|
140
140
|
files:
|
141
|
-
- .gitignore
|
142
|
-
- .travis.yml
|
143
|
-
- .yardopts
|
141
|
+
- ".gitignore"
|
142
|
+
- ".travis.yml"
|
143
|
+
- ".yardopts"
|
144
144
|
- CHANGELOG.md
|
145
145
|
- CONTRIBUTING.md
|
146
146
|
- EXAMPLES.md
|
@@ -200,6 +200,7 @@ files:
|
|
200
200
|
- test/unit/core_ext/test_string.rb
|
201
201
|
- test/unit/formatters/test_dot.rb
|
202
202
|
- test/unit/formatters/test_pretty.rb
|
203
|
+
- test/unit/test_color.rb
|
203
204
|
- test/unit/test_command.rb
|
204
205
|
- test/unit/test_command_map.rb
|
205
206
|
- test/unit/test_configuration.rb
|
@@ -216,17 +217,17 @@ require_paths:
|
|
216
217
|
- lib
|
217
218
|
required_ruby_version: !ruby/object:Gem::Requirement
|
218
219
|
requirements:
|
219
|
-
- -
|
220
|
+
- - ">="
|
220
221
|
- !ruby/object:Gem::Version
|
221
222
|
version: '0'
|
222
223
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
224
|
requirements:
|
224
|
-
- -
|
225
|
+
- - ">="
|
225
226
|
- !ruby/object:Gem::Version
|
226
227
|
version: '0'
|
227
228
|
requirements: []
|
228
229
|
rubyforge_project:
|
229
|
-
rubygems_version: 2.
|
230
|
+
rubygems_version: 2.2.2
|
230
231
|
signing_key:
|
231
232
|
specification_version: 4
|
232
233
|
summary: SSHKit makes it easy to write structured, testable SSH commands in Ruby
|
@@ -245,10 +246,10 @@ test_files:
|
|
245
246
|
- test/unit/core_ext/test_string.rb
|
246
247
|
- test/unit/formatters/test_dot.rb
|
247
248
|
- test/unit/formatters/test_pretty.rb
|
249
|
+
- test/unit/test_color.rb
|
248
250
|
- test/unit/test_command.rb
|
249
251
|
- test/unit/test_command_map.rb
|
250
252
|
- test/unit/test_configuration.rb
|
251
253
|
- test/unit/test_coordinator.rb
|
252
254
|
- test/unit/test_host.rb
|
253
255
|
- test/unit/test_logger.rb
|
254
|
-
has_rdoc:
|