rake 0.7.2 → 0.7.3
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/CHANGES +8 -1
- data/Rakefile +15 -11
- data/doc/release_notes/rake-0.7.3.rdoc +47 -0
- data/lib/rake.rb +327 -280
- data/test/test_application.rb +46 -27
- data/test/test_filelist.rb +49 -2
- data/test/test_require.rb +9 -3
- metadata +4 -2
data/test/test_application.rb
CHANGED
@@ -23,7 +23,7 @@ class TestApplication < Test::Unit::TestCase
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def test_constant_warning
|
26
|
-
err = capture_stderr do @app.const_warning("Task") end
|
26
|
+
err = capture_stderr do @app.instance_eval { const_warning("Task") } end
|
27
27
|
assert_match(/warning/i, err)
|
28
28
|
assert_match(/deprecated/i, err)
|
29
29
|
assert_match(/Task/i, err)
|
@@ -33,28 +33,30 @@ class TestApplication < Test::Unit::TestCase
|
|
33
33
|
@app.options.show_task_pattern = //
|
34
34
|
@app.last_comment = "COMMENT"
|
35
35
|
@app.define_task(Rake::Task, "t")
|
36
|
-
out = capture_stdout do @app.display_tasks_and_comments end
|
36
|
+
out = capture_stdout do @app.instance_eval { display_tasks_and_comments } end
|
37
37
|
assert_match(/^rake t/, out)
|
38
38
|
assert_match(/# COMMENT/, out)
|
39
39
|
end
|
40
40
|
|
41
41
|
def test_finding_rakefile
|
42
|
-
assert @app.have_rakefile
|
42
|
+
assert @app.instance_eval { have_rakefile }
|
43
43
|
assert_equal "rakefile", @app.rakefile.downcase
|
44
44
|
end
|
45
45
|
|
46
46
|
def test_not_finding_rakefile
|
47
47
|
@app.instance_eval { @rakefiles = ['NEVER_FOUND'] }
|
48
|
-
assert ! @app.have_rakefile
|
48
|
+
assert( ! @app.instance_eval do have_rakefile end )
|
49
49
|
assert_nil @app.rakefile
|
50
50
|
end
|
51
51
|
|
52
52
|
def test_load_rakefile
|
53
53
|
original_dir = Dir.pwd
|
54
54
|
Dir.chdir("test/data/unittest")
|
55
|
-
@app.
|
56
|
-
|
57
|
-
|
55
|
+
@app.instance_eval do
|
56
|
+
handle_options
|
57
|
+
options.silent = true
|
58
|
+
load_rakefile
|
59
|
+
end
|
58
60
|
assert_equal "rakefile", @app.rakefile.downcase
|
59
61
|
assert_match(%r(unittest$), Dir.pwd)
|
60
62
|
ensure
|
@@ -64,9 +66,11 @@ class TestApplication < Test::Unit::TestCase
|
|
64
66
|
def test_load_rakefile_from_subdir
|
65
67
|
original_dir = Dir.pwd
|
66
68
|
Dir.chdir("test/data/unittest/subdir")
|
67
|
-
@app.
|
68
|
-
|
69
|
-
|
69
|
+
@app.instance_eval do
|
70
|
+
handle_options
|
71
|
+
options.silent = true
|
72
|
+
load_rakefile
|
73
|
+
end
|
70
74
|
assert_equal "rakefile", @app.rakefile.downcase
|
71
75
|
assert_match(%r(unittest$), Dir.pwd)
|
72
76
|
ensure
|
@@ -76,42 +80,52 @@ class TestApplication < Test::Unit::TestCase
|
|
76
80
|
def test_load_rakefile_not_found
|
77
81
|
original_dir = Dir.pwd
|
78
82
|
Dir.chdir("/")
|
79
|
-
@app.
|
80
|
-
|
81
|
-
|
83
|
+
@app.instance_eval do
|
84
|
+
handle_options
|
85
|
+
options.silent = true
|
86
|
+
end
|
87
|
+
ex = assert_raise(RuntimeError) do
|
88
|
+
@app.instance_eval do raw_load_rakefile end
|
89
|
+
end
|
82
90
|
assert_match(/no rakefile found/i, ex.message)
|
83
91
|
ensure
|
84
92
|
Dir.chdir(original_dir)
|
85
93
|
end
|
86
94
|
|
87
95
|
def test_not_caring_about_finding_rakefile
|
88
|
-
@app.instance_eval
|
89
|
-
assert
|
96
|
+
@app.instance_eval do @rakefiles = [''] end
|
97
|
+
assert(@app.instance_eval do have_rakefile end)
|
90
98
|
assert_equal '', @app.rakefile
|
91
99
|
end
|
92
100
|
|
93
101
|
def test_loading_imports
|
94
102
|
mock = flexmock("loader")
|
95
103
|
mock.should_receive(:load).with("x.dummy").once
|
96
|
-
@app.
|
97
|
-
|
98
|
-
|
104
|
+
@app.instance_eval do
|
105
|
+
add_loader("dummy", mock)
|
106
|
+
add_import("x.dummy")
|
107
|
+
load_imports
|
108
|
+
end
|
99
109
|
end
|
100
110
|
|
101
111
|
def test_building_imported_files_on_demand
|
102
112
|
mock = flexmock("loader")
|
103
113
|
mock.should_receive(:load).with("x.dummy").once
|
104
114
|
mock.should_receive(:make_dummy).with_no_args.once
|
105
|
-
@app.
|
106
|
-
|
107
|
-
|
108
|
-
|
115
|
+
@app.instance_eval do
|
116
|
+
intern(Rake::Task, "x.dummy").enhance do mock.make_dummy end
|
117
|
+
add_loader("dummy", mock)
|
118
|
+
add_import("x.dummy")
|
119
|
+
load_imports
|
120
|
+
end
|
109
121
|
end
|
110
122
|
|
111
123
|
def test_good_run
|
112
124
|
ran = false
|
113
125
|
@app.options.silent = true
|
114
|
-
@app.
|
126
|
+
@app.instance_eval do
|
127
|
+
intern(Rake::Task, "default").enhance { ran = true }
|
128
|
+
end
|
115
129
|
@app.run
|
116
130
|
assert ran
|
117
131
|
end
|
@@ -358,7 +372,9 @@ class TestApplicationOptions < Test::Unit::TestCase
|
|
358
372
|
|
359
373
|
def test_bad_option
|
360
374
|
capture_stderr do
|
361
|
-
ex = assert_raise(GetoptLong::InvalidOption)
|
375
|
+
ex = assert_raise(GetoptLong::InvalidOption) do
|
376
|
+
flags('--bad-option')
|
377
|
+
end
|
362
378
|
assert_match(/unrecognized option/, ex.message)
|
363
379
|
assert_match(/--bad-option/, ex.message)
|
364
380
|
end
|
@@ -388,7 +404,7 @@ class TestApplicationOptions < Test::Unit::TestCase
|
|
388
404
|
@out = capture_stdout {
|
389
405
|
@exit = catch(:system_exit) { opts = command_line(*set) }
|
390
406
|
}
|
391
|
-
yield(@app.options)
|
407
|
+
yield(@app.options) if block_given?
|
392
408
|
end
|
393
409
|
end
|
394
410
|
|
@@ -398,8 +414,11 @@ class TestApplicationOptions < Test::Unit::TestCase
|
|
398
414
|
def @app.exit(*args)
|
399
415
|
throw :system_exit, :exit
|
400
416
|
end
|
401
|
-
@app.
|
402
|
-
|
417
|
+
@app.instance_eval do
|
418
|
+
handle_options
|
419
|
+
collect_tasks
|
420
|
+
end
|
421
|
+
@tasks = @app.top_level_tasks
|
403
422
|
@app.options
|
404
423
|
end
|
405
424
|
end
|
data/test/test_filelist.rb
CHANGED
@@ -153,13 +153,13 @@ class TestFileList < Test::Unit::TestCase
|
|
153
153
|
|
154
154
|
def test_exclude_return_on_create
|
155
155
|
fl = FileList['testdata/*'].exclude(/.*\.[hcx]$/)
|
156
|
-
assert_equal ['testdata/existing'], fl
|
156
|
+
assert_equal ['testdata/existing', 'testdata/cfiles'].sort, fl.sort
|
157
157
|
assert_equal FileList, fl.class
|
158
158
|
end
|
159
159
|
|
160
160
|
def test_exclude_with_string_return_on_create
|
161
161
|
fl = FileList['testdata/*'].exclude('testdata/abc.c')
|
162
|
-
assert_equal %w(testdata/existing testdata/x.c testdata/abc.h testdata/abc.x testdata/xyz.c).sort, fl.sort
|
162
|
+
assert_equal %w(testdata/existing testdata/cfiles testdata/x.c testdata/abc.h testdata/abc.x testdata/xyz.c).sort, fl.sort
|
163
163
|
assert_equal FileList, fl.class
|
164
164
|
end
|
165
165
|
|
@@ -215,6 +215,28 @@ class TestFileList < Test::Unit::TestCase
|
|
215
215
|
assert_equal ["testdata/abc.o", "testdata/x.o", "testdata/xyz.o"].sort,
|
216
216
|
f3.sort
|
217
217
|
end
|
218
|
+
|
219
|
+
def test_claim_to_be_a_kind_of_array
|
220
|
+
fl = FileList['testdata/*.c']
|
221
|
+
assert fl.is_a?(Array)
|
222
|
+
assert fl.kind_of?(Array)
|
223
|
+
end
|
224
|
+
|
225
|
+
def test_claim_to_be_a_kind_of_filelist
|
226
|
+
fl = FileList['testdata/*.c']
|
227
|
+
assert fl.is_a?(FileList)
|
228
|
+
assert fl.kind_of?(FileList)
|
229
|
+
end
|
230
|
+
|
231
|
+
def test_claim_to_be_a_filelist_instance
|
232
|
+
fl = FileList['testdata/*.c']
|
233
|
+
assert fl.instance_of?(FileList)
|
234
|
+
end
|
235
|
+
|
236
|
+
def test_dont_claim_to_be_an_array_instance
|
237
|
+
fl = FileList['testdata/*.c']
|
238
|
+
assert ! fl.instance_of?(Array)
|
239
|
+
end
|
218
240
|
|
219
241
|
def test_sub!
|
220
242
|
f = "x/a.c"
|
@@ -300,6 +322,18 @@ class TestFileList < Test::Unit::TestCase
|
|
300
322
|
assert found, "should have found a matching line"
|
301
323
|
end
|
302
324
|
|
325
|
+
def test_existing
|
326
|
+
fl = FileList['testdata/abc.c', 'testdata/notthere.c']
|
327
|
+
assert_equal ["testdata/abc.c"], fl.existing
|
328
|
+
assert fl.existing.is_a?(FileList)
|
329
|
+
end
|
330
|
+
|
331
|
+
def test_existing!
|
332
|
+
fl = FileList['testdata/abc.c', 'testdata/notthere.c']
|
333
|
+
result = fl.existing!
|
334
|
+
assert_equal ["testdata/abc.c"], fl
|
335
|
+
assert_equal fl.object_id, result.object_id
|
336
|
+
end
|
303
337
|
|
304
338
|
def test_ignore_special
|
305
339
|
f = FileList['testdata/*']
|
@@ -505,12 +539,25 @@ class TestFileList < Test::Unit::TestCase
|
|
505
539
|
assert_equal ['b', 'd'], r
|
506
540
|
assert_equal FileList, r.class
|
507
541
|
end
|
542
|
+
|
543
|
+
def test_file_utils_can_use_filelists
|
544
|
+
cfiles = FileList['testdata/*.c']
|
545
|
+
|
546
|
+
cp cfiles, @cdir
|
547
|
+
|
548
|
+
assert File.exist?(File.join(@cdir, 'abc.c'))
|
549
|
+
assert File.exist?(File.join(@cdir, 'xyz.c'))
|
550
|
+
assert File.exist?(File.join(@cdir, 'x.c'))
|
551
|
+
end
|
508
552
|
|
509
553
|
def create_test_data
|
510
554
|
verbose(false) do
|
555
|
+
|
511
556
|
mkdir "testdata" unless File.exist? "testdata"
|
512
557
|
mkdir "testdata/CVS" rescue nil
|
513
558
|
mkdir "testdata/.svn" rescue nil
|
559
|
+
@cdir = "testdata/cfiles"
|
560
|
+
mkdir @cdir rescue nil
|
514
561
|
touch "testdata/.dummy"
|
515
562
|
touch "testdata/x.bak"
|
516
563
|
touch "testdata/x~"
|
data/test/test_require.rb
CHANGED
@@ -8,18 +8,24 @@ class TestRequire < Test::Unit::TestCase
|
|
8
8
|
|
9
9
|
def test_can_load_rake_library
|
10
10
|
app = Rake::Application.new
|
11
|
-
assert app.
|
11
|
+
assert app.instance_eval {
|
12
|
+
rake_require("test2", ['test/data/rakelib'], [])
|
13
|
+
}
|
12
14
|
end
|
13
15
|
|
14
16
|
def test_wont_reload_rake_library
|
15
17
|
app = Rake::Application.new
|
16
|
-
assert ! app.
|
18
|
+
assert ! app.instance_eval {
|
19
|
+
rake_require("test2", ['test/data/rakelib'], ['test2'])
|
20
|
+
}
|
17
21
|
end
|
18
22
|
|
19
23
|
def test_throws_error_if_library_not_found
|
20
24
|
app = Rake::Application.new
|
21
25
|
ex = assert_raise(LoadError) {
|
22
|
-
assert app.
|
26
|
+
assert app.instance_eval {
|
27
|
+
rake_require("testx", ['test/data/rakelib'], [])
|
28
|
+
}
|
23
29
|
}
|
24
30
|
assert_match(/x/, ex.message)
|
25
31
|
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rake
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.7.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.7.3
|
7
|
+
date: 2007-04-20 00:00:00 -04:00
|
8
8
|
summary: Ruby based make-like utility.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- doc/release_notes/rake-0.7.0.rdoc
|
119
119
|
- doc/release_notes/rake-0.7.1.rdoc
|
120
120
|
- doc/release_notes/rake-0.7.2.rdoc
|
121
|
+
- doc/release_notes/rake-0.7.3.rdoc
|
121
122
|
test_files: []
|
122
123
|
|
123
124
|
rdoc_options:
|
@@ -145,6 +146,7 @@ extra_rdoc_files:
|
|
145
146
|
- doc/release_notes/rake-0.7.0.rdoc
|
146
147
|
- doc/release_notes/rake-0.7.1.rdoc
|
147
148
|
- doc/release_notes/rake-0.7.2.rdoc
|
149
|
+
- doc/release_notes/rake-0.7.3.rdoc
|
148
150
|
executables:
|
149
151
|
- rake
|
150
152
|
extensions: []
|