rake 0.9.6 → 10.0.0.beta.1

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.

Files changed (54) hide show
  1. data/README.rdoc +12 -0
  2. data/Rakefile +0 -1
  3. data/doc/command_line_usage.rdoc +17 -60
  4. data/doc/release_notes/rake-0.9.3.rdoc +23 -70
  5. data/lib/rake.rb +0 -1
  6. data/lib/rake/application.rb +23 -63
  7. data/lib/rake/backtrace.rb +2 -3
  8. data/lib/rake/contrib/ftptools.rb +2 -2
  9. data/lib/rake/dsl_definition.rb +0 -26
  10. data/lib/rake/ext/module.rb +0 -39
  11. data/lib/rake/ext/string.rb +1 -2
  12. data/lib/rake/ext/time.rb +1 -2
  13. data/lib/rake/file_list.rb +1 -8
  14. data/lib/rake/file_utils.rb +1 -1
  15. data/lib/rake/phony.rb +2 -4
  16. data/lib/rake/rake_module.rb +7 -0
  17. data/lib/rake/ruby182_test_unit_fix.rb +0 -0
  18. data/lib/rake/runtest.rb +1 -2
  19. data/lib/rake/task.rb +8 -9
  20. data/lib/rake/task_manager.rb +0 -11
  21. data/lib/rake/testtask.rb +1 -4
  22. data/lib/rake/thread_history_display.rb +4 -7
  23. data/lib/rake/thread_pool.rb +76 -42
  24. data/lib/rake/version.rb +6 -7
  25. data/test/helper.rb +4 -44
  26. data/test/test_rake_application.rb +0 -47
  27. data/test/test_rake_application_options.rb +6 -39
  28. data/test/test_rake_backtrace.rb +11 -33
  29. data/test/test_rake_dsl.rb +0 -37
  30. data/test/test_rake_file_task.rb +4 -4
  31. data/test/test_rake_functional.rb +8 -32
  32. data/test/test_rake_rake_test_loader.rb +1 -1
  33. data/test/test_rake_reduce_compat.rb +5 -33
  34. data/test/test_rake_task_manager_argument_resolution.rb +0 -5
  35. data/test/test_rake_task_with_arguments.rb +6 -17
  36. data/test/test_rake_thread_pool.rb +24 -1
  37. data/test/test_rake_top_level_functions.rb +0 -40
  38. data/test/test_thread_history_display.rb +14 -14
  39. metadata +3 -22
  40. data/doc/release_notes/rake-0.9.2.2.rdoc +0 -55
  41. data/doc/release_notes/rake-0.9.4.rdoc +0 -110
  42. data/doc/release_notes/rake-0.9.5.rdoc +0 -114
  43. data/doc/release_notes/rake-0.9.6.rdoc +0 -127
  44. data/lib/rake/classic_namespace.rb +0 -11
  45. data/lib/rake/contrib/sys.rb +0 -192
  46. data/lib/rake/gempackagetask.rb +0 -15
  47. data/lib/rake/private_reader.rb +0 -20
  48. data/lib/rake/promise.rb +0 -99
  49. data/lib/rake/rdoctask.rb +0 -234
  50. data/lib/rake/trace_output.rb +0 -19
  51. data/test/test_private_reader.rb +0 -42
  52. data/test/test_rake_rdoc_task.rb +0 -83
  53. data/test/test_sys.rb +0 -20
  54. data/test/test_trace_output.rb +0 -43
@@ -1,13 +1,12 @@
1
1
  module Rake
2
- VERSION = '0.9.6'
3
-
4
2
  module Version # :nodoc: all
5
- MAJOR, MINOR, BUILD, = Rake::VERSION.split '.'
6
-
7
3
  NUMBERS = [
8
- MAJOR,
9
- MINOR,
10
- BUILD,
4
+ MAJOR = 10,
5
+ MINOR = 0,
6
+ BUILD = 0,
7
+ 'beta',
8
+ BETA = 1,
11
9
  ]
12
10
  end
11
+ VERSION = Version::NUMBERS.join('.')
13
12
  end
@@ -12,8 +12,8 @@ require 'tmpdir'
12
12
  require File.expand_path('../file_creation', __FILE__)
13
13
 
14
14
  begin
15
- require_relative '../ruby/envutil'
16
- rescue NoMethodError, LoadError
15
+ require 'test/ruby/envutil'
16
+ rescue LoadError
17
17
  # for ruby trunk
18
18
  end
19
19
 
@@ -31,19 +31,6 @@ 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
-
47
34
  @orig_PWD = Dir.pwd
48
35
  @orig_APPDATA = ENV['APPDATA']
