rake 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rake might be problematic. Click here for more details.

data/Rakefile CHANGED
@@ -60,7 +60,7 @@ task :default => :test
60
60
 
61
61
  Rake::TestTask.new do |t|
62
62
  files = FileList['test/helper.rb', 'test/test_*.rb']
63
- t.loader = :testrb
63
+ t.loader = :rake
64
64
  t.test_files = files
65
65
  t.libs << "."
66
66
  t.warning = true
@@ -0,0 +1,127 @@
1
+ = Rake 0.9.6 Released
2
+
3
+ Rake version 0.9.6 contains a number of fixes mainly for merging
4
+ Rake into the Ruby source tree and fixing tests.
5
+
6
+ == Changes
7
+
8
+ === New Features (in 0.9.3)
9
+
10
+ * Multitask tasks now use a thread pool. Use -j to limit the number of
11
+ available threads.
12
+
13
+ * Use -m to turn regular tasks into multitasks (use at your own risk).
14
+
15
+ * You can now do "Rake.add_rakelib 'dir'" in your Rakefile to
16
+ programatically add rake task libraries.
17
+
18
+ * You can specific backtrace suppression patterns (see
19
+ --supress-backtrace)
20
+
21
+ * Directory tasks can now take prerequisites and actions
22
+
23
+ * Use --backtrace to request a full backtrace without the task trace.
24
+
25
+ * You can say "--backtrace=stdout" and "--trace=stdout" to route trace
26
+ output to standard output rather than standard error.
27
+
28
+ * Optional 'phony' target (enable with 'require 'rake/phony'") for
29
+ special purpose builds.
30
+
31
+ * Task#clear now clears task comments as well as actions and
32
+ prerequisites. Task#clear_comment will specifically target comments.
33
+
34
+ * The --all option will force -T and -D to consider all the tasks,
35
+ with and without descriptions.
36
+
37
+ === Bug Fixes (0.9.3)
38
+
39
+ * Semi-colons in windows rakefile paths now work.
40
+
41
+ * Improved Control-C support when invoking multiple test suites.
42
+
43
+ * egrep method now reads files in text mode (better support for
44
+ Windows)
45
+
46
+ * Better deprecation line number reporting.
47
+
48
+ * The -W option now works with all tasks, whether they have a
49
+ description or not.
50
+
51
+ * File globs in rake should not be sorted alphabetically, independent
52
+ of file system and platform.
53
+
54
+ * Numerous internal improvements.
55
+
56
+ * Documentation typos and fixes.
57
+
58
+ === Bug Fixes (0.9.4)
59
+
60
+ * Exit status with failing tests is not correctly set to non-zero.
61
+
62
+ * Simplified syntax for phony task (for older versions of RDoc).
63
+
64
+ * Stand alone FileList usage gets glob function (without loading in
65
+ extra dependencies)
66
+
67
+ === Bug Fixes (0.9.5)
68
+
69
+ * --trace and --backtrace no longer swallow following task names.
70
+
71
+ === Bug Fixes (0.9.6)
72
+
73
+ * Better trace output when using a multi-threaded Rakefile.
74
+ * Arg parsing is now consistent for tasks and multitasks.
75
+ * Skip exit code test in versions of Ruby that don't support it well.
76
+
77
+ Changes for better integration with the Ruby source tree:
78
+
79
+ * Fix version literal for Ruby source tree build.
80
+ * Better loading of libraries for testing in Ruby build.
81
+ * Use the ruby version provided by Ruby's tests.
82
+
83
+ == What is Rake
84
+
85
+ Rake is a build tool similar to the make program in many ways. But
86
+ instead of cryptic make recipes, Rake uses standard Ruby code to
87
+ declare tasks and dependencies. You have the full power of a modern
88
+ scripting language built right into your build tool.
89
+
90
+ == Availability
91
+
92
+ The easiest way to get and install rake is via RubyGems ...
93
+
94
+ gem install rake (you may need root/admin privileges)
95
+
96
+ Otherwise, you can get it from the more traditional places:
97
+
98
+ Home Page:: http://github.com/jimweirich/rake
99
+ Download:: http://rubyforge.org/project/showfiles.php?group_id=50
100
+ GitHub:: git://github.com/jimweirich/rake.git
101
+
102
+ == Thanks
103
+
104
+ As usual, it was input from users that drove a alot of these changes. The
105
+ following people either contributed patches, made suggestions or made
106
+ otherwise helpful comments. Thanks to ...
107
+
108
+ * Aaron Patterson
109
+ * Dylan Smith
110
+ * Jo Liss
111
+ * Jonas Pfenniger
112
+ * Kazuki Tsujimoto
113
+ * Michael Bishop
114
+ * Michael Elufimov
115
+ * NAKAMURA Usaku
116
+ * Ryan Davis
117
+ * Sam Grönblom
118
+ * Sam Phippen
119
+ * Sergio Wong
120
+ * Tay Ray Chuan
121
+ * grosser
122
+ * quix
123
+
124
+ Also, many thanks to Eric Hodel for assisting with getting this release
125
+ out the door.
126
+
127
+ -- Jim Weirich
@@ -43,6 +43,7 @@ require 'rake/win32'
43
43
  require 'rake/task_argument_error'
44
44
  require 'rake/rule_recursion_overflow_error'
45
45
  require 'rake/rake_module'
46
+ require 'rake/trace_output'
46
47
  require 'rake/pseudo_status'
47
48
  require 'rake/task_arguments'
48
49
  require 'rake/invocation_chain'
@@ -5,6 +5,7 @@ require 'rake/task_manager'
5
5
  require 'rake/file_list'
6
6
  require 'rake/thread_pool'
7
7
  require 'rake/thread_history_display'
8
+ require 'rake/trace_output'
8
9
  require 'rake/win32'
9
10
 
10
11
  module Rake
@@ -17,6 +18,7 @@ module Rake
17
18
  #
18
19
  class Application
19
20
  include TaskManager
21
+ include TraceOutput
20
22
 
21
23
  # The name of the application (typically 'rake')
22
24
  attr_reader :name
@@ -176,7 +178,7 @@ module Rake
176
178
  if options.backtrace
177
179
  trace ex.backtrace.join("\n")
178
180
  else
179
- trace Backtrace.collapse(ex.backtrace)
181
+ trace Backtrace.collapse(ex.backtrace).join("\n")
180
182
  end
181
183
  trace "Tasks: #{ex.chain}" if has_chain?(ex)
182
184
  trace "(See full trace by running task with --trace)" unless options.backtrace
@@ -314,9 +316,9 @@ module Rake
314
316
  end
315
317
  end
316
318
 
317
- def trace(*str)
319
+ def trace(*strings)
318
320
  options.trace_output ||= $stderr
319
- options.trace_output.puts(*str)
321
+ trace_on(options.trace_output, *strings)
320
322
  end
321
323
 
322
324
  def sort_options(options)
@@ -2,7 +2,7 @@ module Rake
2
2
  module Backtrace
3
3
  SUPPRESSED_PATHS =
4
4
  RbConfig::CONFIG.values_at(*RbConfig::CONFIG.
5
- keys.grep(/(prefix|libdir)/)) + [
5
+ keys.grep(/(prefix|libdir)/)).uniq + [
6
6
  File.join(File.dirname(__FILE__), ".."),
7
7
  ].map { |f| Regexp.quote(File.expand_path(f)) }
8
8
  SUPPRESSED_PATHS.reject! { |s| s.nil? || s =~ /^ *$/ }
@@ -6,7 +6,7 @@ require 'fileutils'
6
6
  # added to the FileUtils utility functions.
7
7
  module FileUtils
8
8
  # Path to the currently running Ruby program
9
- RUBY = File.join(
9
+ RUBY = ENV['RUBY'] || File.join(
10
10
  RbConfig::CONFIG['bindir'],
11
11
  RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT']).
12
12
  sub(/.*\s.*/m, '"\&"')
File without changes
@@ -105,7 +105,7 @@ module Rake
105
105
 
106
106
  # Argument description (nil if none).
107
107
  def arg_description # :nodoc:
108
- @arg_names ? "[#{(arg_names || []).join(',')}]" : nil
108
+ @arg_names ? "[#{arg_names.join(',')}]" : nil
109
109
  end
110
110
 
111
111
  # Name of arguments for this task.
@@ -182,18 +182,19 @@ module Rake
182
182
  if application.options.always_multitask
183
183
  invoke_prerequisites_concurrently(task_args, invocation_chain)
184
184
  else
185
- prerequisite_tasks.each { |prereq|
186
- prereq_args = task_args.new_scope(prereq.arg_names)
187
- prereq.invoke_with_call_chain(prereq_args, invocation_chain)
185
+ prerequisite_tasks.each { |p|
186
+ prereq_args = task_args.new_scope(p.arg_names)
187
+ p.invoke_with_call_chain(prereq_args, invocation_chain)
188
188
  }
189
189
  end
190
190
  end
191
191
 
192
192
  # Invoke all the prerequisites of a task in parallel.
193
- def invoke_prerequisites_concurrently(args, invocation_chain) # :nodoc:
194
- futures = @prerequisites.collect do |p|
193
+ def invoke_prerequisites_concurrently(task_args, invocation_chain) # :nodoc:
194
+ futures = prerequisite_tasks.collect do |p|
195
+ prereq_args = task_args.new_scope(p.arg_names)
195
196
  application.thread_pool.future(p) do |r|
196
- application[r, @scope].invoke_with_call_chain(args, invocation_chain)
197
+ r.invoke_with_call_chain(prereq_args, invocation_chain)
197
198
  end
198
199
  end
199
200
  futures.each { |f| f.value }
@@ -0,0 +1,19 @@
1
+ module Rake
2
+ module TraceOutput
3
+
4
+ # Write trace output to output stream +out+.
5
+ #
6
+ # The write is done as a single IO call (to print) to lessen the
7
+ # chance that the trace output is interrupted by other tasks also
8
+ # producing output.
9
+ def trace_on(out, *strings)
10
+ sep = $\ || "\n"
11
+ if strings.empty?
12
+ output = sep
13
+ else
14
+ output = strings.map { |s| s.end_with?(sep) ? s : s + sep }.join
15
+ end
16
+ out.print(output)
17
+ end
18
+ end
19
+ end
@@ -1,10 +1,13 @@
1
1
  module Rake
2
+ VERSION = '0.9.6'
3
+
2
4
  module Version # :nodoc: all
5
+ MAJOR, MINOR, BUILD, = Rake::VERSION.split '.'
6
+
3
7
  NUMBERS = [
4
- MAJOR = 0,
5
- MINOR = 9,
6
- BUILD = 5,
8
+ MAJOR,
9
+ MINOR,
10
+ BUILD,
7
11
  ]
8
12
  end
9
- VERSION = Version::NUMBERS.join('.')
10
13
  end
@@ -12,8 +12,8 @@ require 'tmpdir'
12
12
  require File.expand_path('../file_creation', __FILE__)
13
13
 
14
14
  begin
15
- require 'test/ruby/envutil'
16
- rescue LoadError
15
+ require_relative '../ruby/envutil'
16
+ rescue NoMethodError, LoadError
17
17
  # for ruby trunk
18
18
  end
19
19
 
@@ -31,6 +31,19 @@ class Rake::TestCase < MiniTest::Unit::TestCase
31
31
  def setup
32
32
  ARGV.clear
33
33
 
34
+ test_dir = File.basename File.dirname File.expand_path __FILE__
35
+
36
+ @rake_root = if test_dir == 'test' then
37
+ # rake repository
38
+ File.expand_path '../../', __FILE__
39
+ else
40
+ # ruby repository
41
+ File.expand_path '../../../', __FILE__
42
+ end
43
+
44
+ @rake_exec = File.join @rake_root, 'bin', 'rake'
45
+ @rake_lib = File.join @rake_root, 'lib'
46
+
34
47
  @orig_PWD = Dir.pwd
35
48
  @orig_APPDATA = ENV['APPDATA']
36
49
  @orig_HOME = ENV['HOME']
@@ -502,8 +515,8 @@ Rake::TestTask.new(:b) do |t|
502
515
  end
503
516
 
504
517
  task :test do
505
- Rake::Task[:a].invoke rescue nil
506
- Rake::Task[:b].invoke rescue nil
518
+ Rake::Task[:a].invoke
519
+ Rake::Task[:b].invoke
507
520
  end
508
521
 
509
522
  task :default => :test
@@ -2,11 +2,19 @@ require File.expand_path('../helper', __FILE__)
2
2
  require 'open3'
3
3
 
4
4
  class TestRakeBacktrace < Rake::TestCase
5
+
6
+ def setup
7
+ super
8
+
9
+ skip 'tmpdir is suppressed in backtrace' if
10
+ Dir.pwd =~ Rake::Backtrace::SUPPRESS_PATTERN
11
+ end
12
+
5
13
  # TODO: factor out similar code in test_rake_functional.rb
6
14
  def rake(*args)
7
- lib = File.join(@orig_PWD, "lib")
8
- bin_rake = File.join(@orig_PWD, "bin", "rake")
9
- Open3.popen3(RUBY, "-I", lib, bin_rake, *args) { |_, _, err, _| err.read }
15
+ Open3.popen3(RUBY, "-I", @rake_lib, @rake_exec, *args) { |_, _, err, _|
16
+ err.read
17
+ }
10
18
  end
11
19
 
12
20
  def invoke(task_name)
@@ -116,7 +116,7 @@ class TestRakeFileTask < Rake::TestCase
116
116
  end
117
117
 
118
118
  def load_phony
119
- load File.join(@orig_PWD, "lib/rake/phony.rb")
119
+ load File.join(@rake_lib, "rake/phony.rb")
120
120
  end
121
121
 
122
122
  end
@@ -5,9 +5,9 @@ require 'open3'
5
5
  class TestRakeFunctional < Rake::TestCase
6
6
 
7
7
  def setup
8
- @rake_path = File.expand_path("bin/rake")
9
- lib_path = File.expand_path("lib")
10
- @ruby_options = ["-I#{lib_path}", "-I."]
8
+ super
9
+
10
+ @ruby_options = ["-I#{@rake_lib}", "-I."]
11
11
  @verbose = ENV['VERBOSE']
12
12
 
13
13
  if @verbose
@@ -17,8 +17,6 @@ class TestRakeFunctional < Rake::TestCase
17
17
  puts @__name__
18
18
  puts '-' * 80
19
19
  end
20
-
21
- super
22
20
  end
23
21
 
24
22
  def test_rake_default
@@ -440,9 +438,10 @@ class TestRakeFunctional < Rake::TestCase
440
438
  end
441
439
 
442
440
  def test_failing_test_sets_exit_status
441
+ skip if uncertain_exit_status?
443
442
  rakefile_failing_test_task
444
443
  rake
445
- assert_equal 1, @exit.exitstatus
444
+ assert @exit.exitstatus > 0, "should be non-zero"
446
445
  end
447
446
 
448
447
  def test_stand_alone_filelist
@@ -451,11 +450,19 @@ class TestRakeFunctional < Rake::TestCase
451
450
  run_ruby @ruby_options + ["stand_alone_filelist.rb"]
452
451
 
453
452
  assert_match(/^stand_alone_filelist\.rb$/, @out)
454
- assert_equal 0, @exit.exitstatus
453
+ assert_equal 0, @exit.exitstatus unless uncertain_exit_status?
455
454
  end
456
455
 
457
456
  private
458
457
 
458
+ # We are unable to accurately verify that Rake returns a proper
459
+ # error exit status using popen3 in Ruby 1.8.7 and JRuby. This
460
+ # predicate function can be used to skip tests or assertions as
461
+ # needed.
462
+ def uncertain_exit_status?
463
+ RUBY_VERSION < "1.9" || defined?(JRUBY_VERSION)
464
+ end
465
+
459
466
  # Run a shell Ruby command with command line options (using the
460
467
  # default test options). Output is captured in @out and @err
461
468
  def ruby(*option_list)
@@ -466,19 +473,19 @@ class TestRakeFunctional < Rake::TestCase
466
473
  # command line ruby options are included. Output is captured in
467
474
  # @out and @err
468
475
  def rake(*rake_options)
469
- run_ruby @ruby_options + [@rake_path] + rake_options
476
+ run_ruby @ruby_options + [@rake_exec] + rake_options
470
477
  end
471
478
 
472
479
  # Low level ruby command runner ...
473
480
  def run_ruby(option_list)
474
481
  puts "COMMAND: [#{RUBY} #{option_list.join ' '}]" if @verbose
475
482
 
476
- inn, out, err, wait = Open3.popen3(Gem.ruby, *option_list)
483
+ inn, out, err, wait = Open3.popen3(RUBY, *option_list)
477
484
  inn.close
478
485
 
486
+ @exit = wait ? wait.value : $?
479
487
  @out = out.read
480
488
  @err = err.read
481
- @exit = wait.value
482
489
 
483
490
  puts "OUTPUT: [#{@out}]" if @verbose
484
491
  puts "ERROR: [#{@err}]" if @verbose
@@ -10,7 +10,7 @@ class TestRakeRakeTestLoader < Rake::TestCase
10
10
 
11
11
  ARGV.replace %w[foo.rb test_*.rb -v]
12
12
 
13
- load File.join(@orig_PWD, 'lib/rake/rake_test_loader.rb')
13
+ load File.join(@rake_lib, 'rake/rake_test_loader.rb')
14
14
 
15
15
  assert_equal %w[-v], ARGV
16
16
  ensure
@@ -4,11 +4,11 @@ require 'open3'
4
4
  class TestRakeReduceCompat < Rake::TestCase
5
5
  # TODO: factor out similar code in test_rake_functional.rb
6
6
  def rake(*args)
7
- lib = File.join(@orig_PWD, "lib")
8
- bin_rake = File.join(@orig_PWD, "bin", "rake")
9
- Open3.popen3(RUBY, "-I", lib, bin_rake, *args) { |_, out, _, _| out.read }
7
+ Open3.popen3(RUBY, "-I", @rake_lib, @rake_exec, *args) { |_, out, _, _|
8
+ out.read
9
+ }
10
10
  end
11
-
11
+
12
12
  def invoke_normal(task_name)
13
13
  rake task_name.to_s
14
14
  end
@@ -27,7 +27,7 @@ class TestRakeReduceCompat < Rake::TestCase
27
27
  Module.new { p defined?(file) }
28
28
  end
29
29
  }
30
-
30
+
31
31
  assert_equal %{"method"}, invoke_normal(:check_task).chomp
32
32
  assert_equal %{"method"}, invoke_normal(:check_file).chomp
33
33
 
@@ -142,7 +142,7 @@ class TestRakeTaskWithArguments < Rake::TestCase
142
142
  assert_equal "1.2", value
143
143
  end
144
144
 
145
- def test_args_not_passed_if_no_prereq_names
145
+ def test_args_not_passed_if_no_prereq_names_on_task
146
146
  pre = task(:pre) { |t, args|
147
147
  assert_equal({}, args.to_hash)
148
148
  assert_equal "bill", args.name
@@ -151,6 +151,15 @@ class TestRakeTaskWithArguments < Rake::TestCase
151
151
  t.invoke("bill", "1.2")
152
152
  end
153
153
 
154
+ def test_args_not_passed_if_no_prereq_names_on_multitask
155
+ pre = task(:pre) { |t, args|
156
+ assert_equal({}, args.to_hash)
157
+ assert_equal "bill", args.name
158
+ }
159
+ t = multitask(:t, [:name, :rev] => [:pre])
160
+ t.invoke("bill", "1.2")
161
+ end
162
+
154
163
  def test_args_not_passed_if_no_arg_names
155
164
  pre = task(:pre, :rev) { |t, args|
156
165
  assert_equal({}, args.to_hash)
@@ -170,4 +179,3 @@ class TestRakeTaskWithArguments < Rake::TestCase
170
179
  # HACK no assertions
171
180
  end
172
181
  end
173
-
@@ -23,7 +23,7 @@ class TestRakeTopLevelFunctions < Rake::TestCase
23
23
  def test_namespace
24
24
  block = proc do end
25
25
 
26
- namespace("xyz", &block)
26
+ namespace("xyz", &block)
27
27
 
28
28
  expected = [
29
29
  [[:in_namespace, 'xyz'], block]
@@ -0,0 +1,43 @@
1
+ require File.expand_path('../helper', __FILE__)
2
+ require 'stringio'
3
+
4
+ class TestTraceOutput < Rake::TestCase
5
+ include Rake::TraceOutput
6
+
7
+ class PrintSpy
8
+ attr_reader :result, :calls
9
+ def initialize
10
+ @result = ""
11
+ @calls = 0
12
+ end
13
+ def print(string)
14
+ @result << string
15
+ @calls += 1
16
+ end
17
+ end
18
+
19
+ def test_trace_issues_single_io_for_args_with_empty_args
20
+ spy = PrintSpy.new
21
+ trace_on(spy)
22
+ assert_equal "\n", spy.result
23
+ assert_equal 1, spy.calls
24
+ end
25
+
26
+ def test_trace_issues_single_io_for_args_multiple_strings
27
+ spy = PrintSpy.new
28
+ trace_on(spy, "HI\n", "LO")
29
+ assert_equal "HI\nLO\n", spy.result
30
+ assert_equal 1, spy.calls
31
+ end
32
+
33
+ def test_trace_issues_single_io_for_args_multiple_strings_and_alternate_sep
34
+ old_sep = $\
35
+ $\ = "\r"
36
+ spy = PrintSpy.new
37
+ trace_on(spy, "HI\r", "LO")
38
+ assert_equal "HI\rLO\r", spy.result
39
+ assert_equal 1, spy.calls
40
+ ensure
41
+ $\ = old_sep
42
+ end
43
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-19 00:00:00.000000000 Z
12
+ date: 2012-12-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
@@ -67,6 +67,7 @@ extra_rdoc_files:
67
67
  - doc/release_notes/rake-0.9.3.rdoc
68
68
  - doc/release_notes/rake-0.9.4.rdoc
69
69
  - doc/release_notes/rake-0.9.5.rdoc
70
+ - doc/release_notes/rake-0.9.6.rdoc
70
71
  files:
71
72
  - .gemtest
72
73
  - install.rb
@@ -127,6 +128,7 @@ files:
127
128
  - lib/rake/testtask.rb
128
129
  - lib/rake/thread_history_display.rb
129
130
  - lib/rake/thread_pool.rb
131
+ - lib/rake/trace_output.rb
130
132
  - lib/rake/version.rb
131
133
  - lib/rake/win32.rb
132
134
  - test/file_creation.rb
@@ -176,6 +178,7 @@ files:
176
178
  - test/test_rake_win32.rb
177
179
  - test/test_sys.rb
178
180
  - test/test_thread_history_display.rb
181
+ - test/test_trace_output.rb
179
182
  - doc/command_line_usage.rdoc
180
183
  - doc/example/Rakefile1
181
184
  - doc/example/Rakefile2
@@ -212,6 +215,7 @@ files:
212
215
  - doc/release_notes/rake-0.9.3.rdoc
213
216
  - doc/release_notes/rake-0.9.4.rdoc
214
217
  - doc/release_notes/rake-0.9.5.rdoc
218
+ - doc/release_notes/rake-0.9.6.rdoc
215
219
  homepage: http://rake.rubyforge.org
216
220
  licenses: []
217
221
  post_install_message: