drake 0.8.1.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. data/CHANGES +386 -0
  2. data/MIT-LICENSE +21 -0
  3. data/README +396 -0
  4. data/Rakefile +505 -0
  5. data/TODO +20 -0
  6. data/bin/drake +31 -0
  7. data/bin/rake +31 -0
  8. data/doc/example/Rakefile1 +38 -0
  9. data/doc/example/Rakefile2 +35 -0
  10. data/doc/example/a.c +6 -0
  11. data/doc/example/b.c +6 -0
  12. data/doc/example/main.c +11 -0
  13. data/doc/glossary.rdoc +51 -0
  14. data/doc/jamis.rb +591 -0
  15. data/doc/proto_rake.rdoc +127 -0
  16. data/doc/rake.1.gz +0 -0
  17. data/doc/rakefile.rdoc +534 -0
  18. data/doc/rational.rdoc +151 -0
  19. data/doc/release_notes/rake-0.4.14.rdoc +23 -0
  20. data/doc/release_notes/rake-0.4.15.rdoc +35 -0
  21. data/doc/release_notes/rake-0.5.0.rdoc +53 -0
  22. data/doc/release_notes/rake-0.5.3.rdoc +78 -0
  23. data/doc/release_notes/rake-0.5.4.rdoc +46 -0
  24. data/doc/release_notes/rake-0.6.0.rdoc +141 -0
  25. data/doc/release_notes/rake-0.7.0.rdoc +119 -0
  26. data/doc/release_notes/rake-0.7.1.rdoc +59 -0
  27. data/doc/release_notes/rake-0.7.2.rdoc +121 -0
  28. data/doc/release_notes/rake-0.7.3.rdoc +47 -0
  29. data/doc/release_notes/rake-0.8.0.rdoc +114 -0
  30. data/doc/release_notes/rake-0.8.2.rdoc +163 -0
  31. data/install.rb +88 -0
  32. data/lib/rake.rb +2538 -0
  33. data/lib/rake/classic_namespace.rb +8 -0
  34. data/lib/rake/clean.rb +33 -0
  35. data/lib/rake/comp_tree/algorithm.rb +234 -0
  36. data/lib/rake/comp_tree/bucket_ipc.rb +175 -0
  37. data/lib/rake/comp_tree/driver.rb +291 -0
  38. data/lib/rake/comp_tree/error.rb +51 -0
  39. data/lib/rake/comp_tree/node.rb +189 -0
  40. data/lib/rake/comp_tree/quix/builtin/kernel/tap.rb +57 -0
  41. data/lib/rake/comp_tree/quix/diagnostic.rb +92 -0
  42. data/lib/rake/comp_tree/quix/kernel.rb +109 -0
  43. data/lib/rake/comp_tree/retriable_fork.rb +66 -0
  44. data/lib/rake/comp_tree/task_node.rb +46 -0
  45. data/lib/rake/contrib/compositepublisher.rb +24 -0
  46. data/lib/rake/contrib/ftptools.rb +153 -0
  47. data/lib/rake/contrib/publisher.rb +75 -0
  48. data/lib/rake/contrib/rubyforgepublisher.rb +18 -0
  49. data/lib/rake/contrib/sshpublisher.rb +47 -0
  50. data/lib/rake/contrib/sys.rb +209 -0
  51. data/lib/rake/gempackagetask.rb +103 -0
  52. data/lib/rake/loaders/makefile.rb +35 -0
  53. data/lib/rake/packagetask.rb +185 -0
  54. data/lib/rake/parallel.rb +54 -0
  55. data/lib/rake/rake_test_loader.rb +5 -0
  56. data/lib/rake/rdoctask.rb +147 -0
  57. data/lib/rake/ruby182_test_unit_fix.rb +23 -0
  58. data/lib/rake/runtest.rb +23 -0
  59. data/lib/rake/tasklib.rb +23 -0
  60. data/lib/rake/testtask.rb +161 -0
  61. data/test/capture_stdout.rb +26 -0
  62. data/test/check_expansion.rb +5 -0
  63. data/test/contrib/test_sys.rb +47 -0
  64. data/test/data/chains/Rakefile +15 -0
  65. data/test/data/default/Rakefile +19 -0
  66. data/test/data/dryrun/Rakefile +22 -0
  67. data/test/data/file_creation_task/Rakefile +33 -0
  68. data/test/data/imports/Rakefile +19 -0
  69. data/test/data/imports/deps.mf +1 -0
  70. data/test/data/multidesc/Rakefile +17 -0
  71. data/test/data/namespace/Rakefile +57 -0
  72. data/test/data/rakelib/test1.rb +3 -0
  73. data/test/data/rbext/rakefile.rb +3 -0
  74. data/test/data/sample.mf +12 -0
  75. data/test/data/statusreturn/Rakefile +8 -0
  76. data/test/data/unittest/Rakefile +1 -0
  77. data/test/filecreation.rb +32 -0
  78. data/test/functional.rb +15 -0
  79. data/test/in_environment.rb +30 -0
  80. data/test/parallel.rb +3 -0
  81. data/test/rake_test_setup.rb +5 -0
  82. data/test/reqfile.rb +3 -0
  83. data/test/reqfile2.rb +3 -0
  84. data/test/session_functional.rb +324 -0
  85. data/test/shellcommand.rb +3 -0
  86. data/test/single_threaded.rb +2 -0
  87. data/test/test_application.rb +714 -0
  88. data/test/test_clean.rb +14 -0
  89. data/test/test_definitions.rb +82 -0
  90. data/test/test_earlytime.rb +35 -0
  91. data/test/test_extension.rb +63 -0
  92. data/test/test_file_creation_task.rb +62 -0
  93. data/test/test_file_task.rb +139 -0
  94. data/test/test_filelist.rb +618 -0
  95. data/test/test_fileutils.rb +250 -0
  96. data/test/test_ftp.rb +59 -0
  97. data/test/test_invocation_chain.rb +75 -0
  98. data/test/test_makefile_loader.rb +25 -0
  99. data/test/test_namespace.rb +36 -0
  100. data/test/test_package_task.rb +116 -0
  101. data/test/test_parallel.rb +47 -0
  102. data/test/test_pathmap.rb +209 -0
  103. data/test/test_rake.rb +41 -0
  104. data/test/test_require.rb +33 -0
  105. data/test/test_rules.rb +348 -0
  106. data/test/test_task_arguments.rb +89 -0
  107. data/test/test_task_manager.rb +172 -0
  108. data/test/test_tasklib.rb +12 -0
  109. data/test/test_tasks.rb +373 -0
  110. data/test/test_test_task.rb +75 -0
  111. data/test/test_top_level_functions.rb +84 -0
  112. metadata +190 -0
