aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rake/trace_output.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-29 19:16:46 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-29 19:16:46 +0000
commitd1d4490a57413ff5cb7e8bd0274bb34c7da68d29 (patch)
tree70596346a7f5f13d846cda7353fb8474baf4ad7e /lib/rake/trace_output.rb
parent40bae2f67c1160e1e59018c1003d014c60d1ee47 (diff)
downloadruby-d1d4490a57413ff5cb7e8bd0274bb34c7da68d29.tar.gz
* lib/rake/*: Updated to rake 0.9.5
* test/rake/*: ditto. * NEWS: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rake/trace_output.rb')
-rw-r--r--lib/rake/trace_output.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/rake/trace_output.rb b/lib/rake/trace_output.rb
new file mode 100644
index 0000000000..e4d61cfb93
--- /dev/null
+++ b/lib/rake/trace_output.rb
@@ -0,0 +1,19 @@
+module Rake
+ module TraceOutput
+
+ # Write trace output to output stream +out+.
+ #
+ # The write is done as a single IO call (to print) to lessen the
+ # chance that the trace output is interrupted by other tasks also
+ # producing output.
+ def trace_on(out, *strings)
+ sep = $\ || "\n"
+ if strings.empty?
+ output = sep
+ else
+ output = strings.map { |s| s.end_with?(sep) ? s : s + sep }.join
+ end
+ out.print(output)
+ end
+ end
+end