drake 0.8.3.1.0.14 → 0.8.4.1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +27 -0
- data/CHANGES.drake +4 -0
- data/README +98 -198
- data/Rakefile +2 -4
- data/Rakefile.drake +0 -4
- data/doc/command_line_usage.rdoc +102 -0
- data/doc/rakefile.rdoc +4 -4
- data/doc/release_notes/rake-0.8.4.rdoc +147 -0
- data/lib/rake.rb +94 -60
- data/lib/rake/alt_system.rb +108 -0
- data/lib/rake/contrib/publisher.rb +1 -1
- data/lib/rake/contrib/sys.rb +1 -1
- data/lib/rake/gempackagetask.rb +0 -6
- data/lib/rake/loaders/makefile.rb +8 -1
- data/lib/rake/packagetask.rb +0 -1
- data/lib/rake/rdoctask.rb +79 -17
- data/lib/rake/testtask.rb +1 -1
- data/lib/rake/win32.rb +11 -10
- data/test/Rakefile.seq +1 -1
- data/test/Rakefile.simple +14 -25
- data/test/check_no_expansion.rb +5 -0
- data/test/data/sample.mf +2 -0
- data/test/rake_test_setup.rb +14 -0
- data/test/session_functional.rb +2 -0
- data/test/test_application.rb +25 -44
- data/test/test_definitions.rb +4 -1
- data/test/test_file_task.rb +20 -16
- data/test/test_filelist.rb +8 -3
- data/test/test_fileutils.rb +45 -44
- data/test/test_invocation_chain.rb +8 -2
- data/test/test_makefile_loader.rb +2 -1
- data/test/test_namespace.rb +30 -11
- data/test/test_package_task.rb +3 -1
- data/test/test_parallel.rb +4 -15
- data/test/test_pathmap.rb +3 -2
- data/test/test_pseudo_status.rb +26 -0
- data/test/test_rdoc_task.rb +88 -0
- data/test/test_require.rb +3 -1
- data/test/test_rules.rb +7 -5
- data/test/test_task_manager.rb +4 -1
- data/test/test_tasks.rb +7 -4
- data/test/test_test_task.rb +2 -0
- data/test/test_top_level_functions.rb +4 -2
- data/test/test_win32.rb +29 -14
- metadata +12 -4
data/test/data/sample.mf
CHANGED
data/test/rake_test_setup.rb
CHANGED
@@ -8,3 +8,17 @@ rescue LoadError
|
|
8
8
|
end
|
9
9
|
|
10
10
|
require 'flexmock/test_unit'
|
11
|
+
|
12
|
+
if RUBY_VERSION >= "1.9.0"
|
13
|
+
class Test::Unit::TestCase
|
14
|
+
# def passed?
|
15
|
+
# true
|
16
|
+
# end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
module TestMethods
|
21
|
+
def assert_exception(ex, msg=nil, &block)
|
22
|
+
assert_raise(ex, msg, &block)
|
23
|
+
end
|
24
|
+
end
|
data/test/session_functional.rb
CHANGED
@@ -8,6 +8,7 @@ require 'test/unit'
|
|
8
8
|
require 'fileutils'
|
9
9
|
require 'session'
|
10
10
|
require 'test/in_environment'
|
11
|
+
require 'test/rake_test_setup'
|
11
12
|
|
12
13
|
# Version 2.1.9 of session has a bug where the @debug instance
|
13
14
|
# variable is not initialized, causing warning messages. This snippet
|
@@ -24,6 +25,7 @@ end
|
|
24
25
|
|
25
26
|
class FunctionalTest < Test::Unit::TestCase
|
26
27
|
include InEnvironment
|
28
|
+
include TestMethods
|
27
29
|
|
28
30
|
RUBY_COMMAND = 'ruby'
|
29
31
|
|
data/test/test_application.rb
CHANGED
@@ -18,6 +18,7 @@ TESTING_REQUIRE = [ ]
|
|
18
18
|
class TestApplication < Test::Unit::TestCase
|
19
19
|
include CaptureStdout
|
20
20
|
include InEnvironment
|
21
|
+
include TestMethods
|
21
22
|
|
22
23
|
def setup
|
23
24
|
@app = Rake::Application.new
|
@@ -109,7 +110,7 @@ class TestApplication < Test::Unit::TestCase
|
|
109
110
|
end
|
110
111
|
|
111
112
|
def test_finding_rakefile
|
112
|
-
assert_match(/
|
113
|
+
assert_match(/Rakefile/i, @app.instance_eval { have_rakefile })
|
113
114
|
end
|
114
115
|
|
115
116
|
def test_not_finding_rakefile
|
@@ -148,7 +149,7 @@ class TestApplication < Test::Unit::TestCase
|
|
148
149
|
handle_options
|
149
150
|
options.silent = true
|
150
151
|
end
|
151
|
-
ex =
|
152
|
+
ex = assert_exception(RuntimeError) do
|
152
153
|
@app.instance_eval do raw_load_rakefile end
|
153
154
|
end
|
154
155
|
assert_match(/no rakefile found/i, ex.message)
|
@@ -162,6 +163,7 @@ class TestApplication < Test::Unit::TestCase
|
|
162
163
|
handle_options
|
163
164
|
options.silent = true
|
164
165
|
options.load_system = true
|
166
|
+
options.rakelib = []
|
165
167
|
load_rakefile
|
166
168
|
end
|
167
169
|
assert_equal "test/data/sys", @app.system_dir
|
@@ -169,46 +171,10 @@ class TestApplication < Test::Unit::TestCase
|
|
169
171
|
end
|
170
172
|
end
|
171
173
|
|
172
|
-
def test_load_from_system_rakefile_on_unix
|
173
|
-
flexmock(@app, :windows? => false,
|
174
|
-
:win32_system_dir => nil,
|
175
|
-
:load => nil)
|
176
|
-
flexmock(File).should_receive(:expand_path).with("~").and_return("/HOME")
|
177
|
-
flexmock(File).should_receive(:expand_path).and_return { |fn| fn }
|
178
|
-
|
179
|
-
in_environment('RAKE_SYSTEM' => nil) do
|
180
|
-
@app.options.rakelib = []
|
181
|
-
@app.instance_eval do
|
182
|
-
handle_options
|
183
|
-
options.silent = true
|
184
|
-
options.load_system = true
|
185
|
-
load_rakefile
|
186
|
-
end
|
187
|
-
assert_equal "/HOME/.rake", @app.system_dir
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
174
|
def test_windows
|
192
175
|
assert ! (@app.windows? && @app.unix?)
|
193
176
|
end
|
194
177
|
|
195
|
-
def test_load_from_system_rakefile_on_windows
|
196
|
-
flexmock(Rake::Win32, :windows? => true)
|
197
|
-
flexmock(@app, :standard_system_dir => "XX")
|
198
|
-
flexmock(@app).should_receive(:directory?).with("/AD/Rake").and_return(true)
|
199
|
-
flexmock(@app).should_receive(:load).and_return(nil)
|
200
|
-
in_environment('RAKE_SYSTEM' => nil, 'APPDATA' => '/AD') do
|
201
|
-
@app.options.rakelib = []
|
202
|
-
@app.instance_eval do
|
203
|
-
handle_options
|
204
|
-
options.silent = true
|
205
|
-
options.load_system = true
|
206
|
-
load_rakefile
|
207
|
-
end
|
208
|
-
assert_equal "/AD/Rake", @app.system_dir
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
178
|
def test_loading_imports
|
213
179
|
mock = flexmock("loader")
|
214
180
|
mock.should_receive(:load).with("x.dummy").once
|
@@ -231,6 +197,19 @@ class TestApplication < Test::Unit::TestCase
|
|
231
197
|
end
|
232
198
|
end
|
233
199
|
|
200
|
+
def test_handle_options_should_strip_options_from_ARGV
|
201
|
+
assert !@app.options.trace
|
202
|
+
|
203
|
+
valid_option = '--trace'
|
204
|
+
ARGV.clear
|
205
|
+
ARGV << valid_option
|
206
|
+
|
207
|
+
@app.handle_options
|
208
|
+
|
209
|
+
assert !ARGV.include?(valid_option)
|
210
|
+
assert @app.options.trace
|
211
|
+
end
|
212
|
+
|
234
213
|
def test_good_run
|
235
214
|
ran = false
|
236
215
|
ARGV.clear
|
@@ -279,7 +258,7 @@ class TestApplication < Test::Unit::TestCase
|
|
279
258
|
@app.intern(Rake::Task, "default").enhance { fail }
|
280
259
|
ARGV.clear
|
281
260
|
ARGV << '-f' << '-s' << '--rakelib=""'
|
282
|
-
|
261
|
+
assert_exception(SystemExit) {
|
283
262
|
err = capture_stderr { @app.run }
|
284
263
|
assert_match(/see full trace/, err)
|
285
264
|
}
|
@@ -291,7 +270,7 @@ class TestApplication < Test::Unit::TestCase
|
|
291
270
|
@app.intern(Rake::Task, "default").enhance { fail }
|
292
271
|
ARGV.clear
|
293
272
|
ARGV << '-f' << '-s' << '-t'
|
294
|
-
|
273
|
+
assert_exception(SystemExit) {
|
295
274
|
err = capture_stderr { capture_stdout { @app.run } }
|
296
275
|
assert_no_match(/see full trace/, err)
|
297
276
|
}
|
@@ -303,7 +282,7 @@ class TestApplication < Test::Unit::TestCase
|
|
303
282
|
@app.intern(Rake::Task, "default").enhance { fail }
|
304
283
|
ARGV.clear
|
305
284
|
ARGV << '-f' << '-s' << '--xyzzy'
|
306
|
-
|
285
|
+
assert_exception(SystemExit) {
|
307
286
|
err = capture_stderr { capture_stdout { @app.run } }
|
308
287
|
}
|
309
288
|
ensure
|
@@ -315,6 +294,7 @@ end
|
|
315
294
|
######################################################################
|
316
295
|
class TestApplicationOptions < Test::Unit::TestCase
|
317
296
|
include CaptureStdout
|
297
|
+
include TestMethods
|
318
298
|
|
319
299
|
def setup
|
320
300
|
clear_argv
|
@@ -447,7 +427,7 @@ class TestApplicationOptions < Test::Unit::TestCase
|
|
447
427
|
end
|
448
428
|
|
449
429
|
def test_missing_require
|
450
|
-
ex =
|
430
|
+
ex = assert_exception(LoadError) do
|
451
431
|
flags(['--require', 'test/missing']) do |opts|
|
452
432
|
end
|
453
433
|
end
|
@@ -546,7 +526,7 @@ class TestApplicationOptions < Test::Unit::TestCase
|
|
546
526
|
|
547
527
|
def test_bad_option
|
548
528
|
capture_stderr do
|
549
|
-
ex =
|
529
|
+
ex = assert_exception(OptionParser::InvalidOption) do
|
550
530
|
flags('--bad-option')
|
551
531
|
end
|
552
532
|
if ex.message =~ /^While/ # Ruby 1.9 error message
|
@@ -594,7 +574,8 @@ class TestApplicationOptions < Test::Unit::TestCase
|
|
594
574
|
throw :system_exit, :exit
|
595
575
|
end
|
596
576
|
@app.instance_eval do
|
597
|
-
|
577
|
+
handle_options
|
578
|
+
collect_tasks
|
598
579
|
end
|
599
580
|
@tasks = @app.top_level_tasks
|
600
581
|
@app.options
|
data/test/test_definitions.rb
CHANGED
@@ -4,10 +4,13 @@ require 'test/unit'
|
|
4
4
|
require 'fileutils'
|
5
5
|
require 'rake'
|
6
6
|
require 'test/filecreation'
|
7
|
+
require 'test/rake_test_setup'
|
7
8
|
|
8
9
|
######################################################################
|
9
10
|
class TestDefinitions < Test::Unit::TestCase
|
10
11
|
include Rake
|
12
|
+
include TestMethods
|
13
|
+
|
11
14
|
EXISTINGFILE = "testdata/existing"
|
12
15
|
|
13
16
|
def setup
|
@@ -58,7 +61,7 @@ class TestDefinitions < Test::Unit::TestCase
|
|
58
61
|
|
59
62
|
def test_missing_dependencies
|
60
63
|
task :x => ["testdata/missing"]
|
61
|
-
|
64
|
+
assert_exception(RuntimeError) { Task[:x].invoke }
|
62
65
|
end
|
63
66
|
|
64
67
|
def test_implicit_file_dependencies
|
data/test/test_file_task.rb
CHANGED
@@ -4,11 +4,13 @@ require 'test/unit'
|
|
4
4
|
require 'fileutils'
|
5
5
|
require 'rake'
|
6
6
|
require 'test/filecreation'
|
7
|
+
require 'test/rake_test_setup'
|
7
8
|
|
8
9
|
######################################################################
|
9
10
|
class TestFileTask < Test::Unit::TestCase
|
10
11
|
include Rake
|
11
12
|
include FileCreation
|
13
|
+
include TestMethods
|
12
14
|
|
13
15
|
def setup
|
14
16
|
Task.clear
|
@@ -118,22 +120,24 @@ class TestDirectoryTask < Test::Unit::TestCase
|
|
118
120
|
assert ! File.exist?("testdata/a/b/c")
|
119
121
|
end
|
120
122
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
123
|
+
if Rake::Win32.windows?
|
124
|
+
def test_directory_win32
|
125
|
+
desc "WIN32 DESC"
|
126
|
+
FileUtils.mkdir_p("testdata")
|
127
|
+
Dir.chdir("testdata") do
|
128
|
+
directory 'c:/testdata/a/b/c'
|
129
|
+
assert_equal FileCreationTask, Task['c:/testdata'].class
|
130
|
+
assert_equal FileCreationTask, Task['c:/testdata/a'].class
|
131
|
+
assert_equal FileCreationTask, Task['c:/testdata/a/b/c'].class
|
132
|
+
assert_nil Task['c:/testdata'].comment
|
133
|
+
assert_equal "WIN32 DESC", Task['c:/testdata/a/b/c'].comment
|
134
|
+
assert_nil Task['c:/testdata/a/b'].comment
|
135
|
+
verbose(false) {
|
136
|
+
Task['c:/testdata/a/b'].invoke
|
137
|
+
}
|
138
|
+
assert File.exist?('c:/testdata/a/b')
|
139
|
+
assert ! File.exist?('c:/testdata/a/b/c')
|
140
|
+
end
|
137
141
|
end
|
138
142
|
end
|
139
143
|
end
|
data/test/test_filelist.rb
CHANGED
@@ -4,10 +4,12 @@ require 'test/unit'
|
|
4
4
|
require 'rake'
|
5
5
|
|
6
6
|
require 'test/capture_stdout'
|
7
|
+
require 'test/rake_test_setup'
|
7
8
|
|
8
9
|
class TestFileList < Test::Unit::TestCase
|
9
10
|
FileList = Rake::FileList
|
10
11
|
include CaptureStdout
|
12
|
+
include TestMethods
|
11
13
|
|
12
14
|
def setup
|
13
15
|
create_test_data
|
@@ -283,9 +285,7 @@ class TestFileList < Test::Unit::TestCase
|
|
283
285
|
assert_equal "one.two.net", "one.two.c".ext(".net")
|
284
286
|
assert_equal "one/two.net", "one/two.c".ext(".net")
|
285
287
|
assert_equal "one.x/two.net", "one.x/two.c".ext(".net")
|
286
|
-
assert_equal "one.x\\two.net", "one.x\\two.c".ext(".net")
|
287
288
|
assert_equal "one.x/two.net", "one.x/two".ext(".net")
|
288
|
-
assert_equal "one.x\\two.net", "one.x\\two".ext(".net")
|
289
289
|
assert_equal ".onerc.net", ".onerc.dot".ext("net")
|
290
290
|
assert_equal ".onerc.net", ".onerc".ext("net")
|
291
291
|
assert_equal ".a/.onerc.net", ".a/.onerc".ext("net")
|
@@ -295,6 +295,11 @@ class TestFileList < Test::Unit::TestCase
|
|
295
295
|
assert_equal ".one", ".one".ext
|
296
296
|
assert_equal ".", ".".ext("c")
|
297
297
|
assert_equal "..", "..".ext("c")
|
298
|
+
# These only need to work in windows
|
299
|
+
if Rake::Win32.windows?
|
300
|
+
assert_equal "one.x\\two.net", "one.x\\two.c".ext(".net")
|
301
|
+
assert_equal "one.x\\two.net", "one.x\\two".ext(".net")
|
302
|
+
end
|
298
303
|
end
|
299
304
|
|
300
305
|
def test_filelist_ext
|
@@ -442,7 +447,7 @@ class TestFileList < Test::Unit::TestCase
|
|
442
447
|
a = FileList['a', 'b', 'c']
|
443
448
|
a.freeze
|
444
449
|
c = a.clone
|
445
|
-
|
450
|
+
assert_exception(TypeError, RuntimeError) do
|
446
451
|
c << 'more'
|
447
452
|
end
|
448
453
|
end
|
data/test/test_fileutils.rb
CHANGED
@@ -5,9 +5,11 @@ require 'test/unit'
|
|
5
5
|
require 'test/filecreation'
|
6
6
|
require 'fileutils'
|
7
7
|
require 'stringio'
|
8
|
+
require 'test/rake_test_setup'
|
8
9
|
|
9
10
|
class TestFileUtils < Test::Unit::TestCase
|
10
11
|
include FileCreation
|
12
|
+
include TestMethods
|
11
13
|
|
12
14
|
def setup
|
13
15
|
File.chmod(0750,"test/shellcommand.rb")
|
@@ -81,7 +83,7 @@ class TestFileUtils < Test::Unit::TestCase
|
|
81
83
|
def test_safe_ln_fails_on_script_error
|
82
84
|
FileUtils::LN_SUPPORTED[0] = true
|
83
85
|
c = BadLink.new(ScriptError)
|
84
|
-
|
86
|
+
assert_exception(ScriptError) do c.safe_ln "a", "b" end
|
85
87
|
end
|
86
88
|
|
87
89
|
def test_verbose
|
@@ -114,8 +116,8 @@ class TestFileUtils < Test::Unit::TestCase
|
|
114
116
|
|
115
117
|
def test_fileutils_methods_dont_leak
|
116
118
|
obj = Object.new
|
117
|
-
|
118
|
-
|
119
|
+
assert_exception(NoMethodError) { obj.copy } # from FileUtils
|
120
|
+
assert_exception(NoMethodError) { obj.ruby } # from RubyFileUtils
|
119
121
|
end
|
120
122
|
|
121
123
|
def test_sh
|
@@ -123,21 +125,37 @@ class TestFileUtils < Test::Unit::TestCase
|
|
123
125
|
assert true, "should not fail"
|
124
126
|
end
|
125
127
|
|
126
|
-
|
128
|
+
# If the :sh method is invoked directly from a test unit instance
|
129
|
+
# (under mini/test), the mini/test version of fail is invoked rather
|
130
|
+
# than the kernel version of fail. So we run :sh from within a
|
131
|
+
# non-test class to avoid the problem.
|
132
|
+
class Sh
|
133
|
+
include FileUtils
|
134
|
+
def run(*args)
|
135
|
+
sh(*args)
|
136
|
+
end
|
137
|
+
def self.run(*args)
|
138
|
+
new.run(*args)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def test_sh_with_a_single_string_argument
|
127
143
|
ENV['RAKE_TEST_SH'] = 'someval'
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
144
|
+
verbose(false) {
|
145
|
+
sh %{ruby test/check_expansion.rb #{env_var} someval}
|
146
|
+
}
|
147
|
+
end
|
148
|
+
|
149
|
+
def test_sh_with_multiple_arguments
|
150
|
+
ENV['RAKE_TEST_SH'] = 'someval'
|
151
|
+
verbose(false) {
|
152
|
+
Sh.run 'ruby', 'test/check_no_expansion.rb', env_var, 'someval'
|
135
153
|
}
|
136
154
|
end
|
137
155
|
|
138
156
|
def test_sh_failure
|
139
|
-
|
140
|
-
verbose(false) {
|
157
|
+
assert_exception(RuntimeError) {
|
158
|
+
verbose(false) { Sh.run %{ruby test/shellcommand.rb 1} }
|
141
159
|
}
|
142
160
|
end
|
143
161
|
|
@@ -164,7 +182,7 @@ class TestFileUtils < Test::Unit::TestCase
|
|
164
182
|
end
|
165
183
|
|
166
184
|
def test_sh_bad_option
|
167
|
-
ex =
|
185
|
+
ex = assert_exception(ArgumentError) {
|
168
186
|
verbose(false) { sh %{test/shellcommand.rb}, :bad_option=>true }
|
169
187
|
}
|
170
188
|
assert_match(/bad_option/, ex.message)
|
@@ -188,39 +206,18 @@ class TestFileUtils < Test::Unit::TestCase
|
|
188
206
|
assert_equal '', out
|
189
207
|
end
|
190
208
|
|
191
|
-
def
|
192
|
-
|
193
|
-
|
209
|
+
def test_ruby_with_a_single_string_argument
|
210
|
+
ENV['RAKE_TEST_SH'] = 'someval'
|
211
|
+
verbose(false) {
|
212
|
+
ruby %{test/check_expansion.rb #{env_var} someval}
|
194
213
|
}
|
195
|
-
assert_equal '', out
|
196
214
|
end
|
197
215
|
|
198
|
-
def
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
env_var = windows? ? '%RAKE_TEST_RUBY%' : '$RAKE_TEST_RUBY'
|
204
|
-
ruby %{-e "exit #{env_var}"} do |ok, status| # " (emacs wart)
|
205
|
-
assert(!ok)
|
206
|
-
assert_equal 123, status.exitstatus
|
207
|
-
block_run = true
|
208
|
-
end
|
209
|
-
assert block_run, "The block must be run"
|
210
|
-
|
211
|
-
if windows?
|
212
|
-
puts "SKIPPING test_ruby/part 2 when in windows"
|
213
|
-
else
|
214
|
-
# This one does not get expanded
|
215
|
-
block_run = false
|
216
|
-
ruby '-e', %{exit "#{env_var}".length} do |ok, status| # " (emacs wart)
|
217
|
-
assert(!ok)
|
218
|
-
assert_equal 15, status.exitstatus
|
219
|
-
block_run = true
|
220
|
-
end
|
221
|
-
assert block_run, "The block must be run"
|
222
|
-
end
|
223
|
-
end
|
216
|
+
def test_ruby_with_multiple_arguments
|
217
|
+
ENV['RAKE_TEST_SH'] = 'someval'
|
218
|
+
verbose(false) {
|
219
|
+
ruby 'test/check_no_expansion.rb', env_var, 'someval'
|
220
|
+
}
|
224
221
|
end
|
225
222
|
|
226
223
|
def test_split_all
|
@@ -247,4 +244,8 @@ class TestFileUtils < Test::Unit::TestCase
|
|
247
244
|
! File::ALT_SEPARATOR.nil?
|
248
245
|
end
|
249
246
|
|
247
|
+
def env_var
|
248
|
+
windows? ? '%RAKE_TEST_SH%' : '$RAKE_TEST_SH'
|
249
|
+
end
|
250
|
+
|
250
251
|
end
|