From d1d4490a57413ff5cb7e8bd0274bb34c7da68d29 Mon Sep 17 00:00:00 2001 From: drbrain Date: Thu, 29 Nov 2012 19:16:46 +0000 Subject: * 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 --- lib/rake.rb | 1 + lib/rake/application.rb | 12 +++++++----- lib/rake/file_list.rb | 2 +- lib/rake/task.rb | 15 ++++++++------- lib/rake/trace_output.rb | 19 +++++++++++++++++++ lib/rake/version.rb | 11 +++++++---- 6 files changed, 43 insertions(+), 17 deletions(-) create mode 100644 lib/rake/trace_output.rb (limited to 'lib') diff --git a/lib/rake.rb b/lib/rake.rb index 8180a5e996..fff13fe460 100644 --- a/lib/rake.rb +++ b/lib/rake.rb @@ -43,6 +43,7 @@ require 'rake/win32' require 'rake/task_argument_error' require 'rake/rule_recursion_overflow_error' require 'rake/rake_module' +require 'rake/trace_output' require 'rake/pseudo_status' require 'rake/task_arguments' require 'rake/invocation_chain' diff --git a/lib/rake/application.rb b/lib/rake/application.rb index 54796312d8..734e20ac31 100644 --- a/lib/rake/application.rb +++ b/lib/rake/application.rb @@ -5,6 +5,7 @@ require 'rake/task_manager' require 'rake/file_list' require 'rake/thread_pool' require 'rake/thread_history_display' +require 'rake/trace_output' require 'rake/win32' module Rake @@ -17,6 +18,7 @@ module Rake # class Application include TaskManager + include TraceOutput # The name of the application (typically 'rake') attr_reader :name @@ -176,7 +178,7 @@ module Rake if options.backtrace trace ex.backtrace.join("\n") else - trace Backtrace.collapse(ex.backtrace) + trace Backtrace.collapse(ex.backtrace).join("\n") end trace "Tasks: #{ex.chain}" if has_chain?(ex) trace "(See full trace by running task with --trace)" unless options.backtrace @@ -314,9 +316,9 @@ module Rake end end - def trace(*str) + def trace(*strings) options.trace_output ||= $stderr - options.trace_output.puts(*str) + trace_on(options.trace_output, *strings) end def sort_options(options) @@ -336,7 +338,7 @@ module Rake options.show_all_tasks = value } ], - ['--backtrace [OUT]', "Enable full backtrace. OUT can be stderr (default) or stdout.", + ['--backtrace=[OUT]', "Enable full backtrace. OUT can be stderr (default) or stdout.", lambda { |value| options.backtrace = true select_trace_output(options, 'backtrace', value) @@ -467,7 +469,7 @@ module Rake select_tasks_to_show(options, :tasks, value) } ], - ['--trace', '-t [OUT]', "Turn on invoke/execute tracing, enable full backtrace. OUT can be stderr (default) or stdout.", + ['--trace=[OUT]', '-t', "Turn on invoke/execute tracing, enable full backtrace. OUT can be stderr (default) or stdout.", lambda { |value| options.trace = true options.backtrace = true diff --git a/lib/rake/file_list.rb b/lib/rake/file_list.rb index b9b9d7216a..3eae5fb0d7 100644 --- a/lib/rake/file_list.rb +++ b/lib/rake/file_list.rb @@ -385,7 +385,7 @@ module Rake end # Get a sorted list of files matching the pattern. This method - # should be prefered to Dir[pattern] and Dir.glob[pattern] because + # should be prefered to Dir[pattern] and Dir.glob(pattern) because # the files returned are guaranteed to be sorted. def glob(pattern, *args) Dir.glob(pattern, *args).sort diff --git a/lib/rake/task.rb b/lib/rake/task.rb index afa1b6153d..ac0ce68c60 100644 --- a/lib/rake/task.rb +++ b/lib/rake/task.rb @@ -105,7 +105,7 @@ module Rake # Argument description (nil if none). def arg_description # :nodoc: - @arg_names ? "[#{(arg_names || []).join(',')}]" : nil + @arg_names ? "[#{arg_names.join(',')}]" : nil end # Name of arguments for this task. @@ -182,18 +182,19 @@ module Rake if application.options.always_multitask invoke_prerequisites_concurrently(task_args, invocation_chain) else - prerequisite_tasks.each { |prereq| - prereq_args = task_args.new_scope(prereq.arg_names) - prereq.invoke_with_call_chain(prereq_args, invocation_chain) + prerequisite_tasks.each { |p| + prereq_args = task_args.new_scope(p.arg_names) + p.invoke_with_call_chain(prereq_args, invocation_chain) } end end # Invoke all the prerequisites of a task in parallel. - def invoke_prerequisites_concurrently(args, invocation_chain) # :nodoc: - futures = @prerequisites.collect do |p| + def invoke_prerequisites_concurrently(task_args, invocation_chain) # :nodoc: + futures = prerequisite_tasks.collect do |p| + prereq_args = task_args.new_scope(p.arg_names) application.thread_pool.future(p) do |r| - application[r, @scope].invoke_with_call_chain(args, invocation_chain) + r.invoke_with_call_chain(prereq_args, invocation_chain) end end futures.each { |f| f.value } 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 diff --git a/lib/rake/version.rb b/lib/rake/version.rb index f6cb389478..410afa82cf 100644 --- a/lib/rake/version.rb +++ b/lib/rake/version.rb @@ -1,10 +1,13 @@ module Rake + VERSION = '0.9.5' + module Version # :nodoc: all + MAJOR, MINOR, BUILD, = Rake::VERSION.split '.' + NUMBERS = [ - MAJOR = 0, - MINOR = 9, - BUILD = 4, + MAJOR, + MINOR, + BUILD, ] end - VERSION = "0.9.4" end -- cgit v1.2.3