rake 0.7.3 → 0.8.7
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 +126 -1
- data/README +86 -132
- data/Rakefile +111 -64
- data/TODO +1 -0
- data/bin/rake +24 -0
- data/doc/command_line_usage.rdoc +102 -0
- data/doc/rakefile.rdoc +126 -3
- data/doc/release_notes/rake-0.7.3.rdoc +0 -0
- data/doc/release_notes/rake-0.8.0.rdoc +114 -0
- data/doc/release_notes/rake-0.8.2.rdoc +165 -0
- data/doc/release_notes/rake-0.8.3.rdoc +112 -0
- data/doc/release_notes/rake-0.8.4.rdoc +147 -0
- data/doc/release_notes/rake-0.8.5.rdoc +53 -0
- data/doc/release_notes/rake-0.8.6.rdoc +55 -0
- data/doc/release_notes/rake-0.8.7.rdoc +55 -0
- data/lib/rake/alt_system.rb +108 -0
- data/lib/rake/contrib/ftptools.rb +24 -10
- data/lib/rake/contrib/publisher.rb +1 -1
- data/lib/rake/contrib/sys.rb +5 -2
- data/lib/rake/gempackagetask.rb +2 -6
- data/lib/rake/loaders/makefile.rb +17 -15
- data/lib/rake/rdoctask.rb +83 -21
- data/lib/rake/ruby182_test_unit_fix.rb +0 -0
- data/lib/rake/tasklib.rb +8 -3
- data/lib/rake/testtask.rb +1 -1
- data/lib/rake/win32.rb +55 -0
- data/lib/rake.rb +861 -386
- data/test/check_expansion.rb +5 -0
- data/test/check_no_expansion.rb +5 -0
- data/test/data/file_creation_task/Rakefile +4 -1
- data/test/data/multidesc/Rakefile +3 -0
- data/test/data/sample.mf +6 -1
- data/test/data/statusreturn/Rakefile +8 -0
- data/test/filecreation.rb +0 -2
- data/test/functional.rb +3 -1
- data/test/in_environment.rb +30 -0
- data/test/rake_test_setup.rb +24 -0
- data/test/session_functional.rb +145 -24
- data/test/shellcommand.rb +0 -0
- data/test/test_application.rb +345 -95
- data/test/test_definitions.rb +4 -1
- data/test/test_earlytime.rb +2 -2
- data/test/test_extension.rb +63 -0
- data/test/test_file_task.rb +20 -16
- data/test/test_filelist.rb +59 -10
- data/test/test_fileutils.rb +59 -38
- data/test/test_ftp.rb +5 -1
- data/test/test_invocation_chain.rb +81 -0
- data/test/test_makefile_loader.rb +5 -2
- data/test/test_namespace.rb +37 -14
- data/test/test_package_task.rb +3 -15
- data/test/test_pathmap.rb +24 -2
- data/test/test_pseudo_status.rb +26 -0
- data/test/test_rake.rb +9 -2
- data/test/test_rdoc_task.rb +88 -0
- data/test/test_require.rb +3 -1
- data/test/test_rules.rb +56 -12
- data/test/test_task_arguments.rb +89 -0
- data/test/test_task_manager.rb +27 -2
- data/test/test_tasklib.rb +12 -0
- data/test/test_tasks.rb +248 -20
- data/test/test_test_task.rb +3 -2
- data/test/test_top_level_functions.rb +10 -3
- data/test/test_win32.rb +72 -0
- metadata +105 -69
- /data/test/contrib/{testsys.rb → test_sys.rb} +0 -0
data/test/test_tasks.rb
CHANGED
|
@@ -5,11 +5,13 @@ require 'fileutils'
|
|
|
5
5
|
require 'rake'
|
|
6
6
|
require 'test/filecreation'
|
|
7
7
|
require 'test/capture_stdout'
|
|
8
|
+
require 'test/rake_test_setup'
|
|
8
9
|
|
|
9
10
|
######################################################################
|
|
10
11
|
class TestTask < Test::Unit::TestCase
|
|
11
12
|
include CaptureStdout
|
|
12
13
|
include Rake
|
|
14
|
+
include TestMethods
|
|
13
15
|
|
|
14
16
|
def setup
|
|
15
17
|
Task.clear
|
|
@@ -17,31 +19,48 @@ class TestTask < Test::Unit::TestCase
|
|
|
17
19
|
|
|
18
20
|
def test_create
|
|
19
21
|
arg = nil
|
|
20
|
-
t =
|
|
22
|
+
t = task(:name) { |task| arg = task; 1234 }
|
|
21
23
|
assert_equal "name", t.name
|
|
22
24
|
assert_equal [], t.prerequisites
|
|
23
|
-
assert t.prerequisites.is_a?(FileList)
|
|
24
25
|
assert t.needed?
|
|
25
|
-
t.execute
|
|
26
|
+
t.execute(0)
|
|
26
27
|
assert_equal t, arg
|
|
27
28
|
assert_nil t.source
|
|
28
29
|
assert_equal [], t.sources
|
|
29
30
|
end
|
|
30
31
|
|
|
32
|
+
def test_inspect
|
|
33
|
+
t = task(:foo, :needs => [:bar, :baz])
|
|
34
|
+
assert_equal "<Rake::Task foo => [bar, baz]>", t.inspect
|
|
35
|
+
end
|
|
36
|
+
|
|
31
37
|
def test_invoke
|
|
32
38
|
runlist = []
|
|
33
|
-
t1 =
|
|
34
|
-
t2 =
|
|
35
|
-
t3 =
|
|
36
|
-
assert_equal [
|
|
39
|
+
t1 = task(:t1 => [:t2, :t3]) { |t| runlist << t.name; 3321 }
|
|
40
|
+
t2 = task(:t2) { |t| runlist << t.name }
|
|
41
|
+
t3 = task(:t3) { |t| runlist << t.name }
|
|
42
|
+
assert_equal ["t2", "t3"], t1.prerequisites
|
|
37
43
|
t1.invoke
|
|
38
44
|
assert_equal ["t2", "t3", "t1"], runlist
|
|
39
45
|
end
|
|
40
46
|
|
|
47
|
+
def test_invoke_with_circular_dependencies
|
|
48
|
+
runlist = []
|
|
49
|
+
t1 = task(:t1 => [:t2]) { |t| runlist << t.name; 3321 }
|
|
50
|
+
t2 = task(:t2 => [:t1]) { |t| runlist << t.name }
|
|
51
|
+
assert_equal ["t2"], t1.prerequisites
|
|
52
|
+
assert_equal ["t1"], t2.prerequisites
|
|
53
|
+
ex = assert_exception RuntimeError do
|
|
54
|
+
t1.invoke
|
|
55
|
+
end
|
|
56
|
+
assert_match(/circular dependency/i, ex.message)
|
|
57
|
+
assert_match(/t1 => t2 => t1/, ex.message)
|
|
58
|
+
end
|
|
59
|
+
|
|
41
60
|
def test_dry_run_prevents_actions
|
|
42
61
|
Rake.application.options.dryrun = true
|
|
43
62
|
runlist = []
|
|
44
|
-
t1 =
|
|
63
|
+
t1 = task(:t1) { |t| runlist << t.name; 3321 }
|
|
45
64
|
out = capture_stdout { t1.invoke }
|
|
46
65
|
assert_match(/execute .*t1/i, out)
|
|
47
66
|
assert_match(/dry run/i, out)
|
|
@@ -53,7 +72,7 @@ class TestTask < Test::Unit::TestCase
|
|
|
53
72
|
|
|
54
73
|
def test_tasks_can_be_traced
|
|
55
74
|
Rake.application.options.trace = true
|
|
56
|
-
t1 =
|
|
75
|
+
t1 = task(:t1)
|
|
57
76
|
out = capture_stdout {
|
|
58
77
|
t1.invoke
|
|
59
78
|
}
|
|
@@ -65,17 +84,46 @@ class TestTask < Test::Unit::TestCase
|
|
|
65
84
|
|
|
66
85
|
def test_no_double_invoke
|
|
67
86
|
runlist = []
|
|
68
|
-
t1 =
|
|
69
|
-
t2 =
|
|
70
|
-
t3 =
|
|
87
|
+
t1 = task(:t1 => [:t2, :t3]) { |t| runlist << t.name; 3321 }
|
|
88
|
+
t2 = task(:t2 => [:t3]) { |t| runlist << t.name }
|
|
89
|
+
t3 = task(:t3) { |t| runlist << t.name }
|
|
71
90
|
t1.invoke
|
|
72
91
|
assert_equal ["t3", "t2", "t1"], runlist
|
|
73
92
|
end
|
|
74
93
|
|
|
94
|
+
def test_can_double_invoke_with_reenable
|
|
95
|
+
runlist = []
|
|
96
|
+
t1 = task(:t1) { |t| runlist << t.name }
|
|
97
|
+
t1.invoke
|
|
98
|
+
t1.reenable
|
|
99
|
+
t1.invoke
|
|
100
|
+
assert_equal ["t1", "t1"], runlist
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def test_clear
|
|
104
|
+
t = task("t" => "a") { }
|
|
105
|
+
t.clear
|
|
106
|
+
assert t.prerequisites.empty?, "prerequisites should be empty"
|
|
107
|
+
assert t.actions.empty?, "actions should be empty"
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def test_clear_prerequisites
|
|
111
|
+
t = task("t" => ["a", "b"])
|
|
112
|
+
assert_equal ['a', 'b'], t.prerequisites
|
|
113
|
+
t.clear_prerequisites
|
|
114
|
+
assert_equal [], t.prerequisites
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def test_clear_actions
|
|
118
|
+
t = task("t") { }
|
|
119
|
+
t.clear_actions
|
|
120
|
+
assert t.actions.empty?, "actions should be empty"
|
|
121
|
+
end
|
|
122
|
+
|
|
75
123
|
def test_find
|
|
76
124
|
task :tfind
|
|
77
125
|
assert_equal "tfind", Task[:tfind].name
|
|
78
|
-
ex =
|
|
126
|
+
ex = assert_exception(RuntimeError) { Task[:leaves] }
|
|
79
127
|
assert_equal "Don't know how to build task 'leaves'", ex.message
|
|
80
128
|
end
|
|
81
129
|
|
|
@@ -127,20 +175,200 @@ class TestTask < Test::Unit::TestCase
|
|
|
127
175
|
end
|
|
128
176
|
|
|
129
177
|
def test_investigation_output
|
|
130
|
-
t1 =
|
|
131
|
-
|
|
132
|
-
|
|
178
|
+
t1 = task(:t1 => [:t2, :t3]) { |t| runlist << t.name; 3321 }
|
|
179
|
+
task(:t2)
|
|
180
|
+
task(:t3)
|
|
133
181
|
out = t1.investigation
|
|
134
182
|
assert_match(/class:\s*Rake::Task/, out)
|
|
135
183
|
assert_match(/needed:\s*true/, out)
|
|
136
|
-
assert_match(/pre-requisites:\s*--
|
|
184
|
+
assert_match(/pre-requisites:\s*--t[23]/, out)
|
|
137
185
|
end
|
|
138
186
|
|
|
139
|
-
private
|
|
140
187
|
|
|
141
|
-
def
|
|
142
|
-
|
|
188
|
+
def test_extended_comments
|
|
189
|
+
desc %{
|
|
190
|
+
This is a comment.
|
|
191
|
+
|
|
192
|
+
And this is the extended comment.
|
|
193
|
+
name -- Name of task to execute.
|
|
194
|
+
rev -- Software revision to use.
|
|
195
|
+
}
|
|
196
|
+
t = task(:t, :name, :rev)
|
|
197
|
+
assert_equal "[name,rev]", t.arg_description
|
|
198
|
+
assert_equal "This is a comment.", t.comment
|
|
199
|
+
assert_match(/^\s*name -- Name/, t.full_comment)
|
|
200
|
+
assert_match(/^\s*rev -- Software/, t.full_comment)
|
|
201
|
+
assert_match(/\A\s*This is a comment\.$/, t.full_comment)
|
|
143
202
|
end
|
|
144
203
|
|
|
204
|
+
def test_multiple_comments
|
|
205
|
+
desc "line one"
|
|
206
|
+
t = task(:t)
|
|
207
|
+
desc "line two"
|
|
208
|
+
task(:t)
|
|
209
|
+
assert_equal "line one / line two", t.comment
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
def test_settable_comments
|
|
213
|
+
t = task(:t)
|
|
214
|
+
t.comment = "HI"
|
|
215
|
+
assert_equal "HI", t.comment
|
|
216
|
+
end
|
|
145
217
|
end
|
|
146
218
|
|
|
219
|
+
######################################################################
|
|
220
|
+
class TestTaskWithArguments < Test::Unit::TestCase
|
|
221
|
+
include CaptureStdout
|
|
222
|
+
include Rake
|
|
223
|
+
include TestMethods
|
|
224
|
+
|
|
225
|
+
def setup
|
|
226
|
+
Task.clear
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
def test_no_args_given
|
|
230
|
+
t = task :t
|
|
231
|
+
assert_equal [], t.arg_names
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
def test_args_given
|
|
235
|
+
t = task :t, :a, :b
|
|
236
|
+
assert_equal [:a, :b], t.arg_names
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
def test_name_and_needs
|
|
240
|
+
t = task(:t => [:pre])
|
|
241
|
+
assert_equal "t", t.name
|
|
242
|
+
assert_equal [], t.arg_names
|
|
243
|
+
assert_equal ["pre"], t.prerequisites
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
def test_name_and_explicit_needs
|
|
247
|
+
t = task(:t, :needs => [:pre])
|
|
248
|
+
assert_equal "t", t.name
|
|
249
|
+
assert_equal [], t.arg_names
|
|
250
|
+
assert_equal ["pre"], t.prerequisites
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
def test_name_args_and_explicit_needs
|
|
254
|
+
t = task(:t, :x, :y, :needs => [:pre])
|
|
255
|
+
assert_equal "t", t.name
|
|
256
|
+
assert_equal [:x, :y], t.arg_names
|
|
257
|
+
assert_equal ["pre"], t.prerequisites
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
def test_illegal_keys_in_task_name_hash
|
|
261
|
+
assert_exception RuntimeError do
|
|
262
|
+
t = task(:t, :x, :y => 1, :needs => [:pre])
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
def test_arg_list_is_empty_if_no_args_given
|
|
267
|
+
t = task(:t) { |tt, args| assert_equal({}, args.to_hash) }
|
|
268
|
+
t.invoke(1, 2, 3)
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
def test_tasks_can_access_arguments_as_hash
|
|
272
|
+
t = task :t, :a, :b, :c do |tt, args|
|
|
273
|
+
assert_equal({:a => 1, :b => 2, :c => 3}, args.to_hash)
|
|
274
|
+
assert_equal 1, args[:a]
|
|
275
|
+
assert_equal 2, args[:b]
|
|
276
|
+
assert_equal 3, args[:c]
|
|
277
|
+
assert_equal 1, args.a
|
|
278
|
+
assert_equal 2, args.b
|
|
279
|
+
assert_equal 3, args.c
|
|
280
|
+
end
|
|
281
|
+
t.invoke(1, 2, 3)
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
def test_actions_of_various_arity_are_ok_with_args
|
|
285
|
+
notes = []
|
|
286
|
+
t = task(:t, :x) do
|
|
287
|
+
notes << :a
|
|
288
|
+
end
|
|
289
|
+
t.enhance do | |
|
|
290
|
+
notes << :b
|
|
291
|
+
end
|
|
292
|
+
t.enhance do |task|
|
|
293
|
+
notes << :c
|
|
294
|
+
assert_kind_of Task, task
|
|
295
|
+
end
|
|
296
|
+
t.enhance do |t2, args|
|
|
297
|
+
notes << :d
|
|
298
|
+
assert_equal t, t2
|
|
299
|
+
assert_equal({:x => 1}, args.to_hash)
|
|
300
|
+
end
|
|
301
|
+
assert_nothing_raised do t.invoke(1) end
|
|
302
|
+
assert_equal [:a, :b, :c, :d], notes
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
def test_arguments_are_passed_to_block
|
|
306
|
+
t = task(:t, :a, :b) { |tt, args|
|
|
307
|
+
assert_equal( { :a => 1, :b => 2 }, args.to_hash )
|
|
308
|
+
}
|
|
309
|
+
t.invoke(1, 2)
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
def test_extra_parameters_are_ignored
|
|
313
|
+
t = task(:t, :a) { |tt, args|
|
|
314
|
+
assert_equal 1, args.a
|
|
315
|
+
assert_nil args.b
|
|
316
|
+
}
|
|
317
|
+
t.invoke(1, 2)
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
def test_arguments_are_passed_to_all_blocks
|
|
321
|
+
counter = 0
|
|
322
|
+
t = task :t, :a
|
|
323
|
+
task :t do |tt, args|
|
|
324
|
+
assert_equal 1, args.a
|
|
325
|
+
counter += 1
|
|
326
|
+
end
|
|
327
|
+
task :t do |tt, args|
|
|
328
|
+
assert_equal 1, args.a
|
|
329
|
+
counter += 1
|
|
330
|
+
end
|
|
331
|
+
t.invoke(1)
|
|
332
|
+
assert_equal 2, counter
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
def test_block_with_no_parameters_is_ok
|
|
336
|
+
t = task(:t) { }
|
|
337
|
+
t.invoke(1, 2)
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
def test_name_with_args
|
|
341
|
+
desc "T"
|
|
342
|
+
t = task(:tt, :a, :b)
|
|
343
|
+
assert_equal "tt", t.name
|
|
344
|
+
assert_equal "T", t.comment
|
|
345
|
+
assert_equal "[a,b]", t.arg_description
|
|
346
|
+
assert_equal "tt[a,b]", t.name_with_args
|
|
347
|
+
assert_equal [:a, :b],t.arg_names
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
def test_named_args_are_passed_to_prereqs
|
|
351
|
+
value = nil
|
|
352
|
+
pre = task(:pre, :rev) { |t, args| value = args.rev }
|
|
353
|
+
t = task(:t, :name, :rev, :needs => [:pre])
|
|
354
|
+
t.invoke("bill", "1.2")
|
|
355
|
+
assert_equal "1.2", value
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
def test_args_not_passed_if_no_prereq_names
|
|
359
|
+
pre = task(:pre) { |t, args|
|
|
360
|
+
assert_equal({}, args.to_hash)
|
|
361
|
+
assert_equal "bill", args.name
|
|
362
|
+
}
|
|
363
|
+
t = task(:t, :name, :rev, :needs => [:pre])
|
|
364
|
+
t.invoke("bill", "1.2")
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
def test_args_not_passed_if_no_arg_names
|
|
368
|
+
pre = task(:pre, :rev) { |t, args|
|
|
369
|
+
assert_equal({}, args.to_hash)
|
|
370
|
+
}
|
|
371
|
+
t = task(:t, :needs => [:pre])
|
|
372
|
+
t.invoke("bill", "1.2")
|
|
373
|
+
end
|
|
374
|
+
end
|
data/test/test_test_task.rb
CHANGED
|
@@ -5,9 +5,11 @@ require 'rake/testtask'
|
|
|
5
5
|
|
|
6
6
|
class TestTestTask < Test::Unit::TestCase
|
|
7
7
|
include Rake
|
|
8
|
+
include TestMethods
|
|
9
|
+
|
|
8
10
|
def setup
|
|
9
11
|
Task.clear
|
|
10
|
-
ENV
|
|
12
|
+
ENV.delete('TEST')
|
|
11
13
|
end
|
|
12
14
|
|
|
13
15
|
def teardown
|
|
@@ -43,7 +45,6 @@ class TestTestTask < Test::Unit::TestCase
|
|
|
43
45
|
end
|
|
44
46
|
|
|
45
47
|
def test_pattern
|
|
46
|
-
ENV['TEST'] = nil
|
|
47
48
|
tt = Rake::TestTask.new do |t|
|
|
48
49
|
t.pattern = '*.rb'
|
|
49
50
|
end
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
+
begin
|
|
4
|
+
require 'rubygems'
|
|
5
|
+
rescue LoadError
|
|
6
|
+
# got no gems
|
|
7
|
+
end
|
|
8
|
+
|
|
3
9
|
require 'test/unit'
|
|
10
|
+
require 'flexmock/test_unit'
|
|
4
11
|
require 'test/capture_stdout'
|
|
12
|
+
require 'test/rake_test_setup'
|
|
5
13
|
require 'rake'
|
|
6
|
-
require 'flexmock'
|
|
7
14
|
|
|
8
15
|
class TestTopLevelFunctions < Test::Unit::TestCase
|
|
9
|
-
include FlexMock::TestCase
|
|
10
16
|
include CaptureStdout
|
|
17
|
+
include TestMethods
|
|
11
18
|
|
|
12
19
|
def setup
|
|
13
20
|
super
|
|
@@ -74,6 +81,6 @@ class TestTopLevelFunctions < Test::Unit::TestCase
|
|
|
74
81
|
end
|
|
75
82
|
|
|
76
83
|
def test_missing_other_constant
|
|
77
|
-
|
|
84
|
+
assert_exception(NameError) do Object.const_missing(:Xyz) end
|
|
78
85
|
end
|
|
79
86
|
end
|
data/test/test_win32.rb
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'test/unit'
|
|
4
|
+
require 'test/rake_test_setup'
|
|
5
|
+
require 'test/in_environment'
|
|
6
|
+
|
|
7
|
+
require 'rake'
|
|
8
|
+
|
|
9
|
+
class TestWin32 < Test::Unit::TestCase
|
|
10
|
+
include InEnvironment
|
|
11
|
+
include TestMethods
|
|
12
|
+
|
|
13
|
+
Win32 = Rake::Win32
|
|
14
|
+
|
|
15
|
+
def test_win32_system_dir_uses_home_if_defined
|
|
16
|
+
in_environment('RAKE_SYSTEM' => nil, 'HOME' => 'C:\\HP') do
|
|
17
|
+
assert_equal "C:/HP/Rake", Win32.win32_system_dir
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_win32_system_dir_uses_homedrive_homepath_when_no_home_defined
|
|
22
|
+
in_environment(
|
|
23
|
+
'RAKE_SYSTEM' => nil,
|
|
24
|
+
'HOME' => nil,
|
|
25
|
+
'HOMEDRIVE' => "C:",
|
|
26
|
+
'HOMEPATH' => "\\HP"
|
|
27
|
+
) do
|
|
28
|
+
assert_equal "C:/HP/Rake", Win32.win32_system_dir
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def test_win32_system_dir_uses_appdata_when_no_home_or_home_combo
|
|
33
|
+
in_environment(
|
|
34
|
+
'RAKE_SYSTEM' => nil,
|
|
35
|
+
'HOME' => nil,
|
|
36
|
+
'HOMEDRIVE' => nil,
|
|
37
|
+
'HOMEPATH' => nil,
|
|
38
|
+
'APPDATA' => "C:\\Documents and Settings\\HP\\Application Data"
|
|
39
|
+
) do
|
|
40
|
+
assert_equal "C:/Documents and Settings/HP/Application Data/Rake", Win32.win32_system_dir
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def test_win32_system_dir_fallback_to_userprofile_otherwise
|
|
45
|
+
in_environment(
|
|
46
|
+
'RAKE_SYSTEM' => nil,
|
|
47
|
+
'HOME' => nil,
|
|
48
|
+
'HOMEDRIVE' => nil,
|
|
49
|
+
'HOMEPATH' => nil,
|
|
50
|
+
'APPDATA' => nil,
|
|
51
|
+
'USERPROFILE' => "C:\\Documents and Settings\\HP"
|
|
52
|
+
) do
|
|
53
|
+
assert_equal "C:/Documents and Settings/HP/Rake", Win32.win32_system_dir
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def test_win32_system_dir_nil_of_no_env_vars
|
|
58
|
+
in_environment(
|
|
59
|
+
'RAKE_SYSTEM' => nil,
|
|
60
|
+
'HOME' => nil,
|
|
61
|
+
'HOMEDRIVE' => nil,
|
|
62
|
+
"HOMEPATH" => nil,
|
|
63
|
+
'APPDATA' => nil,
|
|
64
|
+
"USERPROFILE" => nil
|
|
65
|
+
) do
|
|
66
|
+
assert_exception(Rake::Win32::Win32HomeError) do
|
|
67
|
+
Win32.win32_system_dir
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
end
|