49
36
  @orig_HOME = ENV['HOME']
@@ -515,8 +502,8 @@ Rake::TestTask.new(:b) do |t|
515
502
  end
516
503
 
517
504
  task :test do
518
- Rake::Task[:a].invoke
519
- Rake::Task[:b].invoke
505
+ Rake::Task[:a].invoke rescue nil
506
+ Rake::Task[:b].invoke rescue nil
520
507
  end
521
508
 
522
509
  task :default => :test
@@ -532,31 +519,4 @@ task :default => :test
532
519
  end
533
520
  end
534
521
 
535
- def rakefile_failing_test_task
536
- rakefile <<-TEST_TASK
537
- require 'rake/testtask'
538
-
539
- task :default => :test
540
- Rake::TestTask.new(:test) do |t|
541
- t.test_files = ['a_test.rb']
542
- end
543
- TEST_TASK
544
- open 'a_test.rb', 'w' do |io|
545
- io << "require 'minitest/autorun'\n"
546
- io << "class ExitTaskTest < MiniTest::Unit::TestCase\n"
547
- io << " def test_exit\n"
548
- io << " assert false, 'this should fail'\n"
549
- io << " end\n"
550
- io << "end\n"
551
- end
552
- end
553
-
554
- def rakefile_stand_alone_filelist
555
- open 'stand_alone_filelist.rb', 'w' do |io|
556
- io << "require 'rake/file_list'\n"
557
- io << "FL = Rake::FileList['*.rb']\n"
558
- io << "puts FL\n"
559
- end
560
- end
561
-
562
522
  end
@@ -9,13 +9,6 @@ class TestRakeApplication < Rake::TestCase
9
9
  @app.options.rakelib = []
10
10
  end
11
11
 
12
- def test_constant_warning
13
- _, err = capture_io do @app.instance_eval { const_warning("Task") } end
14
- assert_match(/warning/i, err)
15
- assert_match(/deprecated/i, err)
16
- assert_match(/Task/i, err)
17
- end
18
-
19
12
  def test_display_tasks
20
13
  @app.options.show_tasks = :tasks
21
14
  @app.options.show_task_pattern = //
@@ -309,37 +302,6 @@ class TestRakeApplication < Rake::TestCase
309
302
  assert @app.options.trace
310
303
  end
311
304
 
312
- def test_handle_options_trace_default_is_stderr
313
- ARGV.clear
314
- ARGV << "--trace"
315
-
316
- @app.handle_options
317
-
318
- assert_equal STDERR, @app.options.trace_output
319
- assert @app.options.trace
320
- end
321
-
322
- def test_handle_options_trace_overrides_to_stdout
323
- ARGV.clear
324
- ARGV << "--trace=stdout"
325
-
326
- @app.handle_options
327
-
328
- assert_equal STDOUT, @app.options.trace_output
329
- assert @app.options.trace
330
- end
331
-
332
- def test_handle_options_trace_does_not_eat_following_task_names
333
- assert !@app.options.trace
334
-
335
- ARGV.clear
336
- ARGV << "--trace" << "sometask"
337
-
338
- @app.handle_options
339
- assert ARGV.include?("sometask")
340
- assert @app.options.trace
341
- end
342
-
343
305
  def test_good_run
344
306
  ran = false
345
307
 
@@ -439,15 +401,6 @@ class TestRakeApplication < Rake::TestCase
439
401
  ARGV.clear
440
402
  end
441
403
 
442
- def test_deprecation_message
443
- _, err = capture_io do
444
- @app.deprecate("a", "b", "c")
445
- end
446
- assert_match(/'a' is deprecated/i, err)
447
- assert_match(/use 'b' instead/i, err)
448
- assert_match(/at c$/i, err)
449
- end
450
-
451
404
  def test_standard_exception_handling_invalid_option
452
405
  out, err = capture_io do
453
406
  e = assert_raises SystemExit do
@@ -30,7 +30,6 @@ class TestRakeApplicationOptions < Rake::TestCase
30
30
  def test_default_options
31
31
  opts = command_line
32
32
  assert_nil opts.backtrace
33
- assert_nil opts.classic_namespace
34
33
  assert_nil opts.dryrun
35
34
  assert_nil opts.ignore_system
36
35
  assert_nil opts.load_system
@@ -146,8 +145,7 @@ class TestRakeApplicationOptions < Rake::TestCase
146
145
  end
147
146
 
148
147
  def test_rakelib
