drake 0.8.1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +386 -0
- data/MIT-LICENSE +21 -0
- data/README +396 -0
- data/Rakefile +505 -0
- data/TODO +20 -0
- data/bin/drake +31 -0
- data/bin/rake +31 -0
- data/doc/example/Rakefile1 +38 -0
- data/doc/example/Rakefile2 +35 -0
- data/doc/example/a.c +6 -0
- data/doc/example/b.c +6 -0
- data/doc/example/main.c +11 -0
- data/doc/glossary.rdoc +51 -0
- data/doc/jamis.rb +591 -0
- data/doc/proto_rake.rdoc +127 -0
- data/doc/rake.1.gz +0 -0
- data/doc/rakefile.rdoc +534 -0
- data/doc/rational.rdoc +151 -0
- data/doc/release_notes/rake-0.4.14.rdoc +23 -0
- data/doc/release_notes/rake-0.4.15.rdoc +35 -0
- data/doc/release_notes/rake-0.5.0.rdoc +53 -0
- data/doc/release_notes/rake-0.5.3.rdoc +78 -0
- data/doc/release_notes/rake-0.5.4.rdoc +46 -0
- data/doc/release_notes/rake-0.6.0.rdoc +141 -0
- data/doc/release_notes/rake-0.7.0.rdoc +119 -0
- data/doc/release_notes/rake-0.7.1.rdoc +59 -0
- data/doc/release_notes/rake-0.7.2.rdoc +121 -0
- data/doc/release_notes/rake-0.7.3.rdoc +47 -0
- data/doc/release_notes/rake-0.8.0.rdoc +114 -0
- data/doc/release_notes/rake-0.8.2.rdoc +163 -0
- data/install.rb +88 -0
- data/lib/rake.rb +2538 -0
- data/lib/rake/classic_namespace.rb +8 -0
- data/lib/rake/clean.rb +33 -0
- data/lib/rake/comp_tree/algorithm.rb +234 -0
- data/lib/rake/comp_tree/bucket_ipc.rb +175 -0
- data/lib/rake/comp_tree/driver.rb +291 -0
- data/lib/rake/comp_tree/error.rb +51 -0
- data/lib/rake/comp_tree/node.rb +189 -0
- data/lib/rake/comp_tree/quix/builtin/kernel/tap.rb +57 -0
- data/lib/rake/comp_tree/quix/diagnostic.rb +92 -0
- data/lib/rake/comp_tree/quix/kernel.rb +109 -0
- data/lib/rake/comp_tree/retriable_fork.rb +66 -0
- data/lib/rake/comp_tree/task_node.rb +46 -0
- data/lib/rake/contrib/compositepublisher.rb +24 -0
- data/lib/rake/contrib/ftptools.rb +153 -0
- data/lib/rake/contrib/publisher.rb +75 -0
- data/lib/rake/contrib/rubyforgepublisher.rb +18 -0
- data/lib/rake/contrib/sshpublisher.rb +47 -0
- data/lib/rake/contrib/sys.rb +209 -0
- data/lib/rake/gempackagetask.rb +103 -0
- data/lib/rake/loaders/makefile.rb +35 -0
- data/lib/rake/packagetask.rb +185 -0
- data/lib/rake/parallel.rb +54 -0
- data/lib/rake/rake_test_loader.rb +5 -0
- data/lib/rake/rdoctask.rb +147 -0
- data/lib/rake/ruby182_test_unit_fix.rb +23 -0
- data/lib/rake/runtest.rb +23 -0
- data/lib/rake/tasklib.rb +23 -0
- data/lib/rake/testtask.rb +161 -0
- data/test/capture_stdout.rb +26 -0
- data/test/check_expansion.rb +5 -0
- data/test/contrib/test_sys.rb +47 -0
- data/test/data/chains/Rakefile +15 -0
- data/test/data/default/Rakefile +19 -0
- data/test/data/dryrun/Rakefile +22 -0
- data/test/data/file_creation_task/Rakefile +33 -0
- data/test/data/imports/Rakefile +19 -0
- data/test/data/imports/deps.mf +1 -0
- data/test/data/multidesc/Rakefile +17 -0
- data/test/data/namespace/Rakefile +57 -0
- data/test/data/rakelib/test1.rb +3 -0
- data/test/data/rbext/rakefile.rb +3 -0
- data/test/data/sample.mf +12 -0
- data/test/data/statusreturn/Rakefile +8 -0
- data/test/data/unittest/Rakefile +1 -0
- data/test/filecreation.rb +32 -0
- data/test/functional.rb +15 -0
- data/test/in_environment.rb +30 -0
- data/test/parallel.rb +3 -0
- data/test/rake_test_setup.rb +5 -0
- data/test/reqfile.rb +3 -0
- data/test/reqfile2.rb +3 -0
- data/test/session_functional.rb +324 -0
- data/test/shellcommand.rb +3 -0
- data/test/single_threaded.rb +2 -0
- data/test/test_application.rb +714 -0
- data/test/test_clean.rb +14 -0
- data/test/test_definitions.rb +82 -0
- data/test/test_earlytime.rb +35 -0
- data/test/test_extension.rb +63 -0
- data/test/test_file_creation_task.rb +62 -0
- data/test/test_file_task.rb +139 -0
- data/test/test_filelist.rb +618 -0
- data/test/test_fileutils.rb +250 -0
- data/test/test_ftp.rb +59 -0
- data/test/test_invocation_chain.rb +75 -0
- data/test/test_makefile_loader.rb +25 -0
- data/test/test_namespace.rb +36 -0
- data/test/test_package_task.rb +116 -0
- data/test/test_parallel.rb +47 -0
- data/test/test_pathmap.rb +209 -0
- data/test/test_rake.rb +41 -0
- data/test/test_require.rb +33 -0
- data/test/test_rules.rb +348 -0
- data/test/test_task_arguments.rb +89 -0
- data/test/test_task_manager.rb +172 -0
- data/test/test_tasklib.rb +12 -0
- data/test/test_tasks.rb +373 -0
- data/test/test_test_task.rb +75 -0
- data/test/test_top_level_functions.rb +84 -0
- metadata +190 -0
data/test/data/sample.mf
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Empty Rakefile for Unit Test
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
module FileCreation
|
4
|
+
OLDFILE = "testdata/old"
|
5
|
+
NEWFILE = "testdata/new"
|
6
|
+
|
7
|
+
def create_timed_files(oldfile, *newfiles)
|
8
|
+
return if File.exist?(oldfile) && newfiles.all? { |newfile| File.exist?(newfile) }
|
9
|
+
old_time = create_file(oldfile)
|
10
|
+
newfiles.each do |newfile|
|
11
|
+
while create_file(newfile) <= old_time
|
12
|
+
sleep(0.1)
|
13
|
+
File.delete(newfile) rescue nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_dir(dirname)
|
19
|
+
FileUtils.mkdir_p(dirname) unless File.exist?(dirname)
|
20
|
+
File.stat(dirname).mtime
|
21
|
+
end
|
22
|
+
|
23
|
+
def create_file(name)
|
24
|
+
create_dir(File.dirname(name))
|
25
|
+
FileUtils.touch(name) unless File.exist?(name)
|
26
|
+
File.stat(name).mtime
|
27
|
+
end
|
28
|
+
|
29
|
+
def delete_file(name)
|
30
|
+
File.delete(name) rescue nil
|
31
|
+
end
|
32
|
+
end
|
data/test/functional.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'rubygems'
|
5
|
+
gem 'session'
|
6
|
+
require 'session'
|
7
|
+
rescue LoadError
|
8
|
+
puts "UNABLE TO RUN FUNCTIONAL TESTS"
|
9
|
+
puts "No Session Found (gem install session)"
|
10
|
+
end
|
11
|
+
|
12
|
+
if defined?(Session)
|
13
|
+
puts "RUNNING WITH SESSIONS"
|
14
|
+
require 'test/session_functional'
|
15
|
+
end
|
@@ -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/parallel.rb
ADDED
data/test/reqfile.rb
ADDED
data/test/reqfile2.rb
ADDED
@@ -0,0 +1,324 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'rubygems'
|
5
|
+
rescue LoadError => ex
|
6
|
+
end
|
7
|
+
require 'test/unit'
|
8
|
+
require 'fileutils'
|
9
|
+
require 'session'
|
10
|
+
require 'test/in_environment'
|
11
|
+
|
12
|
+
# Version 2.1.9 of session has a bug where the @debug instance
|
13
|
+
# variable is not initialized, causing warning messages. This snippet
|
14
|
+
# of code fixes that problem.
|
15
|
+
module Session
|
16
|
+
class AbstractSession
|
17
|
+
alias old_initialize initialize
|
18
|
+
def initialize(*args)
|
19
|
+
@debug = nil
|
20
|
+
old_initialize(*args)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class FunctionalTest < Test::Unit::TestCase
|
26
|
+
include InEnvironment
|
27
|
+
|
28
|
+
RUBY_COMMAND = 'ruby'
|
29
|
+
|
30
|
+
def setup
|
31
|
+
@rake_path = File.expand_path("bin/rake")
|
32
|
+
lib_path = File.expand_path("lib")
|
33
|
+
@ruby_options = "-I#{lib_path} -I."
|
34
|
+
@verbose = ! ENV['VERBOSE'].nil?
|
35
|
+
if @verbose
|
36
|
+
puts
|
37
|
+
puts
|
38
|
+
puts "--------------------------------------------------------------------"
|
39
|
+
puts name
|
40
|
+
puts "--------------------------------------------------------------------"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_rake_default
|
45
|
+
Dir.chdir("test/data/default") do rake end
|
46
|
+
assert_match(/^DEFAULT$/, @out)
|
47
|
+
assert_status
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_rake_error_on_bad_task
|
51
|
+
Dir.chdir("test/data/default") do rake "xyz" end
|
52
|
+
assert_match(/rake aborted/, @err)
|
53
|
+
assert_status(1)
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_env_availabe_at_top_scope
|
57
|
+
Dir.chdir("test/data/default") do rake "TESTTOPSCOPE=1" end
|
58
|
+
assert_match(/^TOPSCOPE$/, @out)
|
59
|
+
assert_status
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_env_availabe_at_task_scope
|
63
|
+
Dir.chdir("test/data/default") do rake "TESTTASKSCOPE=1 task_scope" end
|
64
|
+
assert_match(/^TASKSCOPE$/, @out)
|
65
|
+
assert_status
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_multi_desc
|
69
|
+
in_environment(
|
70
|
+
'RAKE_COLUMNS' => "80",
|
71
|
+
"PWD" => "test/data/multidesc"
|
72
|
+
) do
|
73
|
+
rake "-T"
|
74
|
+
end
|
75
|
+
assert_match %r{^rake a *# A / A2 *$}, @out
|
76
|
+
assert_match %r{^rake b *# B *$}, @out
|
77
|
+
assert_no_match %r{^rake c}, @out
|
78
|
+
assert_match %r{^rake d *# x{65}\.\.\.$}, @out
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_long_description
|
82
|
+
in_environment("PWD" => "test/data/multidesc") do
|
83
|
+
rake "--describe"
|
84
|
+
end
|
85
|
+
assert_match %r{^rake a\n *A / A2 *$}m, @out
|
86
|
+
assert_match %r{^rake b\n *B *$}m, @out
|
87
|
+
assert_match %r{^rake d\n *x{80}}m, @out
|
88
|
+
assert_no_match %r{^rake c\n}m, @out
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_rbext
|
92
|
+
in_environment("PWD" => "test/data/rbext") do
|
93
|
+
rake "-N"
|
94
|
+
end
|
95
|
+
assert_match %r{^OK$}, @out
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_system
|
99
|
+
in_environment('RAKE_SYSTEM' => 'test/data/sys') do
|
100
|
+
rake '-g', "sys1"
|
101
|
+
end
|
102
|
+
assert_match %r{^SYS1}, @out
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_implicit_system
|
106
|
+
in_environment('RAKE_SYSTEM' => File.expand_path('test/data/sys'), "PWD" => "/") do
|
107
|
+
rake "sys1", "--trace"
|
108
|
+
end
|
109
|
+
assert_match %r{^SYS1}, @out
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_no_system
|
113
|
+
in_environment('RAKE_SYSTEM' => 'test/data/sys') do
|
114
|
+
rake '-G', "sys1"
|
115
|
+
end
|
116
|
+
assert_match %r{^Don't know how to build task}, @err # emacs wart: '
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_nosearch_with_rakefile_uses_local_rakefile
|
120
|
+
in_environment("PWD" => "test/data/default") do
|
121
|
+
rake "--nosearch"
|
122
|
+
end
|
123
|
+
assert_match %r{^DEFAULT}, @out
|
124
|
+
end
|
125
|
+
|
126
|
+
def test_nosearch_without_rakefile_finds_system
|
127
|
+
in_environment(
|
128
|
+
"PWD" => "test/data/nosearch",
|
129
|
+
"RAKE_SYSTEM" => File.expand_path("test/data/sys")
|
130
|
+
) do
|
131
|
+
rake "--nosearch", "sys1"
|
132
|
+
end
|
133
|
+
assert_match %r{^SYS1}, @out
|
134
|
+
end
|
135
|
+
|
136
|
+
def test_nosearch_without_rakefile_and_no_system_fails
|
137
|
+
in_environment("PWD" => "test/data/nosearch", "RAKE_SYSTEM" => "not_exist") do
|
138
|
+
rake "--nosearch"
|
139
|
+
end
|
140
|
+
assert_match %r{^No Rakefile found}, @err
|
141
|
+
end
|
142
|
+
|
143
|
+
def test_dry_run
|
144
|
+
in_environment("PWD" => "test/data/default") do rake "-n", "other" end
|
145
|
+
assert_match %r{Execute \(dry run\) default}, @out
|
146
|
+
assert_match %r{Execute \(dry run\) other}, @out
|
147
|
+
assert_no_match %r{DEFAULT}, @out
|
148
|
+
assert_no_match %r{OTHER}, @out
|
149
|
+
end
|
150
|
+
|
151
|
+
# Test for the trace/dry_run bug found by Brian Chandler
|
152
|
+
def test_dry_run_bug
|
153
|
+
in_environment("PWD" => "test/data/dryrun") do
|
154
|
+
rake
|
155
|
+
end
|
156
|
+
FileUtils.rm_f "test/data/dryrun/temp_one"
|
157
|
+
in_environment("PWD" => "test/data/dryrun") do
|
158
|
+
rake "--dry-run"
|
159
|
+
end
|
160
|
+
assert_no_match(/No such file/, @out)
|
161
|
+
assert_status
|
162
|
+
end
|
163
|
+
|
164
|
+
# Test for the trace/dry_run bug found by Brian Chandler
|
165
|
+
def test_trace_bug
|
166
|
+
in_environment("PWD" => "test/data/dryrun") do
|
167
|
+
rake
|
168
|
+
end
|
169
|
+
FileUtils.rm_f "test/data/dryrun/temp_one"
|
170
|
+
in_environment("PWD" => "test/data/dryrun") do
|
171
|
+
rake "--trace"
|
172
|
+
end
|
173
|
+
assert_no_match(/No such file/, @out)
|
174
|
+
assert_status
|
175
|
+
end
|
176
|
+
|
177
|
+
def test_imports
|
178
|
+
open("test/data/imports/static_deps", "w") do |f|
|
179
|
+
f.puts 'puts "STATIC"'
|
180
|
+
end
|
181
|
+
FileUtils.rm_f "test/data/imports/dynamic_deps"
|
182
|
+
in_environment("PWD" => "test/data/imports") do
|
183
|
+
rake
|
184
|
+
end
|
185
|
+
assert File.exist?("test/data/imports/dynamic_deps"),
|
186
|
+
"'dynamic_deps' file should exist"
|
187
|
+
assert_match(/^FIRST$\s+^DYNAMIC$\s+^STATIC$\s+^OTHER$/, @out)
|
188
|
+
assert_status
|
189
|
+
FileUtils.rm_f "test/data/imports/dynamic_deps"
|
190
|
+
FileUtils.rm_f "test/data/imports/static_deps"
|
191
|
+
end
|
192
|
+
|
193
|
+
def test_rules_chaining_to_file_task
|
194
|
+
remove_chaining_files
|
195
|
+
in_environment("PWD" => "test/data/chains") do
|
196
|
+
rake
|
197
|
+
end
|
198
|
+
assert File.exist?("test/data/chains/play.app"),
|
199
|
+
"'play.app' file should exist"
|
200
|
+
assert_status
|
201
|
+
remove_chaining_files
|
202
|
+
end
|
203
|
+
|
204
|
+
def test_file_creation_task
|
205
|
+
in_environment("PWD" => "test/data/file_creation_task") do
|
206
|
+
rake "prep"
|
207
|
+
rake "run"
|
208
|
+
rake "run"
|
209
|
+
end
|
210
|
+
assert(@err !~ /^cp src/, "Should not recopy data")
|
211
|
+
end
|
212
|
+
|
213
|
+
def test_dash_f_with_no_arg_foils_rakefile_lookup
|
214
|
+
rake "-I test/data/rakelib -rtest1 -f"
|
215
|
+
assert_match(/^TEST1$/, @out)
|
216
|
+
end
|
217
|
+
|
218
|
+
def test_dot_rake_files_can_be_loaded_with_dash_r
|
219
|
+
rake "-I test/data/rakelib -rtest2 -f"
|
220
|
+
assert_match(/^TEST2$/, @out)
|
221
|
+
end
|
222
|
+
|
223
|
+
def test_can_invoke_task_in_toplevel_namespace
|
224
|
+
in_environment("PWD" => "test/data/namespace") do
|
225
|
+
rake "copy"
|
226
|
+
end
|
227
|
+
assert_match(/^COPY$/, @out)
|
228
|
+
end
|
229
|
+
|
230
|
+
def test_can_invoke_task_in_nested_namespace
|
231
|
+
in_environment("PWD" => "test/data/namespace") do
|
232
|
+
rake "nest:copy"
|
233
|
+
assert_match(/^NEST COPY$/, @out)
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
def test_tasks_can_reference_task_in_same_namespace
|
238
|
+
in_environment("PWD" => "test/data/namespace") do
|
239
|
+
rake "nest:xx"
|
240
|
+
assert_match(/^NEST COPY$/m, @out)
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
def test_tasks_can_reference_task_in_other_namespaces
|
245
|
+
in_environment("PWD" => "test/data/namespace") do
|
246
|
+
rake "b:run"
|
247
|
+
assert_match(/^IN A\nIN B$/m, @out)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
def test_anonymous_tasks_can_be_invoked_indirectly
|
252
|
+
in_environment("PWD" => "test/data/namespace") do
|
253
|
+
rake "anon"
|
254
|
+
assert_match(/^ANON COPY$/m, @out)
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
def test_rake_namespace_refers_to_toplevel
|
259
|
+
in_environment("PWD" => "test/data/namespace") do
|
260
|
+
rake "very:nested:run"
|
261
|
+
assert_match(/^COPY$/m, @out)
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
def test_file_task_are_not_scoped_by_namespaces
|
266
|
+
in_environment("PWD" => "test/data/namespace") do
|
267
|
+
rake "xyz.rb"
|
268
|
+
assert_match(/^XYZ1\nXYZ2$/m, @out)
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
def test_rake_returns_status_error_values
|
273
|
+
in_environment("PWD" => "test/data/statusreturn") do
|
274
|
+
rake "exit5"
|
275
|
+
assert_status(5)
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
def test_rake_returns_no_status_error_on_normal_exit
|
280
|
+
in_environment("PWD" => "test/data/statusreturn") do
|
281
|
+
rake "normal"
|
282
|
+
assert_status(0)
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
private
|
287
|
+
|
288
|
+
def remove_chaining_files
|
289
|
+
%w(play.scpt play.app base).each do |fn|
|
290
|
+
FileUtils.rm_f File.join("test/data/chains", fn)
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
class << self
|
295
|
+
def format_command
|
296
|
+
@format_command ||= lambda { |ruby_options, rake_path, options|
|
297
|
+
"ruby #{ruby_options} #{rake_path} #{options}"
|
298
|
+
}
|
299
|
+
end
|
300
|
+
|
301
|
+
def format_command=(fmt_command)
|
302
|
+
@format_command = fmt_command
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
def rake(*option_list)
|
307
|
+
options = option_list.join(' ')
|
308
|
+
shell = Session::Shell.new
|
309
|
+
command = self.class.format_command[@ruby_options, @rake_path, options]
|
310
|
+
puts "COMMAND: [#{command}]" if @verbose
|
311
|
+
@out, @err = shell.execute command
|
312
|
+
@status = shell.exit_status
|
313
|
+
puts "STATUS: [#{@status}]" if @verbose
|
314
|
+
puts "OUTPUT: [#{@out}]" if @verbose
|
315
|
+
puts "ERROR: [#{@err}]" if @verbose
|
316
|
+
puts "PWD: [#{Dir.pwd}]" if @verbose
|
317
|
+
shell.close
|
318
|
+
end
|
319
|
+
|
320
|
+
def assert_status(expected_status=0)
|
321
|
+
assert_equal expected_status, @status
|
322
|
+
end
|
323
|
+
|
324
|
+
end
|