diff --git a/lib/rscons/environment.rb b/lib/rscons/environment.rb index 8ef8070..47af51d 100644 --- a/lib/rscons/environment.rb +++ b/lib/rscons/environment.rb @@ -644,7 +644,7 @@ module Rscons case @echo when :command if command.is_a?(Array) - message = command_to_s(command) + message = Util.command_to_s(command) elsif command.is_a?(String) message = command elsif short_description.is_a?(String) @@ -663,7 +663,7 @@ module Rscons # # @return [void] def print_failed_command(command) - Ansi.write($stdout, :red, "Failed command was: #{command_to_s(command)}", :reset, "\n") + Ansi.write($stdout, :red, "Failed command was: #{Util.command_to_s(command)}", :reset, "\n") end private @@ -752,17 +752,6 @@ module Rscons end end - # Return a string representation of a command. - # - # @param command [Array] - # The command. - # - # @return [String] - # The string representation of the command. - def command_to_s(command) - command.map { |c| c =~ /\s/ ? "'#{c}'" : c }.join(' ') - end - # Call a builder's #finalize method after a ThreadedCommand terminates. # # @param tc [ThreadedCommand] diff --git a/lib/rscons/util.rb b/lib/rscons/util.rb index 3326b5d..340c970 100644 --- a/lib/rscons/util.rb +++ b/lib/rscons/util.rb @@ -15,6 +15,17 @@ module Rscons end end + # Return a string representation of a command. + # + # @param command [Array] + # The command. + # + # @return [String] + # The string representation of the command. + def command_to_s(command) + command.map { |c| c =~ /\s/ ? "'#{c}'" : c }.join(' ') + end + # Make a relative path corresponding to a possibly absolute one. # # @param path [String]