From a62a987935c3d1d9a35339e0c9e241617cb53132 Mon Sep 17 00:00:00 2001 From: Steven Davidovitz Date: Wed, 9 Dec 2015 14:59:10 -0800 Subject: [PATCH 1/2] Formatters::Pretty: display command being run for unmapped commands --- lib/sshkit/command.rb | 6 +++++- test/unit/backends/test_printer.rb | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/sshkit/command.rb b/lib/sshkit/command.rb index d3787d30..c29fb4a1 100644 --- a/lib/sshkit/command.rb +++ b/lib/sshkit/command.rb @@ -206,7 +206,11 @@ def to_command end def to_s - [SSHKit.config.command_map[command.to_sym], *Array(args)].join(' ') + if should_map? + [SSHKit.config.command_map[command.to_sym], *Array(args)].join(' ') + else + command.to_s + end end private diff --git a/test/unit/backends/test_printer.rb b/test/unit/backends/test_printer.rb index 8b966a1c..9f6d86de 100644 --- a/test/unit/backends/test_printer.rb +++ b/test/unit/backends/test_printer.rb @@ -22,7 +22,7 @@ def printer def test_execute printer.execute 'uname -a' assert_output_lines( - ' INFO [aaaaaa] Running /usr/bin/env uname -a on example.com', + ' INFO [aaaaaa] Running uname -a on example.com', ' DEBUG [aaaaaa] Command: uname -a' ) end @@ -31,7 +31,7 @@ def test_test_method printer.test '[ -d /some/file ]' assert_output_lines( - ' DEBUG [aaaaaa] Running /usr/bin/env [ -d /some/file ] on example.com', + ' DEBUG [aaaaaa] Running [ -d /some/file ] on example.com', ' DEBUG [aaaaaa] Command: [ -d /some/file ]' ) end @@ -42,7 +42,7 @@ def test_capture assert_equal '', result assert_output_lines( - ' DEBUG [aaaaaa] Running /usr/bin/env ls -l on example.com', + ' DEBUG [aaaaaa] Running ls -l on example.com', ' DEBUG [aaaaaa] Command: ls -l' ) end @@ -70,4 +70,4 @@ def assert_output_lines(*expected_lines) end end end -end \ No newline at end of file +end From 4535179896fd7ee7780e5d09628beb2f422e8fd9 Mon Sep 17 00:00:00 2001 From: Steven Davidovitz Date: Wed, 9 Dec 2015 15:08:12 -0800 Subject: [PATCH 2/2] add changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3aed2f6..dd40af34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ appear at the top. * make sure working directory for commands is properly cleared after `within` blocks [PR #307](https://github.com/capistrano/sshkit/pull/307) @steved + * display more accurate string for commands with spaces being output in `Formatter::Pretty` + [PR #304](https://github.com/capistrano/sshkit/pull/304) + @steved ## 1.8.1