@@ -0,0 +1,116 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+ require 'rake/packagetask'
5
+
6
+ class TestPackageTask < Test::Unit::TestCase
7
+ include Rake
8
+
9
+ def test_create
10
+ pkg = Rake::PackageTask.new("pkgr", "1.2.3") { |p|
11
+ p.package_files << "install.rb"
12
+ p.package_files.include(
13
+ '[A-Z]*',
14
+ 'bin/**/*',
15
+ 'lib/**/*.rb',
16
+ 'test/**/*.rb',
17
+ 'doc/**/*',
18
+ 'build/rubyapp.rb',
19
+ '*.blurb')
20
+ p.package_files.exclude(/\bCVS\b/)
21
+ p.package_files.exclude(/~$/)
22
+ p.package_dir = 'pkg'
23
+ p.need_tar = true
24
+ p.need_tar_gz = true
25
+ p.need_tar_bz2 = true
26
+ p.need_zip = true
27
+ }
28
+ assert_equal "pkg", pkg.package_dir
29
+ assert pkg.package_files.include?("bin/rake")
30
+ assert "pkgr", pkg.name
31
+ assert "1.2.3", pkg.version
32
+ assert Task[:package]
33
+ assert Task['pkg/pkgr-1.2.3.tgz']
34
+ assert Task['pkg/pkgr-1.2.3.tar.gz']
35
+ assert Task['pkg/pkgr-1.2.3.tar.bz2']
36
+ assert Task['pkg/pkgr-1.2.3.zip']
37
+ assert Task["pkg/pkgr-1.2.3"]
38
+ assert Task[:clobber_package]
39
+ assert Task[:repackage]
40
+ end
41
+
42
+ def test_missing_version
43
+ assert_raises(RuntimeError) {
44
+ pkg = Rake::PackageTask.new("pkgr") { |p| }
45
+ }
46
+ end
47
+
48
+ def test_no_version
49
+ pkg = Rake::PackageTask.new("pkgr", :noversion) { |p| }
50
+ assert "pkgr", pkg.send(:package_name)
51
+ end
52
+
53
+ def test_clone
54
+ pkg = Rake::PackageTask.new("x", :noversion)
55
+ p2 = pkg.clone
56
+ pkg.package_files << "y"
57
+ p2.package_files << "x"
58
+ assert_equal ["y"], pkg.package_files
59
+ assert_equal ["x"], p2.package_files
60
+ end
61
+ end
62
+
63
+
64
+ begin
65
+ require 'rubygems'
66
+ require 'rake/gempackagetask'
67
+ rescue Exception
68
+ puts "WARNING: RubyGems not installed"
69
+ end
70
+
71
+ if ! defined?(Gem)
72
+ puts "WARNING: Unable to test GemPackaging ... requires RubyGems"
73
+ else
74
+ class TestGemPackageTask < Test::Unit::TestCase
75
+ def test_gem_package
76
+ gem = Gem::Specification.new do |g|
77
+ g.name = "pkgr"
78
+ g.version = "1.2.3"
79
+ g.files = FileList["x"].resolve
80
+ end
81
+ pkg = Rake::GemPackageTask.new(gem) do |p|
82
+ p.package_files << "y"
83
+ end
84
+ assert_equal ["x", "y"], pkg.package_files
85
+ assert_equal "pkgr-1.2.3.gem", pkg.gem_file
86
+ end
87
+
88
+ def test_gem_package_with_current_platform
89
+ gem = Gem::Specification.new do |g|
90
+ g.name = "pkgr"
91
+ g.version = "1.2.3"
92
+ g.files = FileList["x"].resolve
93
+ g.platform = Gem::Platform::CURRENT
94
+ end
95
+ pkg = Rake::GemPackageTask.new(gem) do |p|
96
+ p.package_files << "y"
97
+ end
98
+ assert_equal ["x", "y"], pkg.package_files
99
+ assert_match(/^pkgr-1\.2\.3-(\S+)\.gem$/, pkg.gem_file)
100
+ end
101
+
102
+ def test_gem_package_with_ruby_platform
103
+ gem = Gem::Specification.new do |g|
104
+ g.name = "pkgr"
105
+ g.version = "1.2.3"
106
+ g.files = FileList["x"].resolve
107
+ g.platform = Gem::Platform::RUBY
108
+ end
109
+ pkg = Rake::GemPackageTask.new(gem) do |p|
110
+ p.package_files << "y"
111
+ end
112
+ assert_equal ["x", "y"], pkg.package_files
113
+ assert_equal "pkgr-1.2.3.gem", pkg.gem_file
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,47 @@
1
+
2
+ require 'rbconfig'
3
+ require 'test/unit'
4
+
5
+ ENV["PATH"] =
6
+ File.expand_path(File.dirname(__FILE__) + "/../bin") +
7
+ ":" +
8
+ ENV["PATH"]
9
+
10
+ if Rake.application.num_threads > 1
11
+ class TestSimpleParallel < Test::Unit::TestCase
12
+ def test_1
13
+ here = File.dirname(__FILE__)
14
+
15
+ rake =
16
+ if Config::CONFIG["arch"] =~ %r!java!i
17
+ "jrake"
18
+ else
19
+ "rake"
20
+ end
21
+
22
+ ENV["RUBYLIB"] = lambda {
23
+ lib = File.expand_path("#{here}/../lib")
24
+ current = ENV["RUBYLIB"]
25
+ if current
26
+ "#{current}:#{lib}"
27
+ else
28
+ lib
29
+ end
30
+ }.call
31
+
32
+ Dir.chdir(here) {
33
+ [
34
+ "Rakefile.simple",
35
+ "Rakefile.seq",
36
+ ].each { |file|
37
+ (1..5).each { |n|
38
+ args = [rake, "--threads", n.to_s, "-f", file]
39
+ puts("-"*40)
40
+ puts(args.join(" "))
41
+ assert(system(*args))
42
+ }
43
+ }
44
+ }
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,209 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+ require 'rake'
5
+
6
+ # ====================================================================
7
+ class TestPathMap < Test::Unit::TestCase
8
+
9
+ def test_returns_self_with_no_args
10
+ assert_equal "abc.rb", "abc.rb".pathmap
11
+ end
12
+
13
+ def test_s_returns_file_separator
14
+ sep = File::ALT_SEPARATOR || File::SEPARATOR
15
+ assert_equal sep, "abc.rb".pathmap("%s")
16
+ assert_equal sep, "".pathmap("%s")
17
+ assert_equal "a#{sep}b", "a/b".pathmap("%d%s%f")
18
+ end
19
+
20
+ def test_f_returns_basename
21
+ assert_equal "abc.rb", "abc.rb".pathmap("%f")
22
+ assert_equal "abc.rb", "this/is/a/dir/abc.rb".pathmap("%f")
23
+ assert_equal "abc.rb", "/this/is/a/dir/abc.rb".pathmap("%f")
24
+ end
25
+
26
+ def test_n_returns_basename_without_extension
27
+ assert_equal "abc", "abc.rb".pathmap("%n")
28
+ assert_equal "abc", "abc".pathmap("%n")
29
+ assert_equal "abc", "this/is/a/dir/abc.rb".pathmap("%n")
30
+ assert_equal "abc", "/this/is/a/dir/abc.rb".pathmap("%n")
31
+ assert_equal "abc", "/this/is/a/dir/abc".pathmap("%n")
32
+ end
33
+
34
+ def test_d_returns_dirname
35
+ assert_equal ".", "abc.rb".pathmap("%d")
36
+ assert_equal "/", "/abc".pathmap("%d")
37
+ assert_equal "this/is/a/dir", "this/is/a/dir/abc.rb".pathmap("%d")
38
+ assert_equal "/this/is/a/dir", "/this/is/a/dir/abc.rb".pathmap("%d")
39
+ end
40
+
41
+ def test_9d_returns_partial_dirname
42
+ assert_equal "this/is", "this/is/a/dir/abc.rb".pathmap("%2d")
43
+ assert_equal "this", "this/is/a/dir/abc.rb".pathmap("%1d")
44
+ assert_equal ".", "this/is/a/dir/abc.rb".pathmap("%0d")
45
+ assert_equal "dir", "this/is/a/dir/abc.rb".pathmap("%-1d")
46
+ assert_equal "a/dir", "this/is/a/dir/abc.rb".pathmap("%-2d")
47
+ assert_equal "this/is/a/dir", "this/is/a/dir/abc.rb".pathmap("%100d")
48
+ assert_equal "this/is/a/dir", "this/is/a/dir/abc.rb".pathmap("%-100d")
49
+ end
50
+
51
+ def test_x_returns_extension
52
+ assert_equal "", "abc".pathmap("%x")
53
+ assert_equal ".rb", "abc.rb".pathmap("%x")
54
+ assert_equal ".rb", "abc.xyz.rb".pathmap("%x")
55
+ assert_equal "", ".depends".pathmap("%x")
56
+ assert_equal "", "dir/.depends".pathmap("%x")
57
+ end
58
+
59
+ def test_X_returns_everything_but_extension
60
+ assert_equal "abc", "abc".pathmap("%X")
61
+ assert_equal "abc", "abc.rb".pathmap("%X")
62
+ assert_equal "abc.xyz", "abc.xyz.rb".pathmap("%X")
63
+ assert_equal "ab.xyz", "ab.xyz.rb".pathmap("%X")
64
+ assert_equal "a.xyz", "a.xyz.rb".pathmap("%X")
65
+ assert_equal "abc", "abc.rb".pathmap("%X")
66
+ assert_equal "ab", "ab.rb".pathmap("%X")
67
+ assert_equal "a", "a.rb".pathmap("%X")
68
+ assert_equal ".depends", ".depends".pathmap("%X")
69
+ assert_equal "a/dir/.depends", "a/dir/.depends".pathmap("%X")
70
+ assert_equal "/.depends", "/.depends".pathmap("%X")
71
+ end
72
+
73
+ def test_p_returns_entire_pathname
74
+ assert_equal "abc.rb", "abc.rb".pathmap("%p")
75
+ assert_equal "this/is/a/dir/abc.rb", "this/is/a/dir/abc.rb".pathmap("%p")
76
+ assert_equal "/this/is/a/dir/abc.rb", "/this/is/a/dir/abc.rb".pathmap("%p")
77
+ end
78
+
79
+ def test_dash_returns_empty_string
80
+ assert_equal "", "abc.rb".pathmap("%-")
81
+ assert_equal "abc.rb", "abc.rb".pathmap("%X%-%x")
82
+ end
83
+
84
+ def test_percent_percent_returns_percent
85
+ assert_equal "a%b", "".pathmap("a%%b")
86
+ end
87
+
88
+ def test_undefined_percent_causes_error
89
+ ex = assert_raise(ArgumentError) {
90
+ "dir/abc.rb".pathmap("%z")
91
+ }
92
+ end
93
+
94
+ def test_pattern_returns_substitutions
95
+ assert_equal "bin/org/osb",
96
+ "src/org/osb/Xyz.java".pathmap("%{src,bin}d")
97
+ end
98
+
99
+ def test_pattern_can_use_backreferences
100
+ assert_equal "dir/hi/is", "dir/this/is".pathmap("%{t(hi)s,\\1}p")
101
+ end
102
+
103
+ def test_pattern_with_star_replacement_string_uses_block
104
+ assert_equal "src/ORG/osb",
105
+ "src/org/osb/Xyz.java".pathmap("%{/org,*}d") { |d| d.upcase }
106
+ assert_equal "Xyz.java",
107
+ "src/org/osb/Xyz.java".pathmap("%{.*,*}f") { |f| f.capitalize }
108
+ end
109
+
110
+ def test_pattern_with_no_replacement_nor_block_substitutes_empty_string
111
+ assert_equal "bc.rb", "abc.rb".pathmap("%{a}f")
112
+ end
113
+
114
+ def test_pattern_works_with_certain_valid_operators
115
+ assert_equal "dir/xbc.rb", "dir/abc.rb".pathmap("%{a,x}p")
116
+ assert_equal "d1r", "dir/abc.rb".pathmap("%{i,1}d")
117
+ assert_equal "xbc.rb", "dir/abc.rb".pathmap("%{a,x}f")
118
+ assert_equal ".Rb", "dir/abc.rb".pathmap("%{r,R}x")
119
+ assert_equal "xbc", "dir/abc.rb".pathmap("%{a,x}n")
120
+ end
121
+
122
+ def test_multiple_patterns
123
+ assert_equal "this/is/b/directory/abc.rb",
124
+ "this/is/a/dir/abc.rb".pathmap("%{a,b;dir,\\0ectory}p")
125
+ end
126
+
127
+ def test_partial_directory_selection_works_with_patterns
128
+ assert_equal "this/is/a/long",
129
+ "this/is/a/really/long/path/ok.rb".pathmap("%{/really/,/}5d")
130
+ end
131
+
132
+ def test_pattern_with_invalid_operator
133
+ ex = assert_raise(ArgumentError) do
134
+ "abc.xyz".pathmap("%{src,bin}z")
135
+ end
136
+ assert_match(/unknown.*pathmap.*spec.*z/i, ex.message)
137
+ end
138
+
139
+ def test_works_with_windows_separators
140
+ if File::ALT_SEPARATOR
141
+ assert_equal "abc", 'dir\abc.rb'.pathmap("%n")
142
+ assert_equal 'this\is\a\dir',
143
+ 'this\is\a\dir\abc.rb'.pathmap("%d")
144
+ end
145
+ end
146
+
147
+ def test_complex_patterns
148
+ sep = "".pathmap("%s")
149
+ assert_equal "dir/abc.rb", "dir/abc.rb".pathmap("%d/%n%x")
150
+ assert_equal "./abc.rb", "abc.rb".pathmap("%d/%n%x")
151
+ assert_equal "Your file extension is '.rb'",
152
+ "dir/abc.rb".pathmap("Your file extension is '%x'")
153
+ assert_equal "bin/org/onstepback/proj/A.class",
154
+ "src/org/onstepback/proj/A.java".pathmap("%{src,bin}d/%n.class")
155
+ assert_equal "src_work/bin/org/onstepback/proj/A.class",
156
+ "src_work/src/org/onstepback/proj/A.java".pathmap('%{\bsrc\b,bin}X.class')
157
+ assert_equal ".depends.bak", ".depends".pathmap("%X.bak")
158
+ assert_equal "d#{sep}a/b/c#{sep}file.txt", "a/b/c/d/file.txt".pathmap("%-1d%s%3d%s%f")
159
+ end
160
+ end
161
+
162
+ class TestPathMapExplode < Test::Unit::TestCase
163
+ def setup
164
+ String.class_eval { public :pathmap_explode }
165
+ end
166
+
167
+ def teardown
168
+ String.class_eval { protected :pathmap_explode }
169
+ end
170
+
171
+ def test_explode
172
+ assert_equal ['a'], 'a'.pathmap_explode
173
+ assert_equal ['a', 'b'], 'a/b'.pathmap_explode
174
+ assert_equal ['a', 'b', 'c'], 'a/b/c'.pathmap_explode
175
+ assert_equal ['/', 'a'], '/a'.pathmap_explode
176
+ assert_equal ['/', 'a', 'b'], '/a/b'.pathmap_explode
177
+ assert_equal ['/', 'a', 'b', 'c'], '/a/b/c'.pathmap_explode
178
+ if File::ALT_SEPARATOR
179
+ assert_equal ['c:.', 'a'], 'c:a'.pathmap_explode
180
+ assert_equal ['c:.', 'a', 'b'], 'c:a/b'.pathmap_explode
181
+ assert_equal ['c:.', 'a', 'b', 'c'], 'c:a/b/c'.pathmap_explode
182
+ assert_equal ['c:/', 'a'], 'c:/a'.pathmap_explode
183
+ assert_equal ['c:/', 'a', 'b'], 'c:/a/b'.pathmap_explode
184
+ assert_equal ['c:/', 'a', 'b', 'c'], 'c:/a/b/c'.pathmap_explode
185
+ end
186
+ end
187
+ end
188
+
189
+ class TestPathMapPartial < Test::Unit::TestCase
190
+ def test_pathmap_partial
191
+ @path = "1/2/file"
192
+ def @path.call(n)
193
+ pathmap_partial(n)
194
+ end
195
+ assert_equal("1", @path.call(1))
196
+ assert_equal("1/2", @path.call(2))
197
+ assert_equal("1/2", @path.call(3))
198
+ assert_equal(".", @path.call(0))
199
+ assert_equal("2", @path.call(-1))
200
+ assert_equal("1/2", @path.call(-2))
201
+ assert_equal("1/2", @path.call(-3))
202
+ end
203
+ end
204
+
205
+ class TestFileListPathMap < Test::Unit::TestCase
206
+ def test_file_list_supports_pathmap
207
+ assert_equal ['a', 'b'], FileList['dir/a.rb', 'dir/b.rb'].pathmap("%n")
208
+ end
209
+ end
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+ require 'rake'
5
+
6
+ class TestRake < Test::Unit::TestCase
7
+ def test_each_dir_parent
8
+ assert_equal ['a'], alldirs('a')
9
+ assert_equal ['a/b', 'a'], alldirs('a/b')
10
+ assert_equal ['/a/b', '/a', '/'], alldirs('/a/b')
11
+ if File.dirname("c:/foo") == "c:"
12
+ # Under Unix
13
+ assert_equal ['c:/a/b', 'c:/a', 'c:'], alldirs('c:/a/b')
14
+ assert_equal ['c:a/b', 'c:a'], alldirs('c:a/b')
15
+ else
16
+ # Under Windows
17
+ assert_equal ['c:/a/b', 'c:/a', 'c:/'], alldirs('c:/a/b')
18
+ assert_equal ['c:a/b', 'c:a'], alldirs('c:a/b')
19
+ end
20
+ end
21
+
22
+ def alldirs(fn)
23
+ result = []
24
+ Rake.each_dir_parent(fn) { |d| result << d }
25
+ result
26
+ end
27
+
28
+ def test_can_override_application
29
+ old_app = Rake.application
30
+ fake_app = Object.new
31
+ Rake.application = fake_app
32
+ assert_equal fake_app, Rake.application
33
+ ensure
34
+ Rake.application = old_app
35
+ end
36
+
37
+ def test_original_dir_reports_current_dir
38
+ assert_equal Dir.pwd, Rake.original_dir
39
+ end
40
+
41
+ end
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+ require 'rake'
5
+
6
+ # ====================================================================
7
+ class TestRequire < Test::Unit::TestCase
8
+
9
+ def test_can_load_rake_library
10
+ app = Rake::Application.new
11
+ assert app.instance_eval {
12
+ rake_require("test2", ['test/data/rakelib'], [])
13
+ }
14
+ end
15
+
16
+ def test_wont_reload_rake_library
17
+ app = Rake::Application.new
18
+ assert ! app.instance_eval {
19
+ rake_require("test2", ['test/data/rakelib'], ['test2'])
20
+ }
21
+ end
22
+
23
+ def test_throws_error_if_library_not_found
24
+ app = Rake::Application.new
25
+ ex = assert_raise(LoadError) {
26
+ assert app.instance_eval {
27
+ rake_require("testx", ['test/data/rakelib'], [])
28
+ }
29
+ }
30
+ assert_match(/x/, ex.message)
31
+ end
32
+ end
33
+