rake 0.8.7 → 0.9.0.beta.0

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 (122) hide show
  1. data/.gemtest +0 -0
  2. data/CHANGES +77 -9
  3. data/{README → README.rdoc} +14 -10
  4. data/Rakefile +113 -110
  5. data/TODO +1 -1
  6. data/doc/command_line_usage.rdoc +18 -6
  7. data/doc/glossary.rdoc +2 -2
  8. data/doc/jamis.rb +2 -2
  9. data/doc/proto_rake.rdoc +22 -22
  10. data/doc/rake.1.gz +0 -0
  11. data/doc/rakefile.rdoc +60 -28
  12. data/doc/rational.rdoc +6 -6
  13. data/doc/release_notes/rake-0.4.15.rdoc +1 -1
  14. data/doc/release_notes/rake-0.5.0.rdoc +1 -1
  15. data/doc/release_notes/rake-0.7.0.rdoc +1 -1
  16. data/doc/release_notes/rake-0.7.2.rdoc +3 -3
  17. data/doc/release_notes/rake-0.7.3.rdoc +2 -2
  18. data/doc/release_notes/rake-0.8.0.rdoc +1 -1
  19. data/doc/release_notes/rake-0.8.2.rdoc +3 -3
  20. data/doc/release_notes/rake-0.8.3.rdoc +2 -2
  21. data/doc/release_notes/rake-0.8.4.rdoc +1 -1
  22. data/doc/release_notes/rake-0.8.5.rdoc +1 -1
  23. data/doc/release_notes/rake-0.8.6.rdoc +1 -1
  24. data/doc/release_notes/rake-0.8.7.rdoc +1 -1
  25. data/install.rb +14 -12
  26. data/lib/rake.rb +28 -2470
  27. data/lib/rake/alt_system.rb +7 -6
  28. data/lib/rake/application.rb +585 -0
  29. data/lib/rake/classic_namespace.rb +1 -0
  30. data/lib/rake/clean.rb +14 -14
  31. data/lib/rake/cloneable.rb +25 -0
  32. data/lib/rake/contrib/compositepublisher.rb +2 -5
  33. data/lib/rake/contrib/ftptools.rb +5 -8
  34. data/lib/rake/contrib/publisher.rb +2 -8
  35. data/lib/rake/contrib/rubyforgepublisher.rb +2 -4
  36. data/lib/rake/contrib/sshpublisher.rb +4 -6
  37. data/lib/rake/contrib/sys.rb +7 -25
  38. data/lib/rake/default_loader.rb +10 -0
  39. data/lib/rake/dsl.rb +2 -0
  40. data/lib/rake/dsl_definition.rb +146 -0
  41. data/lib/rake/early_time.rb +18 -0
  42. data/lib/rake/environment.rb +40 -0
  43. data/lib/rake/ext/core.rb +27 -0
  44. data/lib/rake/ext/module.rb +39 -0
  45. data/lib/rake/ext/string.rb +167 -0
  46. data/lib/rake/ext/time.rb +14 -0
  47. data/lib/rake/file_creation_task.rb +24 -0
  48. data/lib/rake/file_list.rb +403 -0
  49. data/lib/rake/file_task.rb +47 -0
  50. data/lib/rake/file_utils.rb +112 -0
  51. data/lib/rake/file_utils_ext.rb +132 -0
  52. data/lib/rake/gempackagetask.rb +6 -90
  53. data/lib/rake/invocation_chain.rb +51 -0
  54. data/lib/rake/invocation_exception_mixin.rb +16 -0
  55. data/lib/rake/loaders/makefile.rb +13 -15
  56. data/lib/rake/multi_task.rb +16 -0
  57. data/lib/rake/name_space.rb +25 -0
  58. data/lib/rake/packagetask.rb +13 -12
  59. data/lib/rake/pathmap.rb +1 -0
  60. data/lib/rake/pseudo_status.rb +24 -0
  61. data/lib/rake/rake_module.rb +25 -0
  62. data/lib/rake/rake_test_loader.rb +10 -2
  63. data/lib/rake/rdoctask.rb +211 -190
  64. data/lib/rake/ruby182_test_unit_fix.rb +9 -7
  65. data/lib/rake/rule_recursion_overflow_error.rb +20 -0
  66. data/lib/rake/runtest.rb +4 -6
  67. data/lib/rake/task.rb +327 -0
  68. data/lib/rake/task_argument_error.rb +7 -0
  69. data/lib/rake/task_arguments.rb +74 -0
  70. data/lib/rake/task_manager.rb +329 -0
  71. data/lib/rake/tasklib.rb +1 -2
  72. data/lib/rake/testtask.rb +51 -26
  73. data/lib/rake/version.rb +12 -0
  74. data/lib/rake/win32.rb +4 -4
  75. data/test/contrib/test_sys.rb +7 -30
  76. data/test/data/comments/Rakefile +18 -0
  77. data/test/data/default/Rakefile +1 -1
  78. data/test/data/dryrun/Rakefile +1 -1
  79. data/test/data/file_creation_task/Rakefile +1 -1
  80. data/test/data/namespace/Rakefile +9 -0
  81. data/test/data/rakelib/test1.rb +4 -2
  82. data/test/data/verbose/Rakefile +34 -0
  83. data/test/functional/functional_test.rb +25 -0
  84. data/test/{session_functional.rb → functional/session_based_tests.rb} +134 -23
  85. data/test/in_environment.rb +6 -4
  86. data/test/{test_application.rb → lib/application_test.rb} +277 -136
  87. data/test/{test_clean.rb → lib/clean_test.rb} +1 -0
  88. data/test/{test_definitions.rb → lib/definitions_test.rb} +2 -2
  89. data/test/lib/dsl_test.rb +52 -0
  90. data/test/{test_earlytime.rb → lib/earlytime_test.rb} +1 -2
  91. data/test/lib/environment_test.rb +18 -0
  92. data/test/{test_extension.rb → lib/extension_test.rb} +2 -2
  93. data/test/{test_file_creation_task.rb → lib/file_creation_task_test.rb} +0 -0
  94. data/test/{test_file_task.rb → lib/file_task_test.rb} +3 -3
  95. data/test/{test_filelist.rb → lib/filelist_test.rb} +28 -24
  96. data/test/{test_fileutils.rb → lib/fileutils_test.rb} +26 -21
  97. data/test/{test_ftp.rb → lib/ftp_test.rb} +0 -0
  98. data/test/{test_invocation_chain.rb → lib/invocation_chain_test.rb} +0 -0
  99. data/test/{test_makefile_loader.rb → lib/makefile_loader_test.rb} +0 -0
  100. data/test/{test_multitask.rb → lib/multitask_test.rb} +14 -6
  101. data/test/{test_namespace.rb → lib/namespace_test.rb} +0 -0
  102. data/test/lib/package_task_test.rb +82 -0
  103. data/test/{test_pathmap.rb → lib/pathmap_test.rb} +3 -2
  104. data/test/{test_pseudo_status.rb → lib/pseudo_status_test.rb} +0 -0
  105. data/test/{test_rake.rb → lib/rake_test.rb} +1 -1
  106. data/test/{test_rdoc_task.rb → lib/rdoc_task_test.rb} +19 -23
  107. data/test/{test_require.rb → lib/require_test.rb} +8 -2
  108. data/test/{test_rules.rb → lib/rules_test.rb} +1 -2
  109. data/test/{test_task_arguments.rb → lib/task_arguments_test.rb} +5 -5
  110. data/test/{test_task_manager.rb → lib/task_manager_test.rb} +5 -5
  111. data/test/{test_tasks.rb → lib/task_test.rb} +69 -4
  112. data/test/{test_tasklib.rb → lib/tasklib_test.rb} +0 -0
  113. data/test/{test_test_task.rb → lib/test_task_test.rb} +3 -3
  114. data/test/lib/testtask_test.rb +49 -0
  115. data/test/{test_top_level_functions.rb → lib/top_level_functions_test.rb} +3 -3
  116. data/test/{test_win32.rb → lib/win32_test.rb} +19 -0
  117. data/test/rake_test_setup.rb +4 -9
  118. data/test/ruby_version_test.rb +3 -0
  119. data/test/test_helper.rb +12 -0
  120. metadata +100 -44
  121. data/test/functional.rb +0 -15
  122. data/test/test_package_task.rb +0 -118
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+ require 'rake/packagetask'
5
+ require 'test/rake_test_setup'
6
+
7
+ class TestPackageTask < Test::Unit::TestCase
8
+ include TestMethods
9
+
10
+ def test_initialize
11
+ pkg = Rake::PackageTask.new("pkgr", "1.2.3") { |p|
12
+ p.package_files << "install.rb"
13
+ p.package_files.include(
14
+ '[A-Z]*',
15
+ 'bin/**/*',
16
+ 'lib/**/*.rb',
17
+ 'test/**/*.rb',
18
+ 'doc/**/*',
19
+ 'build/rubyapp.rb',
20
+ '*.blurb')
21
+ p.package_files.exclude(/\bCVS\b/)
22
+ p.package_files.exclude(/~$/)
23
+ p.package_dir = 'pkg'
24
+ p.need_tar = true
25
+ p.need_tar_gz = true
26
+ p.need_tar_bz2 = true
27
+ p.need_zip = true
28
+ }
29
+
30
+ assert_equal "pkg", pkg.package_dir
31
+ assert pkg.package_files.include?("bin/rake")
32
+ assert_equal 'pkgr', pkg.name
33
+ assert_equal '1.2.3', pkg.version
34
+ assert Rake::Task[:package]
35
+ assert Rake::Task['pkg/pkgr-1.2.3.tgz']
36
+ assert Rake::Task['pkg/pkgr-1.2.3.tar.gz']
37
+ assert Rake::Task['pkg/pkgr-1.2.3.tar.bz2']
38
+ assert Rake::Task['pkg/pkgr-1.2.3.zip']
39
+ assert Rake::Task['pkg/pkgr-1.2.3']
40
+ assert Rake::Task[:clobber_package]
41
+ assert Rake::Task[:repackage]
42
+ end
43
+
44
+ def test_initialize_no_version
45
+ e = assert_raises RuntimeError do
46
+ Rake::PackageTask.new 'pkgr'
47
+ end
48
+
49
+ assert_equal 'Version required (or :noversion)', e.message
50
+ end
51
+
52
+ def test_initialize_noversion
53
+ pkg = Rake::PackageTask.new 'pkgr', :noversion
54
+
55
+ assert_equal 'pkg', pkg.package_dir
56
+ assert_equal 'pkgr', pkg.name
57
+ assert_equal nil, pkg.version
58
+ end
59
+
60
+ def test_clone
61
+ pkg = Rake::PackageTask.new("x", :noversion)
62
+ p2 = pkg.clone
63
+ pkg.package_files << "y"
64
+ p2.package_files << "x"
65
+ assert_equal ["y"], pkg.package_files
66
+ assert_equal ["x"], p2.package_files
67
+ end
68
+
69
+ def test_package_name
70
+ pkg = Rake::PackageTask.new 'a', '1'
71
+
72
+ assert_equal 'a-1', pkg.package_name
73
+ end
74
+
75
+ def test_package_name_noversion
76
+ pkg = Rake::PackageTask.new 'a', :noversion
77
+
78
+ assert_equal 'a', pkg.package_name
79
+ end
80
+
81
+ end
82
+
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'test/unit'
4
+ require 'test/rake_test_setup'
4
5
  require 'rake'