149
- dirs = %w(A B C).join(File::PATH_SEPARATOR)
150
- flags(['--rakelibdir', dirs], ["--rakelibdir=#{dirs}"], ['-R', dirs], ["-R#{dirs}"]) do |opts|
148
+ flags(['--rakelibdir', 'A:B:C'], ['--rakelibdir=A:B:C'], ['-R', 'A:B:C'], ['-RA:B:C']) do |opts|
151
149
  assert_equal ['A', 'B', 'C'], opts.rakelib
152
150
  end
153
151
  end
@@ -228,7 +226,7 @@ class TestRakeApplicationOptions < Rake::TestCase
228
226
  end
229
227
 
230
228
  def test_trace_with_stdout
231
- flags('--trace=stdout', '-tstdout') do |opts|
229
+ flags('--trace=stdout', '-tstdout', '-t stdout') do |opts|
232
230
  assert opts.trace, "should enable trace option"
233
231
  assert opts.backtrace, "should enabled backtrace option"
234
232
  assert_equal $stdout, opts.trace_output
@@ -238,7 +236,7 @@ class TestRakeApplicationOptions < Rake::TestCase
238
236
  end
239
237
 
240
238
  def test_trace_with_stderr
241
- flags('--trace=stderr', '-tstderr') do |opts|
239
+ flags('--trace=stderr', '-tstderr', '-t stderr') do |opts|
242
240
  assert opts.trace, "should enable trace option"
243
241
  assert opts.backtrace, "should enabled backtrace option"
244
242
  assert_equal $stderr, opts.trace_output
@@ -254,21 +252,13 @@ class TestRakeApplicationOptions < Rake::TestCase
254
252
  assert_match(/un(known|recognized).*\btrace\b.*xyzzy/i, ex.message)
255
253
  end
256
254
 
257
- def test_trace_with_following_task_name
258
- flags(['--trace', 'taskname'], ['-t', 'taskname']) do |opts|
259
- assert opts.trace, "should enable trace option"
260
- assert opts.backtrace, "should enabled backtrace option"
261
- assert_equal $stderr, opts.trace_output
262
- assert Rake::FileUtilsExt.verbose_flag
263
- assert_equal ['taskname'], @app.top_level_tasks
264
- end
265
- end
266
255
 
267
256
  def test_backtrace
268
257
  flags('--backtrace') do |opts|
269
258
  assert opts.backtrace, "should enable backtrace option"
270
259
  assert_equal $stderr, opts.trace_output
271
260
  assert ! opts.trace, "should not enable trace option"
261
+ assert ! Rake::FileUtilsExt.verbose_flag
272
262
  end
273
263
  end
274
264
 
@@ -277,6 +267,7 @@ class TestRakeApplicationOptions < Rake::TestCase
277
267
  assert opts.backtrace, "should enable backtrace option"
278
268
  assert_equal $stdout, opts.trace_output
279
269
  assert ! opts.trace, "should not enable trace option"
270
+ assert ! Rake::FileUtilsExt.verbose_flag
280
271
  end
281
272
  end
282
273
 
@@ -285,6 +276,7 @@ class TestRakeApplicationOptions < Rake::TestCase
285
276
  assert opts.backtrace, "should enable backtrace option"
286
277
  assert_equal $stderr, opts.trace_output
287
278
  assert ! opts.trace, "should not enable trace option"
279
+ assert ! Rake::FileUtilsExt.verbose_flag
288
280
  end
289
281
  end
290
282
 
@@ -295,15 +287,6 @@ class TestRakeApplicationOptions < Rake::TestCase
295
287
  assert_match(/un(known|recognized).*\bbacktrace\b.*xyzzy/i, ex.message)
296
288
  end
297
289
 
298
- def test_backtrace_with_following_task_name
299
- flags(['--backtrace', 'taskname']) do |opts|
300
- assert ! opts.trace, "should enable trace option"
301
- assert opts.backtrace, "should enabled backtrace option"
302
- assert_equal $stderr, opts.trace_output
303
- assert_equal ['taskname'], @app.top_level_tasks
304
- end
305
- end
306
-
307
290
  def test_trace_rules
308
291
  flags('--rules') do |opts|
309
292
  assert opts.trace_rules
@@ -373,22 +356,6 @@ class TestRakeApplicationOptions < Rake::TestCase
373
356
  assert_equal :exit, @exit
374
357
  end
375
358
 
376
- def test_classic_namespace
377
- _, err = capture_io do
378
- flags(['--classic-namespace'],
379
- ['-C', '-T', '-P', '-n', '-s', '-t']) do |opts|
380
- assert opts.classic_namespace
381
- assert_equal opts.show_tasks, $show_tasks
382
- assert_equal opts.show_prereqs, $show_prereqs
383
- assert_equal opts.trace, $trace
384
- assert_equal opts.dryrun, $dryrun
385
- assert_equal opts.silent, $silent
386
- end
387
- end
388
-
389
- assert_match(/deprecated/, err)
390
- end
391
-
392
359
  def test_bad_option
