rake 0.8.0 → 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 +113 -2
- data/README +86 -132
- data/Rakefile +41 -13
- data/bin/rake +0 -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 +0 -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 +490 -225
- 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/sample.mf +6 -1
- data/test/filecreation.rb +0 -2
- data/test/functional.rb +1 -1
- data/test/in_environment.rb +30 -0
- data/test/rake_test_setup.rb +21 -2
- data/test/session_functional.rb +109 -33
- data/test/shellcommand.rb +0 -0
- data/test/test_application.rb +269 -96
- data/test/test_definitions.rb +4 -1
- data/test/test_earlytime.rb +2 -2
- data/test/test_file_task.rb +20 -16
- data/test/test_filelist.rb +48 -7
- data/test/test_fileutils.rb +59 -38
- data/test/test_ftp.rb +5 -1
- data/test/test_invocation_chain.rb +8 -2
- data/test/test_makefile_loader.rb +5 -2
- data/test/test_namespace.rb +30 -11
- data/test/test_package_task.rb +3 -1
- data/test/test_pathmap.rb +3 -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 +25 -7
- data/test/test_task_arguments.rb +14 -1
- data/test/test_task_manager.rb +27 -2
- data/test/test_tasklib.rb +12 -0
- data/test/test_tasks.rb +72 -54
- data/test/test_test_task.rb +2 -0
- data/test/test_top_level_functions.rb +4 -2
- data/test/test_win32.rb +72 -0
- metadata +99 -75
- /data/test/contrib/{testsys.rb → test_sys.rb} +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
1
3
|
N = 2
|
|
2
4
|
|
|
3
5
|
task :default => :run
|
|
@@ -17,7 +19,7 @@ FileList['src/*'].each do |src|
|
|
|
17
19
|
target = File.join TARGET_DIR, File.basename(src)
|
|
18
20
|
file target => [src, TARGET_DIR] do
|
|
19
21
|
cp src, target
|
|
20
|
-
sleep 3 if src !~ /foo#{N-1}$/
|
|
22
|
+
# sleep 3 if src !~ /foo#{N-1}$/ # I'm commenting out this sleep, it doesn't seem to do anything.
|
|
21
23
|
end
|
|
22
24
|
task :run => target
|
|
23
25
|
end
|
|
@@ -25,6 +27,7 @@ end
|
|
|
25
27
|
task :prep => :clean do
|
|
26
28
|
mkdir_p 'src'
|
|
27
29
|
N.times do |n|
|
|
30
|
+
puts "DBG: Touching src/foo#{n}"
|
|
28
31
|
touch "src/foo#{n}"
|
|
29
32
|
end
|
|
30
33
|
end
|
data/test/data/sample.mf
CHANGED
data/test/filecreation.rb
CHANGED
data/test/functional.rb
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module InEnvironment
|
|
2
|
+
private
|
|
3
|
+
|
|
4
|
+
# Create an environment for a test. At the completion of the yielded
|
|
5
|
+
# block, the environment is restored to its original conditions.
|
|
6
|
+
def in_environment(settings)
|
|
7
|
+
original_settings = set_env(settings)
|
|
8
|
+
yield
|
|
9
|
+
ensure
|
|
10
|
+
set_env(original_settings)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Set the environment according to the settings hash.
|
|
14
|
+
def set_env(settings) # :nodoc:
|
|
15
|
+
result = {}
|
|
16
|
+
settings.each do |k, v|
|
|
17
|
+
result[k] = ENV[k]
|
|
18
|
+
if k == 'PWD'
|
|
19
|
+
result[k] = Dir.pwd
|
|
20
|
+
Dir.chdir(v)
|
|
21
|
+
elsif v.nil?
|
|
22
|
+
ENV.delete(k)
|
|
23
|
+
else
|
|
24
|
+
ENV[k] = v
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
result
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
end
|
data/test/rake_test_setup.rb
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Common setup for all test files.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
begin
|
|
4
|
+
require 'rubygems'
|
|
5
|
+
gem 'flexmock'
|
|
6
|
+
rescue LoadError
|
|
7
|
+
# got no gems
|
|
8
|
+
end
|
|
9
|
+
|
|
5
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
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
+
begin
|
|
4
|
+
require 'rubygems'
|
|
5
|
+
rescue LoadError => ex
|
|
6
|
+
end
|
|
3
7
|
require 'test/unit'
|
|
4
8
|
require 'fileutils'
|
|
5
9
|
require 'session'
|
|
10
|
+
require 'test/in_environment'
|
|
11
|
+
require 'test/rake_test_setup'
|
|
6
12
|
|
|
7
13
|
# Version 2.1.9 of session has a bug where the @debug instance
|
|
8
14
|
# variable is not initialized, causing warning messages. This snippet
|
|
@@ -18,13 +24,13 @@ module Session
|
|
|
18
24
|
end
|
|
19
25
|
|
|
20
26
|
class FunctionalTest < Test::Unit::TestCase
|
|
27
|
+
include InEnvironment
|
|
28
|
+
include TestMethods
|
|
21
29
|
|
|
22
30
|
RUBY_COMMAND = 'ruby'
|
|
23
31
|
|
|
24
32
|
def setup
|
|
25
33
|
@rake_path = File.expand_path("bin/rake")
|
|
26
|
-
@coverage_aggregate_file = File.expand_path("rcov_aggregate")
|
|
27
|
-
@rcov_dir = File.expand_path("coverage")
|
|
28
34
|
lib_path = File.expand_path("lib")
|
|
29
35
|
@ruby_options = "-I#{lib_path} -I."
|
|
30
36
|
@verbose = ! ENV['VERBOSE'].nil?
|
|
@@ -62,15 +68,22 @@ class FunctionalTest < Test::Unit::TestCase
|
|
|
62
68
|
end
|
|
63
69
|
|
|
64
70
|
def test_multi_desc
|
|
65
|
-
|
|
71
|
+
in_environment(
|
|
72
|
+
'RAKE_COLUMNS' => "80",
|
|
73
|
+
"PWD" => "test/data/multidesc"
|
|
74
|
+
) do
|
|
75
|
+
rake "-T"
|
|
76
|
+
end
|
|
66
77
|
assert_match %r{^rake a *# A / A2 *$}, @out
|
|
67
78
|
assert_match %r{^rake b *# B *$}, @out
|
|
68
79
|
assert_no_match %r{^rake c}, @out
|
|
69
80
|
assert_match %r{^rake d *# x{65}\.\.\.$}, @out
|
|
70
81
|
end
|
|
71
|
-
|
|
82
|
+
|
|
72
83
|
def test_long_description
|
|
73
|
-
|
|
84
|
+
in_environment("PWD" => "test/data/multidesc") do
|
|
85
|
+
rake "--describe"
|
|
86
|
+
end
|
|
74
87
|
assert_match %r{^rake a\n *A / A2 *$}m, @out
|
|
75
88
|
assert_match %r{^rake b\n *B *$}m, @out
|
|
76
89
|
assert_match %r{^rake d\n *x{80}}m, @out
|
|
@@ -78,17 +91,73 @@ class FunctionalTest < Test::Unit::TestCase
|
|
|
78
91
|
end
|
|
79
92
|
|
|
80
93
|
def test_rbext
|
|
81
|
-
|
|
94
|
+
in_environment("PWD" => "test/data/rbext") do
|
|
95
|
+
rake "-N"
|
|
96
|
+
end
|
|
82
97
|
assert_match %r{^OK$}, @out
|
|
83
98
|
end
|
|
84
99
|
|
|
85
|
-
def
|
|
86
|
-
|
|
100
|
+
def test_system
|
|
101
|
+
in_environment('RAKE_SYSTEM' => 'test/data/sys') do
|
|
102
|
+
rake '-g', "sys1"
|
|
103
|
+
end
|
|
104
|
+
assert_match %r{^SYS1}, @out
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def test_system_excludes_rakelib_files_too
|
|
108
|
+
in_environment('RAKE_SYSTEM' => 'test/data/sys') do
|
|
109
|
+
rake '-g', "sys1", '-T', 'extra'
|
|
110
|
+
end
|
|
111
|
+
assert_no_match %r{extra:extra}, @out
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def test_by_default_rakelib_files_are_include
|
|
115
|
+
in_environment('RAKE_SYSTEM' => 'test/data/sys') do
|
|
116
|
+
rake '-T', 'extra'
|
|
117
|
+
end
|
|
118
|
+
assert_match %r{extra:extra}, @out
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def test_implicit_system
|
|
122
|
+
in_environment('RAKE_SYSTEM' => File.expand_path('test/data/sys'), "PWD" => "/") do
|
|
123
|
+
rake "sys1", "--trace"
|
|
124
|
+
end
|
|
125
|
+
assert_match %r{^SYS1}, @out
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def test_no_system
|
|
129
|
+
in_environment('RAKE_SYSTEM' => 'test/data/sys') do
|
|
130
|
+
rake '-G', "sys1"
|
|
131
|
+
end
|
|
132
|
+
assert_match %r{^Don't know how to build task}, @err # emacs wart: '
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def test_nosearch_with_rakefile_uses_local_rakefile
|
|
136
|
+
in_environment("PWD" => "test/data/default") do
|
|
137
|
+
rake "--nosearch"
|
|
138
|
+
end
|
|
139
|
+
assert_match %r{^DEFAULT}, @out
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def test_nosearch_without_rakefile_finds_system
|
|
143
|
+
in_environment(
|
|
144
|
+
"PWD" => "test/data/nosearch",
|
|
145
|
+
"RAKE_SYSTEM" => File.expand_path("test/data/sys")
|
|
146
|
+
) do
|
|
147
|
+
rake "--nosearch", "sys1"
|
|
148
|
+
end
|
|
149
|
+
assert_match %r{^SYS1}, @out
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def test_nosearch_without_rakefile_and_no_system_fails
|
|
153
|
+
in_environment("PWD" => "test/data/nosearch", "RAKE_SYSTEM" => "not_exist") do
|
|
154
|
+
rake "--nosearch"
|
|
155
|
+
end
|
|
87
156
|
assert_match %r{^No Rakefile found}, @err
|
|
88
157
|
end
|
|
89
158
|
|
|
90
159
|
def test_dry_run
|
|
91
|
-
|
|
160
|
+
in_environment("PWD" => "test/data/default") do rake "-n", "other" end
|
|
92
161
|
assert_match %r{Execute \(dry run\) default}, @out
|
|
93
162
|
assert_match %r{Execute \(dry run\) other}, @out
|
|
94
163
|
assert_no_match %r{DEFAULT}, @out
|
|
@@ -97,18 +166,26 @@ class FunctionalTest < Test::Unit::TestCase
|
|
|
97
166
|
|
|
98
167
|
# Test for the trace/dry_run bug found by Brian Chandler
|
|
99
168
|
def test_dry_run_bug
|
|
100
|
-
|
|
169
|
+
in_environment("PWD" => "test/data/dryrun") do
|
|
170
|
+
rake
|
|
171
|
+
end
|
|
101
172
|
FileUtils.rm_f "test/data/dryrun/temp_one"
|
|
102
|
-
|
|
173
|
+
in_environment("PWD" => "test/data/dryrun") do
|
|
174
|
+
rake "--dry-run"
|
|
175
|
+
end
|
|
103
176
|
assert_no_match(/No such file/, @out)
|
|
104
177
|
assert_status
|
|
105
178
|
end
|
|
106
179
|
|
|
107
180
|
# Test for the trace/dry_run bug found by Brian Chandler
|
|
108
181
|
def test_trace_bug
|
|
109
|
-
|
|
182
|
+
in_environment("PWD" => "test/data/dryrun") do
|
|
183
|
+
rake
|
|
184
|
+
end
|
|
110
185
|
FileUtils.rm_f "test/data/dryrun/temp_one"
|
|
111
|
-
|
|
186
|
+
in_environment("PWD" => "test/data/dryrun") do
|
|
187
|
+
rake "--trace"
|
|
188
|
+
end
|
|
112
189
|
assert_no_match(/No such file/, @out)
|
|
113
190
|
assert_status
|
|
114
191
|
end
|
|
@@ -118,7 +195,9 @@ class FunctionalTest < Test::Unit::TestCase
|
|
|
118
195
|
f.puts 'puts "STATIC"'
|
|
119
196
|
end
|
|
120
197
|
FileUtils.rm_f "test/data/imports/dynamic_deps"
|
|
121
|
-
|
|
198
|
+
in_environment("PWD" => "test/data/imports") do
|
|
199
|
+
rake
|
|
200
|
+
end
|
|
122
201
|
assert File.exist?("test/data/imports/dynamic_deps"),
|
|
123
202
|
"'dynamic_deps' file should exist"
|
|
124
203
|
assert_match(/^FIRST$\s+^DYNAMIC$\s+^STATIC$\s+^OTHER$/, @out)
|
|
@@ -129,7 +208,9 @@ class FunctionalTest < Test::Unit::TestCase
|
|
|
129
208
|
|
|
130
209
|
def test_rules_chaining_to_file_task
|
|
131
210
|
remove_chaining_files
|
|
132
|
-
|
|
211
|
+
in_environment("PWD" => "test/data/chains") do
|
|
212
|
+
rake
|
|
213
|
+
end
|
|
133
214
|
assert File.exist?("test/data/chains/play.app"),
|
|
134
215
|
"'play.app' file should exist"
|
|
135
216
|
assert_status
|
|
@@ -137,12 +218,12 @@ class FunctionalTest < Test::Unit::TestCase
|
|
|
137
218
|
end
|
|
138
219
|
|
|
139
220
|
def test_file_creation_task
|
|
140
|
-
|
|
221
|
+
in_environment("PWD" => "test/data/file_creation_task") do
|
|
141
222
|
rake "prep"
|
|
142
223
|
rake "run"
|
|
143
224
|
rake "run"
|
|
144
|
-
assert(@err !~ /^cp src/, "Should not recopy data")
|
|
145
225
|
end
|
|
226
|
+
assert(@err !~ /^cp src/, "Should not recopy data")
|
|
146
227
|
end
|
|
147
228
|
|
|
148
229
|
def test_dash_f_with_no_arg_foils_rakefile_lookup
|
|
@@ -150,69 +231,69 @@ class FunctionalTest < Test::Unit::TestCase
|
|
|
150
231
|
assert_match(/^TEST1$/, @out)
|
|
151
232
|
end
|
|
152
233
|
|
|
153
|
-
def
|
|
234
|
+
def test_dot_rake_files_can_be_loaded_with_dash_r
|
|
154
235
|
rake "-I test/data/rakelib -rtest2 -f"
|
|
155
236
|
assert_match(/^TEST2$/, @out)
|
|
156
237
|
end
|
|
157
238
|
|
|
158
239
|
def test_can_invoke_task_in_toplevel_namespace
|
|
159
|
-
|
|
240
|
+
in_environment("PWD" => "test/data/namespace") do
|
|
160
241
|
rake "copy"
|
|
161
|
-
assert_match(/^COPY$/, @out)
|
|
162
242
|
end
|
|
243
|
+
assert_match(/^COPY$/, @out)
|
|
163
244
|
end
|
|
164
245
|
|
|
165
246
|
def test_can_invoke_task_in_nested_namespace
|
|
166
|
-
|
|
247
|
+
in_environment("PWD" => "test/data/namespace") do
|
|
167
248
|
rake "nest:copy"
|
|
168
249
|
assert_match(/^NEST COPY$/, @out)
|
|
169
250
|
end
|
|
170
251
|
end
|
|
171
252
|
|
|
172
253
|
def test_tasks_can_reference_task_in_same_namespace
|
|
173
|
-
|
|
254
|
+
in_environment("PWD" => "test/data/namespace") do
|
|
174
255
|
rake "nest:xx"
|
|
175
256
|
assert_match(/^NEST COPY$/m, @out)
|
|
176
257
|
end
|
|
177
258
|
end
|
|
178
259
|
|
|
179
260
|
def test_tasks_can_reference_task_in_other_namespaces
|
|
180
|
-
|
|
261
|
+
in_environment("PWD" => "test/data/namespace") do
|
|
181
262
|
rake "b:run"
|
|
182
263
|
assert_match(/^IN A\nIN B$/m, @out)
|
|
183
264
|
end
|
|
184
265
|
end
|
|
185
266
|
|
|
186
267
|
def test_anonymous_tasks_can_be_invoked_indirectly
|
|
187
|
-
|
|
268
|
+
in_environment("PWD" => "test/data/namespace") do
|
|
188
269
|
rake "anon"
|
|
189
270
|
assert_match(/^ANON COPY$/m, @out)
|
|
190
271
|
end
|
|
191
272
|
end
|
|
192
273
|
|
|
193
274
|
def test_rake_namespace_refers_to_toplevel
|
|
194
|
-
|
|
275
|
+
in_environment("PWD" => "test/data/namespace") do
|
|
195
276
|
rake "very:nested:run"
|
|
196
277
|
assert_match(/^COPY$/m, @out)
|
|
197
278
|
end
|
|
198
279
|
end
|
|
199
280
|
|
|
200
281
|
def test_file_task_are_not_scoped_by_namespaces
|
|
201
|
-
|
|
282
|
+
in_environment("PWD" => "test/data/namespace") do
|
|
202
283
|
rake "xyz.rb"
|
|
203
284
|
assert_match(/^XYZ1\nXYZ2$/m, @out)
|
|
204
285
|
end
|
|
205
286
|
end
|
|
206
287
|
|
|
207
288
|
def test_rake_returns_status_error_values
|
|
208
|
-
|
|
289
|
+
in_environment("PWD" => "test/data/statusreturn") do
|
|
209
290
|
rake "exit5"
|
|
210
291
|
assert_status(5)
|
|
211
292
|
end
|
|
212
293
|
end
|
|
213
294
|
|
|
214
295
|
def test_rake_returns_no_status_error_on_normal_exit
|
|
215
|
-
|
|
296
|
+
in_environment("PWD" => "test/data/statusreturn") do
|
|
216
297
|
rake "normal"
|
|
217
298
|
assert_status(0)
|
|
218
299
|
end
|
|
@@ -239,10 +320,6 @@ class FunctionalTest < Test::Unit::TestCase
|
|
|
239
320
|
end
|
|
240
321
|
|
|
241
322
|
def rake(*option_list)
|
|
242
|
-
# self.class.format_command = lambda { |ruby_options, rake_path, options|
|
|
243
|
-
# "rcov --output=#{@rcov_dir} --aggregate=#{@coverage_aggregate_file} #{ruby_options} #{rake_path} -- #{options}"
|
|
244
|
-
# }
|
|
245
|
-
|
|
246
323
|
options = option_list.join(' ')
|
|
247
324
|
shell = Session::Shell.new
|
|
248
325
|
command = self.class.format_command[@ruby_options, @rake_path, options]
|
|
@@ -259,5 +336,4 @@ class FunctionalTest < Test::Unit::TestCase
|
|
|
259
336
|
def assert_status(expected_status=0)
|
|
260
337
|
assert_equal expected_status, @status
|
|
261
338
|
end
|
|
262
|
-
|
|
263
339
|
end
|
data/test/shellcommand.rb
CHANGED
|
File without changes
|