5
6
 
6
7
  # ====================================================================
@@ -26,7 +27,7 @@ class TestPathMap < Test::Unit::TestCase
26
27
 
27
28
  def test_n_returns_basename_without_extension
28
29
  assert_equal "abc", "abc.rb".pathmap("%n")
29
- assert_equal "abc", "abc".pathmap("%n")
30
+ assert_equal "abc", "abc".pathmap("%n")
30
31
  assert_equal "abc", "this/is/a/dir/abc.rb".pathmap("%n")
31
32
  assert_equal "abc", "/this/is/a/dir/abc.rb".pathmap("%n")
32
33
  assert_equal "abc", "/this/is/a/dir/abc".pathmap("%n")
@@ -87,7 +88,7 @@ class TestPathMap < Test::Unit::TestCase
87
88
  end
88
89
 
89
90
  def test_undefined_percent_causes_error
90
- ex = assert_exception(ArgumentError) {
91
+ assert_exception(ArgumentError) {
91
92
  "dir/abc.rb".pathmap("%z")
92
93
  }
93
94
  end
@@ -37,5 +37,5 @@ class TestRake < Test::Unit::TestCase
37
37
  def test_original_dir_reports_current_dir
38
38
  assert_equal Dir.pwd, Rake.original_dir
39
39
  end
40
-
40
+
41
41
  end
@@ -1,24 +1,31 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'test/unit'
4
- require 'rake/rdoctask'
4
+ require 'test/capture_stdout'
5
+ begin
6
+ old_verbose = $VERBOSE
7
+ $VERBOSE = nil
8
+ require 'rake/rdoctask'
9
+ ensure
10
+ $VERBOSE = old_verbose
11
+ end
5
12
  require 'test/rake_test_setup'
6
13
 
7
14
  class TestRDocTask < Test::Unit::TestCase
8
15
  include Rake
9
16
  include TestMethods
10
-
17
+
11
18
  def setup
12
19
  Task.clear
13
20
  end
14
-
21
+
15
22
  def test_tasks_creation
16
23
  Rake::RDocTask.new
17
24
  assert Task[:rdoc]
18
25
  assert Task[:clobber_rdoc]
19
26
  assert Task[:rerdoc]
20
27
  end
21
-
28
+
22
29
  def test_tasks_creation_with_custom_name_symbol
23
30
  rd = Rake::RDocTask.new(:rdoc_dev)
24
31
  assert Task[:rdoc_dev]
@@ -26,7 +33,7 @@ class TestRDocTask < Test::Unit::TestCase
26
33
  assert Task[:rerdoc_dev]
27
34
  assert_equal :rdoc_dev, rd.name
28
35
  end
29
-
36
+
30
37
  def test_tasks_creation_with_custom_name_string
31
38
  rd = Rake::RDocTask.new("rdoc_dev")
32
39
  assert Task[:rdoc_dev]
@@ -34,7 +41,7 @@ class TestRDocTask < Test::Unit::TestCase
34
41
  assert Task[:rerdoc_dev]
35
42
  assert_equal "rdoc_dev", rd.name
36
43
  end
37
-
44
+
38
45
  def test_tasks_creation_with_custom_name_hash
39
46
  options = { :rdoc => "rdoc", :clobber_rdoc => "rdoc:clean", :rerdoc => "rdoc:force" }
40
47
  rd = Rake::RDocTask.new(options)
@@ -44,45 +51,34 @@ class TestRDocTask < Test::Unit::TestCase
44
51
  assert_raises(RuntimeError) { Task[:clobber_rdoc] }
45
52
  assert_equal options, rd.name
46
53
  end
47
-
54
+
48
55
  def test_tasks_creation_with_custom_name_hash_will_use_default_if_an_option_isnt_given
49
- rd = Rake::RDocTask.new(:clobber_rdoc => "rdoc:clean")
56
+ Rake::RDocTask.new(:clobber_rdoc => "rdoc:clean")
50
57
  assert Task[:rdoc]
51
58
  assert Task[:"rdoc:clean"]
52
59
  assert Task[:rerdoc]
53
60
  end
54
-
61
+
55
62
  def test_tasks_creation_with_custom_name_hash_raises_exception_if_invalid_option_given
56
63
  assert_raises(ArgumentError) do
57
64
  Rake::RDocTask.new(:foo => "bar")
58
65
  end
59
-
66
+
60
67
  begin
61
68
  Rake::RDocTask.new(:foo => "bar")
62
69
  rescue ArgumentError => e
63
70
  assert_match(/foo/, e.message)
64
71
  end
65
72
  end
66
-
67
- def test_inline_source_is_enabled_by_default
68
- rd = Rake::RDocTask.new
69
- assert rd.option_list.include?('--inline-source')
70
- end
71
-
73
+
72
74
  def test_inline_source_option_is_only_appended_if_option_not_already_given
73
75
  rd = Rake::RDocTask.new
74
76
  rd.options << '--inline-source'
75
77
  assert_equal 1, rd.option_list.grep('--inline-source').size
76
-
78
+
77
79
  rd = Rake::RDocTask.new
78
80
  rd.options << '-S'
79
81
  assert_equal 1, rd.option_list.grep('-S').size
80
82
  assert_equal 0, rd.option_list.grep('--inline-source').size
81
83
  end
82
-
83
- def test_inline_source_option_can_be_disabled
84
- rd = Rake::RDocTask.new
85
- rd.inline_source = false
86
- assert !rd.option_list.include?('--inline-source')
87
- end
88
84
  end
@@ -17,8 +17,13 @@ class TestRequire < Test::Unit::TestCase
17
17
 
18
18
  def test_wont_reload_rake_library
19
19
  app = Rake::Application.new
20
+
21
+ paths = ['test/data/rakelib']
22
+ loaded_files = []
23
+ app.rake_require("test2", paths, loaded_files)
24
+
20
25
  assert ! app.instance_eval {
21
- rake_require("test2", ['test/data/rakelib'], ['test2'])
26
+ rake_require("test2", paths, loaded_files)
22
27
  }
23
28
  end
24
29
 
@@ -29,7 +34,8 @@ class TestRequire < Test::Unit::TestCase
29
34
  rake_require("testx", ['test/data/rakelib'], [])
30
35
  }