393
360
  _, err = capture_io do
394
361
  ex = assert_raises(OptionParser::InvalidOption) do
@@ -2,19 +2,11 @@ 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
-
13
5
  # TODO: factor out similar code in test_rake_functional.rb
14
6
  def rake(*args)
15
- Open3.popen3(RUBY, "-I", @rake_lib, @rake_exec, *args) { |_, _, err, _|
16
- err.read
17
- }
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 }
18
10
  end
19
11
 
20
12
  def invoke(task_name)
@@ -32,8 +24,8 @@ class TestRakeBacktrace < Rake::TestCase
32
24
 
33
25
  assert_equal "rake aborted!", lines[0]
34
26
  assert_equal "foooo!", lines[1]
35
- assert_something_matches %r!\A#{Regexp.quote Dir.pwd}/Rakefile:3!i, lines
36
- assert_something_matches %r!\ATasks:!, lines
27
+ assert_match %r!\A#{Regexp.quote Dir.pwd}/Rakefile:3!, lines[2]
28
+ assert_match %r!\ATasks:!, lines[3]
37
29
  end
38
30
 
39
31
  def test_multi_collapse
@@ -50,9 +42,9 @@ class TestRakeBacktrace < Rake::TestCase
50
42
 
51
43
  assert_equal "rake aborted!", lines[0]
52
44
  assert_equal "barrr!", lines[1]
53
- assert_something_matches %r!\A#{Regexp.quote Dir.pwd}/Rakefile:6!i, lines
54
- assert_something_matches %r!\A#{Regexp.quote Dir.pwd}/Rakefile:3!i, lines
55
- assert_something_matches %r!\ATasks:!, lines
45
+ assert_match %r!\A#{Regexp.quote Dir.pwd}/Rakefile:6!, lines[2]
46
+ assert_match %r!\A#{Regexp.quote Dir.pwd}/Rakefile:3!, lines[3]
47
+ assert_match %r!\ATasks:!, lines[4]
56
48
  end
57
49
 
58
50
  def test_suppress_option
@@ -65,25 +57,11 @@ class TestRakeBacktrace < Rake::TestCase
65
57
  lines = rake("baz").split("\n")
66
58
  assert_equal "rake aborted!", lines[0]
67
59
  assert_equal "bazzz!", lines[1]
68
- assert_something_matches %r!Rakefile!i, lines
60
+ assert_match %r!Rakefile!, lines[2]
69
61
 
70
- lines = rake("--suppress-backtrace", ".ak.file", "baz").split("\n")
62
+ lines = rake("--suppress-backtrace", "R.k.file", "baz").split("\n")
71
63
  assert_equal "rake aborted!", lines[0]
72
64
  assert_equal "bazzz!", lines[1]
73
- refute_match %r!Rakefile!i, lines[2]
65
+ refute_match %r!Rakefile!, lines[2]
74
66
  end
75
-
76
- private
77
-
78
- # Assert that the pattern matches at least one line in +lines+.
79
- def assert_something_matches(pattern, lines)
80
- lines.each do |ln|
81
- if pattern =~ ln
82
- assert_match pattern, ln
83
- return
84
- end
85
- end
86
- flunk "expected #{pattern.inspect} to match something in:\n #{lines.join("\n ")}"
87
- end
88
-
89
67
  end
@@ -33,45 +33,8 @@ class TestRakeDsl < Rake::TestCase
33
33
  refute_nil Rake::Task["bob:t"]
34
34
  end
35
35
 
