Move Environment#command_to_s to Util.

This commit is contained in:
Josh Holtrop 2019-02-10 21:16:56 -05:00
parent 3f8b4d616f
commit db788cdd35
2 changed files with 13 additions and 13 deletions

View File

@ -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<String>]
# 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]

View File

@ -15,6 +15,17 @@ module Rscons
end
end
# Return a string representation of a command.
#
# @param command [Array<String>]
# 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]