31
36
  }
32
- assert_match(/x/, ex.message)
37
+ assert_match(/(can *not|can't)\s+find/i, ex.message)
38
+ assert_match(/testx/, ex.message)
33
39
  end
34
40
  end
35
41
 
@@ -97,7 +97,7 @@ class TestRules < Test::Unit::TestCase
97
97
  assert_equal [OBJFILE], @runs
98
98
  end
99
99
 
100
- def test_file_names_beginning_with_dot_can_be_tricked_into_refering_to_file
100
+ def test_file_names_beginning_with_dot_can_be_tricked_into_referring_to_file
101
101
  verbose(false) do
102
102
  chdir("testdata") do
103
103
  create_file('.foo')
@@ -278,7 +278,6 @@ class TestRules < Test::Unit::TestCase
278
278
  end
279
279
 
280
280
  def test_rule_with_proc_dependent_will_trigger
281
- ran = false
282
281
  mkdir_p("testdata/src/jw")
283
282
  create_file("testdata/src/jw/X.java")
284
283
  rule %r(classes/.*\.class) => [
@@ -50,12 +50,12 @@ class TestTaskArguments < Test::Unit::TestCase
50
50
  assert_nil ta.cc
51
51
  end
52
52
 
53
- def test_args_can_reference_env_values
53
+ def test_args_do_not_reference_env_values
54
54
  ta = Rake::TaskArguments.new(["aa"], [1])
55
55
  ENV['rev'] = "1.2"
56
56
  ENV['VER'] = "2.3"
57
- assert_equal "1.2", ta.rev
58
- assert_equal "2.3", ta.ver
57
+ assert_nil ta.rev
58
+ assert_nil ta.ver
59
59
  end
60
60
 
61
61
  def test_creating_new_argument_scopes
@@ -73,7 +73,7 @@ class TestTaskArguments < Test::Unit::TestCase
73
73
  child = Rake::TaskArguments.new(['aa'], [2], parent)
74
74
  assert_equal 2, child.aa
75
75
  end
76
-
76
+
77
77
  def test_default_arguments_values_can_be_merged
78
78
  ta = Rake::TaskArguments.new(["aa", "bb"], [nil, "original_val"])
79
79
  ta.with_defaults({ :aa => 'default_val' })
@@ -81,7 +81,7 @@ class TestTaskArguments < Test::Unit::TestCase
81
81
  assert_equal 'original_val', ta[:bb]
82
82
  end
83
83
 
84
- def test_default_arguements_that_dont_match_names_are_ignored
84
+ def test_default_arguments_that_dont_match_names_are_ignored
85
85
  ta = Rake::TaskArguments.new(["aa", "bb"], [nil, "original_val"])
86
86
  ta.with_defaults({ "cc" => "default_val" })
87
87
  assert_nil ta[:cc]
@@ -65,14 +65,14 @@ class TestTaskManager < Test::Unit::TestCase
65
65
  end
66
66
 
67
67
  def test_name_lookup_with_implicit_file_tasks
68
- t = @tm["README"]
69
- assert_equal "README", t.name
68
+ t = @tm["README.rdoc"]
69
+ assert_equal "README.rdoc", t.name
70
70
  assert Rake::FileTask === t
71
71
  end
72
72
 
73
73
  def test_name_lookup_with_nonexistent_task
74
74
  assert_exception(RuntimeError) {
75
- t = @tm["DOES NOT EXIST"]
75
+ @tm["DOES NOT EXIST"]
76
76
  }
77
77
  end
78
78
 
@@ -129,7 +129,7 @@ class TestTaskManager < Test::Unit::TestCase
129
129
  end
130
130
  end
131
131
  assert_equal t1, @tm[:t, []]
132
- assert_equal t2, @tm[:t, ["a"]]
132
+ assert_equal t2, @tm[:t, ["a"]]
133
133
  assert_equal t3, @tm[:t, ["a", "b"]]
134
134
  assert_equal s, @tm[:s, ["a", "b"]]
135
135
  assert_equal s, @tm[:s, ["a"]]
@@ -147,7 +147,7 @@ class TestTaskManager < Test::Unit::TestCase
147
147
  @tm["a:x"].invoke
148
148
  assert_equal ["next z"], values
149
149
  end
150
-
150
+
151
151
  end
152
152
 
153
153
  class TestTaskManagerArgumentResolution < Test::Unit::TestCase
@@ -3,8 +3,6 @@
3
3
  require 'test/unit'
4
4
  require 'fileutils'
5
5
  require 'rake'
6
- require 'test/filecreation'
7
- require 'test/capture_stdout'
8
6
  require 'test/rake_test_setup'
9
7
 
10
8
  ######################################################################
@@ -12,9 +10,16 @@ class TestTask < Test::Unit::TestCase
12
10
  include CaptureStdout
13
11
  include Rake
14
12
  include TestMethods
13
+ include Rake::DSL
15
14
 
16
15
  def setup
17
16
  Task.clear
17
+ Rake::TaskManager.record_task_metadata = true
18
+ end
19
+
20
+ def teardown
21
+ super
22
+ Rake::TaskManager.record_task_metadata = false
18
23
  end
19
24
 
20
25
  def test_create
@@ -27,6 +32,8 @@ class TestTask < Test::Unit::TestCase
27
32
  assert_equal t, arg
28
33
  assert_nil t.source
29
34
  assert_equal [], t.sources
35
+ assert_equal 1, t.locations.size
36
+ assert_match(/#{Regexp.quote(__FILE__)}/, t.locations.first)
30
37
  end
31
38
 
32
39
  def test_inspect
@@ -61,7 +68,7 @@ class TestTask < Test::Unit::TestCase
61
68
  Rake.application.options.dryrun = true
62
69
  runlist = []
63
70
  t1 = task(:t1) { |t| runlist << t.name; 3321 }
64
- out = capture_stdout { t1.invoke }
71
+ out = capture_stderr { t1.invoke }
65
72
  assert_match(/execute .*t1/i, out)
66
73
  assert_match(/dry run/i, out)
67
74
  assert_no_match(/invoke/i, out)
@@ -73,7 +80,7 @@ class TestTask < Test::Unit::TestCase
73
80
  def test_tasks_can_be_traced
74
81
  Rake.application.options.trace = true
75
82
  t1 = task(:t1)
76
- out = capture_stdout {
83
+ out = capture_stderr {
77
84
  t1.invoke
78
85
  }
79
86
  assert_match(/invoke t1/i, out)
@@ -174,6 +181,56 @@ class TestTask < Test::Unit::TestCase
174
181
  assert_equal ["b", "c"], Task[:a].prerequisites
175
182
  end
176
183
 
184
+ def test_prerequiste_tasks_returns_tasks_not_strings
185
+ a = task :a => ["b", "c"]
186
+ b = task :b
187
+ c = task :c
188
+ assert_equal [b, c], a.prerequisite_tasks
189
+ end
190
+
191
+ def test_prerequiste_tasks_fails_if_prerequisites_are_undefined
192
+ a = task :a => ["b", "c"]
193
+ b = task :b
194
+ assert_exception(RuntimeError) do
195
+ a.prerequisite_tasks
196
+ end
197
+ end
198
+
199
+ def test_prerequiste_tasks_honors_namespaces
200
+ a = b = nil
201
+ namespace "X" do
202
+ a = task :a => ["b", "c"]
203
+ b = task :b
204
+ end
205
+ c = task :c
206
+
207
+ assert_equal [b, c], a.prerequisite_tasks
208
+ end
209
+
210
+ def test_timestamp_returns_now_if_all_prereqs_have_no_times
211
+ a = task :a => ["b", "c"]
212
+ b = task :b
213
+ c = task :c
214
+
215
+ faux_stamp = 100
216
+ flexmock(Time, :now => faux_stamp)
217
+
218
+ assert_equal faux_stamp, a.timestamp
219
+ end
220
+
221
+ def test_timestamp_returns_latest_prereq_timestamp
222
+ a = task :a => ["b", "c"]
223
+ b = task :b
224
+ c = task :c
225
+
226
+ faux_stamp = 100
227
+ flexmock(Time, :now => faux_stamp-10)
228
+ flexmock(b, :timestamp => faux_stamp - 1)
229
+ flexmock(c, :timestamp => faux_stamp)
230
+
231
+ assert_equal faux_stamp, a.timestamp
232
+ end
233
+
177
234
  def test_investigation_output
178
235
  t1 = task(:t1 => [:t2, :t3]) { |t| runlist << t.name; 3321 }
179
236
  task(:t2)
@@ -221,9 +278,17 @@ class TestTaskWithArguments < Test::Unit::TestCase
221
278
  include CaptureStdout
222
279
  include Rake
223
280
  include TestMethods
281
+ include Rake::DSL
224
282
 
225
283
  def setup
284
+ super
226
285
  Task.clear
286
+ Rake::TaskManager.record_task_metadata = true
287
+ end
288
+
289
+ def teardown
290
+ Rake::TaskManager.record_task_metadata = false
291
+ super
227
292
  end
228
293
 
229
294
  def test_no_args_given