36
- class Foo
37
- def initialize
38
- task :foo_deprecated_a => "foo_deprecated_b" do
39
- print "a"
40
- end
41
- file "foo_deprecated_b" do
42
- print "b"
43
- end
44
- end
45
- end
46
-
47
- def test_deprecated_object_dsl
48
- out, err = capture_io do
49
- Foo.new
50
- Rake.application.invoke_task :foo_deprecated_a
51
- end
52
- assert_equal("ba", out)
53
- assert_match(/deprecated/, err)
54
- assert_match(/Foo\#task/, err)
55
- assert_match(/Foo\#file/, err)
56
- assert_match(/test_rake_dsl\.rb:\d+/, err)
57
- end
58
-
59
36
  def test_no_commands_constant
60
37
  assert ! defined?(Commands), "should not define Commands"
61
38
  end
62
39
 
63
- def test_deprecated_object_dsl_with_suppressed_warnings
64
- Rake.application.options.ignore_deprecate = true
65
- out, err = capture_io do
66
- Foo.new
67
- Rake.application.invoke_task :foo_deprecated_a
68
- end
69
- assert_equal("ba", out)
70
- refute_match(/deprecated/, err)
71
- refute_match(/Foo\#task/, err)
72
- refute_match(/Foo\#file/, err)
73
- refute_match(/test_rake_dsl\.rb:\d+/, err)
74
- ensure
75
- Rake.application.options.ignore_deprecate = false
76
- end
77
40
  end
@@ -1,6 +1,10 @@
1
1
  require File.expand_path('../helper', __FILE__)
2
2
  require 'fileutils'
3
3
 
4
+ def load_phony
5
+ load File.dirname(__FILE__) + "/../lib/rake/phony.rb"
6
+ end
7
+
4
8
  class TestRakeFileTask < Rake::TestCase
5
9
  include Rake
6
10
 
@@ -115,8 +119,4 @@ class TestRakeFileTask < Rake::TestCase
115
119
  assert( ! File.exist?(NEWFILE), "NEWFILE should be deleted")
116
120
  end
117
121
 
118
- def load_phony
119
- load File.join(@rake_lib, "rake/phony.rb")
120
- end
121
-
122
122
  end
@@ -5,9 +5,9 @@ require 'open3'
5
5
  class TestRakeFunctional < Rake::TestCase
6
6
 
7
7
  def setup
8
- super
9
-
10
- @ruby_options = ["-I#{@rake_lib}", "-I."]
8
+ @rake_path = File.expand_path("bin/rake")
9
+ lib_path = File.expand_path("lib")
10
+ @ruby_options = ["-I#{lib_path}", "-I."]
11
11
  @verbose = ENV['VERBOSE']
12
12
 
13
13
  if @verbose
@@ -17,6 +17,8 @@ class TestRakeFunctional < Rake::TestCase
17
17
  puts @__name__
18
18
  puts '-' * 80
19
19
  end
20
+
21
+ super
20
22
  end
21
23
 
22
24
  def test_rake_default
@@ -433,36 +435,12 @@ class TestRakeFunctional < Rake::TestCase
433
435
  assert_match(/ATEST/, @out)
434
436
  refute_match(/BTEST/, @out)
435
437
  else
436
- skip "Signal detect seems broken on this system"
438
+ puts "\nWARNING: Signal detect seems broken on this system (#{__FILE__}:#{__LINE__})"
437
439
  end
438
440
  end
439
441
 
440
- def test_failing_test_sets_exit_status
441
- skip if uncertain_exit_status?
442
- rakefile_failing_test_task
443
- rake
444
- assert @exit.exitstatus > 0, "should be non-zero"
445
- end
446
-
447
- def test_stand_alone_filelist
448
- rakefile_stand_alone_filelist
449
-
450
- run_ruby @ruby_options + ["stand_alone_filelist.rb"]
451
-
452
- assert_match(/^stand_alone_filelist\.rb$/, @out)
453
- assert_equal 0, @exit.exitstatus unless uncertain_exit_status?
454
- end
455
-
456
442
  private
457
443
 
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
-
466
444
  # Run a shell Ruby command with command line options (using the
467
445
  # default test options). Output is captured in @out and @err
468
446
  def ruby(*option_list)
@@ -473,23 +451,21 @@ class TestRakeFunctional < Rake::TestCase
473
451
  # command line ruby options are included. Output is captured in
474
452
  # @out and @err
475
453
  def rake(*rake_options)
476
- run_ruby @ruby_options + [@rake_exec] + rake_options
454
+ run_ruby @ruby_options + [@rake_path] + rake_options
477
455
  end
478
456
 
479
457
  # Low level ruby command runner ...
480
458
  def run_ruby(option_list)
481
459
  puts "COMMAND: [#{RUBY} #{option_list.join ' '}]" if @verbose
482
460
 
483
- inn, out, err, wait = Open3.popen3(RUBY, *option_list)
461
+ inn, out, err = Open3.popen3(Gem.ruby, *option_list)
484
462
  inn.close
485
463
 
486
- @exit = wait ? wait.value : $?
487
464
  @out = out.read
488
465
  @err = err.read
489
466
 
490
467
  puts "OUTPUT: [#{@out}]" if @verbose
491
468
  puts "ERROR: [#{@err}]" if @verbose
492
- puts "EXIT: [#{@exit.inspect}]" if @verbose
493
469
  puts "PWD: [#{Dir.pwd}]" if @verbose
494
470
  end
495
471