rake 0.9.2 → 13.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CONTRIBUTING.rdoc +43 -0
- data/Gemfile +10 -0
- data/History.rdoc +2386 -0
- data/MIT-LICENSE +1 -1
- data/README.rdoc +64 -109
- data/Rakefile +22 -386
- data/bin/bundle +105 -0
- data/bin/console +7 -0
- data/bin/rake +20 -23
- data/bin/rdoc +29 -0
- data/bin/rubocop +29 -0
- data/bin/setup +6 -0
- data/doc/command_line_usage.rdoc +65 -21
- data/doc/glossary.rdoc +40 -49
- data/doc/jamis.rb +1 -0
- data/doc/rake.1 +156 -0
- data/doc/rakefile.rdoc +127 -62
- data/exe/rake +27 -0
- data/lib/rake.rb +37 -31
- data/lib/rake/application.rb +507 -272
- data/lib/rake/backtrace.rb +24 -0
- data/lib/rake/clean.rb +55 -8
- data/lib/rake/cloneable.rb +11 -19
- data/lib/rake/cpu_counter.rb +107 -0
- data/lib/rake/default_loader.rb +5 -0
- data/lib/rake/dsl_definition.rb +74 -46
- data/lib/rake/early_time.rb +5 -1
- data/lib/rake/ext/core.rb +5 -6
- data/lib/rake/ext/string.rb +61 -52
- data/lib/rake/file_creation_task.rb +4 -3
- data/lib/rake/file_list.rb +81 -49
- data/lib/rake/file_task.rb +15 -8
- data/lib/rake/file_utils.rb +69 -47
- data/lib/rake/file_utils_ext.rb +18 -26
- data/lib/rake/invocation_chain.rb +25 -19
- data/lib/rake/invocation_exception_mixin.rb +1 -0
- data/lib/rake/late_time.rb +18 -0
- data/lib/rake/linked_list.rb +112 -0
- data/lib/rake/loaders/makefile.rb +23 -9
- data/lib/rake/multi_task.rb +4 -6
- data/lib/rake/name_space.rb +36 -23
- data/lib/rake/packagetask.rb +71 -34
- data/lib/rake/phony.rb +16 -0
- data/lib/rake/private_reader.rb +21 -0
- data/lib/rake/promise.rb +100 -0
- data/lib/rake/pseudo_status.rb +8 -2
- data/lib/rake/rake_module.rb +41 -3
- data/lib/rake/rake_test_loader.rb +21 -7
- data/lib/rake/rule_recursion_overflow_error.rb +2 -2
- data/lib/rake/scope.rb +43 -0
- data/lib/rake/task.rb +186 -79
- data/lib/rake/task_argument_error.rb +1 -0
- data/lib/rake/task_arguments.rb +50 -15
- data/lib/rake/task_manager.rb +89 -65
- data/lib/rake/tasklib.rb +2 -12
- data/lib/rake/testtask.rb +61 -63
- data/lib/rake/thread_history_display.rb +49 -0
- data/lib/rake/thread_pool.rb +163 -0
- data/lib/rake/trace_output.rb +23 -0
- data/lib/rake/version.rb +7 -7
- data/lib/rake/win32.rb +14 -18
- data/rake.gemspec +43 -0
- metadata +82 -221
- data/.gemtest +0 -0
- data/CHANGES +0 -509
- data/RRR +0 -9
- data/TODO +0 -20
- data/doc/rake.1.gz +0 -0
- data/doc/release_notes/rake-0.4.14.rdoc +0 -23
- data/doc/release_notes/rake-0.4.15.rdoc +0 -35
- data/doc/release_notes/rake-0.5.0.rdoc +0 -53
- data/doc/release_notes/rake-0.5.3.rdoc +0 -78
- data/doc/release_notes/rake-0.5.4.rdoc +0 -46
- data/doc/release_notes/rake-0.6.0.rdoc +0 -141
- data/doc/release_notes/rake-0.7.0.rdoc +0 -119
- data/doc/release_notes/rake-0.7.1.rdoc +0 -59
- data/doc/release_notes/rake-0.7.2.rdoc +0 -121
- data/doc/release_notes/rake-0.7.3.rdoc +0 -47
- data/doc/release_notes/rake-0.8.0.rdoc +0 -114
- data/doc/release_notes/rake-0.8.2.rdoc +0 -165
- data/doc/release_notes/rake-0.8.3.rdoc +0 -112
- data/doc/release_notes/rake-0.8.4.rdoc +0 -147
- data/doc/release_notes/rake-0.8.5.rdoc +0 -53
- data/doc/release_notes/rake-0.8.6.rdoc +0 -55
- data/doc/release_notes/rake-0.8.7.rdoc +0 -55
- data/doc/release_notes/rake-0.9.0.rdoc +0 -112
- data/doc/release_notes/rake-0.9.1.rdoc +0 -52
- data/doc/release_notes/rake-0.9.2.rdoc +0 -49
- data/install.rb +0 -90
- data/lib/rake/alt_system.rb +0 -109
- data/lib/rake/classic_namespace.rb +0 -9
- data/lib/rake/contrib/compositepublisher.rb +0 -21
- data/lib/rake/contrib/ftptools.rb +0 -150
- data/lib/rake/contrib/publisher.rb +0 -69
- data/lib/rake/contrib/rubyforgepublisher.rb +0 -16
- data/lib/rake/contrib/sshpublisher.rb +0 -45
- data/lib/rake/contrib/sys.rb +0 -191
- data/lib/rake/ext/module.rb +0 -39
- data/lib/rake/ext/time.rb +0 -14
- data/lib/rake/gempackagetask.rb +0 -13
- data/lib/rake/pathmap.rb +0 -1
- data/lib/rake/rdoctask.rb +0 -230
- data/lib/rake/ruby182_test_unit_fix.rb +0 -25
- data/lib/rake/runtest.rb +0 -21
- data/test/check_expansion.rb +0 -5
- data/test/check_no_expansion.rb +0 -5
- data/test/data/access/Rakefile +0 -35
- data/test/data/chains/Rakefile +0 -15
- data/test/data/comments/Rakefile +0 -18
- data/test/data/default/Rakefile +0 -17
- data/test/data/deprecated_import/Rakefile +0 -1
- data/test/data/dryrun/Rakefile +0 -22
- data/test/data/extra/Rakefile +0 -1
- data/test/data/file_creation_task/Rakefile +0 -31
- data/test/data/imports/Rakefile +0 -19
- data/test/data/imports/deps.mf +0 -1
- data/test/data/multidesc/Rakefile +0 -15
- data/test/data/namespace/Rakefile +0 -64
- data/test/data/rakelib/test1.rb +0 -4
- data/test/data/rbext/rakefile.rb +0 -3
- data/test/data/sample.mf +0 -14
- data/test/data/statusreturn/Rakefile +0 -6
- data/test/data/unittest/Rakefile +0 -1
- data/test/data/verbose/Rakefile +0 -34
- data/test/file_creation.rb +0 -34
- data/test/helper.rb +0 -44
- data/test/in_environment.rb +0 -35
- data/test/reqfile.rb +0 -3
- data/test/reqfile2.rb +0 -3
- data/test/shellcommand.rb +0 -3
- data/test/test_rake.rb +0 -38
- data/test/test_rake_application.rb +0 -364
- data/test/test_rake_application_options.rb +0 -382
- data/test/test_rake_clean.rb +0 -12
- data/test/test_rake_definitions.rb +0 -80
- data/test/test_rake_directory_task.rb +0 -55
- data/test/test_rake_dsl.rb +0 -73
- data/test/test_rake_early_time.rb +0 -31
- data/test/test_rake_extension.rb +0 -59
- data/test/test_rake_file_creation_task.rb +0 -62
- data/test/test_rake_file_list.rb +0 -633
- data/test/test_rake_file_list_path_map.rb +0 -8
- data/test/test_rake_file_task.rb +0 -104
- data/test/test_rake_file_utils.rb +0 -252
- data/test/test_rake_ftp_file.rb +0 -59
- data/test/test_rake_functional.rb +0 -468
- data/test/test_rake_invocation_chain.rb +0 -52
- data/test/test_rake_makefile_loader.rb +0 -23
- data/test/test_rake_multi_task.rb +0 -51
- data/test/test_rake_name_space.rb +0 -43
- data/test/test_rake_package_task.rb +0 -78
- data/test/test_rake_path_map.rb +0 -157
- data/test/test_rake_path_map_explode.rb +0 -31
- data/test/test_rake_path_map_partial.rb +0 -18
- data/test/test_rake_pseudo_status.rb +0 -20
- data/test/test_rake_rdoc_task.rb +0 -81
- data/test/test_rake_require.rb +0 -35
- data/test/test_rake_rules.rb +0 -346
- data/test/test_rake_task.rb +0 -271
- data/test/test_rake_task_argument_parsing.rb +0 -116
- data/test/test_rake_task_arguments.rb +0 -86
- data/test/test_rake_task_lib.rb +0 -9
- data/test/test_rake_task_manager.rb +0 -145
- data/test/test_rake_task_manager_argument_resolution.rb +0 -36
- data/test/test_rake_task_with_arguments.rb +0 -162
- data/test/test_rake_test_task.rb +0 -122
- data/test/test_rake_top_level_functions.rb +0 -76
- data/test/test_rake_win32.rb +0 -83
- data/test/test_sys.rb +0 -20
@@ -1,20 +0,0 @@
|
|
1
|
-
require File.expand_path('../helper', __FILE__)
|
2
|
-
|
3
|
-
class TestRakePseudoStatus < Rake::TestCase
|
4
|
-
def test_with_zero_exit_status
|
5
|
-
s = Rake::PseudoStatus.new
|
6
|
-
assert_equal 0, s.exitstatus
|
7
|
-
assert_equal 0, s.to_i
|
8
|
-
assert_equal 0, s >> 8
|
9
|
-
assert ! s.stopped?
|
10
|
-
assert s.exited?
|
11
|
-
end
|
12
|
-
def test_with_99_exit_status
|
13
|
-
s = Rake::PseudoStatus.new(99)
|
14
|
-
assert_equal 99, s.exitstatus
|
15
|
-
assert_equal 25344, s.to_i
|
16
|
-
assert_equal 99, s >> 8
|
17
|
-
assert ! s.stopped?
|
18
|
-
assert s.exited?
|
19
|
-
end
|
20
|
-
end
|
data/test/test_rake_rdoc_task.rb
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
require File.expand_path('../helper', __FILE__)
|
2
|
-
begin
|
3
|
-
old_verbose = $VERBOSE
|
4
|
-
$VERBOSE = nil
|
5
|
-
require 'rake/rdoctask'
|
6
|
-
ensure
|
7
|
-
$VERBOSE = old_verbose
|
8
|
-
end
|
9
|
-
|
10
|
-
class TestRakeRDocTask < Rake::TestCase
|
11
|
-
include Rake
|
12
|
-
|
13
|
-
def setup
|
14
|
-
super
|
15
|
-
|
16
|
-
Task.clear
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_tasks_creation
|
20
|
-
Rake::RDocTask.new
|
21
|
-
assert Task[:rdoc]
|
22
|
-
assert Task[:clobber_rdoc]
|
23
|
-
assert Task[:rerdoc]
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_tasks_creation_with_custom_name_symbol
|
27
|
-
rd = Rake::RDocTask.new(:rdoc_dev)
|
28
|
-
assert Task[:rdoc_dev]
|
29
|
-
assert Task[:clobber_rdoc_dev]
|
30
|
-
assert Task[:rerdoc_dev]
|
31
|
-
assert_equal :rdoc_dev, rd.name
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_tasks_creation_with_custom_name_string
|
35
|
-
rd = Rake::RDocTask.new("rdoc_dev")
|
36
|
-
assert Task[:rdoc_dev]
|
37
|
-
assert Task[:clobber_rdoc_dev]
|
38
|
-
assert Task[:rerdoc_dev]
|
39
|
-
assert_equal "rdoc_dev", rd.name
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_tasks_creation_with_custom_name_hash
|
43
|
-
options = { :rdoc => "rdoc", :clobber_rdoc => "rdoc:clean", :rerdoc => "rdoc:force" }
|
44
|
-
rd = Rake::RDocTask.new(options)
|
45
|
-
assert Task[:"rdoc"]
|
46
|
-
assert Task[:"rdoc:clean"]
|
47
|
-
assert Task[:"rdoc:force"]
|
48
|
-
assert_raises(RuntimeError) { Task[:clobber_rdoc] }
|
49
|
-
assert_equal options, rd.name
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_tasks_creation_with_custom_name_hash_will_use_default_if_an_option_isnt_given
|
53
|
-
Rake::RDocTask.new(:clobber_rdoc => "rdoc:clean")
|
54
|
-
assert Task[:rdoc]
|
55
|
-
assert Task[:"rdoc:clean"]
|
56
|
-
assert Task[:rerdoc]
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_tasks_creation_with_custom_name_hash_raises_exception_if_invalid_option_given
|
60
|
-
assert_raises(ArgumentError) do
|
61
|
-
Rake::RDocTask.new(:foo => "bar")
|
62
|
-
end
|
63
|
-
|
64
|
-
begin
|
65
|
-
Rake::RDocTask.new(:foo => "bar")
|
66
|
-
rescue ArgumentError => e
|
67
|
-
assert_match(/foo/, e.message)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_inline_source_option_is_only_appended_if_option_not_already_given
|
72
|
-
rd = Rake::RDocTask.new
|
73
|
-
rd.options << '--inline-source'
|
74
|
-
assert_equal 1, rd.option_list.grep('--inline-source').size
|
75
|
-
|
76
|
-
rd = Rake::RDocTask.new
|
77
|
-
rd.options << '-S'
|
78
|
-
assert_equal 1, rd.option_list.grep('-S').size
|
79
|
-
assert_equal 0, rd.option_list.grep('--inline-source').size
|
80
|
-
end
|
81
|
-
end
|
data/test/test_rake_require.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require File.expand_path('../helper', __FILE__)
|
2
|
-
|
3
|
-
class TestRakeRequire < Rake::TestCase
|
4
|
-
|
5
|
-
def test_can_load_rake_library
|
6
|
-
app = Rake::Application.new
|
7
|
-
assert app.instance_eval {
|
8
|
-
rake_require("test2", ['test/data/rakelib'], [])
|
9
|
-
}
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_wont_reload_rake_library
|
13
|
-
app = Rake::Application.new
|
14
|
-
|
15
|
-
paths = ['test/data/rakelib']
|
16
|
-
loaded_files = []
|
17
|
-
app.rake_require("test2", paths, loaded_files)
|
18
|
-
|
19
|
-
assert ! app.instance_eval {
|
20
|
-
rake_require("test2", paths, loaded_files)
|
21
|
-
}
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_throws_error_if_library_not_found
|
25
|
-
app = Rake::Application.new
|
26
|
-
ex = assert_raises(LoadError) {
|
27
|
-
assert app.instance_eval {
|
28
|
-
rake_require("testx", ['test/data/rakelib'], [])
|
29
|
-
}
|
30
|
-
}
|
31
|
-
assert_match(/(can *not|can't)\s+find/i, ex.message)
|
32
|
-
assert_match(/testx/, ex.message)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
data/test/test_rake_rules.rb
DELETED
@@ -1,346 +0,0 @@
|
|
1
|
-
require File.expand_path('../helper', __FILE__)
|
2
|
-
require 'fileutils'
|
3
|
-
|
4
|
-
######################################################################
|
5
|
-
class TestRakeRules < Rake::TestCase
|
6
|
-
include Rake
|
7
|
-
|
8
|
-
SRCFILE = "testdata/abc.c"
|
9
|
-
SRCFILE2 = "testdata/xyz.c"
|
10
|
-
FTNFILE = "testdata/abc.f"
|
11
|
-
OBJFILE = "testdata/abc.o"
|
12
|
-
FOOFILE = "testdata/foo"
|
13
|
-
DOTFOOFILE = "testdata/.foo"
|
14
|
-
|
15
|
-
def setup
|
16
|
-
super
|
17
|
-
|
18
|
-
Task.clear
|
19
|
-
@runs = []
|
20
|
-
FileUtils.mkdir_p 'testdata' # HACK use tmpdir
|
21
|
-
end
|
22
|
-
|
23
|
-
def teardown
|
24
|
-
FileList['testdata/*'].uniq.each do |f| rm_r(f, :verbose=>false) end
|
25
|
-
|
26
|
-
super
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_multiple_rules1
|
30
|
-
create_file(FTNFILE)
|
31
|
-
delete_file(SRCFILE)
|
32
|
-
delete_file(OBJFILE)
|
33
|
-
rule(/\.o$/ => ['.c']) do @runs << :C end
|
34
|
-
rule(/\.o$/ => ['.f']) do @runs << :F end
|
35
|
-
t = Task[OBJFILE]
|
36
|
-
t.invoke
|
37
|
-
Task[OBJFILE].invoke
|
38
|
-
assert_equal [:F], @runs
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_multiple_rules2
|
42
|
-
create_file(FTNFILE)
|
43
|
-
delete_file(SRCFILE)
|
44
|
-
delete_file(OBJFILE)
|
45
|
-
rule(/\.o$/ => ['.f']) do @runs << :F end
|
46
|
-
rule(/\.o$/ => ['.c']) do @runs << :C end
|
47
|
-
Task[OBJFILE].invoke
|
48
|
-
assert_equal [:F], @runs
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_create_with_source
|
52
|
-
create_file(SRCFILE)
|
53
|
-
rule(/\.o$/ => ['.c']) do |t|
|
54
|
-
@runs << t.name
|
55
|
-
assert_equal OBJFILE, t.name
|
56
|
-
assert_equal SRCFILE, t.source
|
57
|
-
end
|
58
|
-
Task[OBJFILE].invoke
|
59
|
-
assert_equal [OBJFILE], @runs
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_single_dependent
|
63
|
-
create_file(SRCFILE)
|
64
|
-
rule(/\.o$/ => '.c') do |t|
|
65
|
-
@runs << t.name
|
66
|
-
end
|
67
|
-
Task[OBJFILE].invoke
|
68
|
-
assert_equal [OBJFILE], @runs
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_rule_can_be_created_by_string
|
72
|
-
create_file(SRCFILE)
|
73
|
-
rule '.o' => ['.c'] do |t|
|
74
|
-
@runs << t.name
|
75
|
-
end
|
76
|
-
Task[OBJFILE].invoke
|
77
|
-
assert_equal [OBJFILE], @runs
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_rule_prereqs_can_be_created_by_string
|
81
|
-
create_file(SRCFILE)
|
82
|
-
rule '.o' => '.c' do |t|
|
83
|
-
@runs << t.name
|
84
|
-
end
|
85
|
-
Task[OBJFILE].invoke
|
86
|
-
assert_equal [OBJFILE], @runs
|
87
|
-
end
|
88
|
-
|
89
|
-
def test_plain_strings_as_dependents_refer_to_files
|
90
|
-
create_file(SRCFILE)
|
91
|
-
rule '.o' => SRCFILE do |t|
|
92
|
-
@runs << t.name
|
93
|
-
end
|
94
|
-
Task[OBJFILE].invoke
|
95
|
-
assert_equal [OBJFILE], @runs
|
96
|
-
end
|
97
|
-
|
98
|
-
def test_file_names_beginning_with_dot_can_be_tricked_into_referring_to_file
|
99
|
-
verbose(false) do
|
100
|
-
chdir("testdata") do
|
101
|
-
create_file('.foo')
|
102
|
-
rule '.o' => "./.foo" do |t|
|
103
|
-
@runs << t.name
|
104
|
-
end
|
105
|
-
Task[OBJFILE].invoke
|
106
|
-
assert_equal [OBJFILE], @runs
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
def test_file_names_beginning_with_dot_can_be_wrapped_in_lambda
|
112
|
-
verbose(false) do
|
113
|
-
chdir("testdata") do
|
114
|
-
create_file(".foo")
|
115
|
-
rule '.o' => lambda{".foo"} do |t|
|
116
|
-
@runs << "#{t.name} - #{t.source}"
|
117
|
-
end
|
118
|
-
Task[OBJFILE].invoke
|
119
|
-
assert_equal ["#{OBJFILE} - .foo"], @runs
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
def test_file_names_containing_percent_can_be_wrapped_in_lambda
|
125
|
-
verbose(false) do
|
126
|
-
chdir("testdata") do
|
127
|
-
create_file("foo%x")
|
128
|
-
rule '.o' => lambda{"foo%x"} do |t|
|
129
|
-
@runs << "#{t.name} - #{t.source}"
|
130
|
-
end
|
131
|
-
Task[OBJFILE].invoke
|
132
|
-
assert_equal ["#{OBJFILE} - foo%x"], @runs
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
def test_non_extension_rule_name_refers_to_file
|
138
|
-
verbose(false) do
|
139
|
-
chdir("testdata") do
|
140
|
-
create_file("abc.c")
|
141
|
-
rule "abc" => '.c' do |t|
|
142
|
-
@runs << t.name
|
143
|
-
end
|
144
|
-
Task["abc"].invoke
|
145
|
-
assert_equal ["abc"], @runs
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
def test_pathmap_automatically_applies_to_name
|
151
|
-
verbose(false) do
|
152
|
-
chdir("testdata") do
|
153
|
-
create_file("zzabc.c")
|
154
|
-
rule ".o" => 'zz%{x,a}n.c' do |t|
|
155
|
-
@runs << "#{t.name} - #{t.source}"
|
156
|
-
end
|
157
|
-
Task["xbc.o"].invoke
|
158
|
-
assert_equal ["xbc.o - zzabc.c"], @runs
|
159
|
-
end
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
def test_plain_strings_are_just_filenames
|
164
|
-
verbose(false) do
|
165
|
-
chdir("testdata") do
|
166
|
-
create_file("plainname")
|
167
|
-
rule ".o" => 'plainname' do |t|
|
168
|
-
@runs << "#{t.name} - #{t.source}"
|
169
|
-
end
|
170
|
-
Task["xbc.o"].invoke
|
171
|
-
assert_equal ["xbc.o - plainname"], @runs
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
def test_rule_runs_when_explicit_task_has_no_actions
|
177
|
-
create_file(SRCFILE)
|
178
|
-
create_file(SRCFILE2)
|
179
|
-
delete_file(OBJFILE)
|
180
|
-
rule '.o' => '.c' do |t|
|
181
|
-
@runs << t.source
|
182
|
-
end
|
183
|
-
file OBJFILE => [SRCFILE2]
|
184
|
-
Task[OBJFILE].invoke
|
185
|
-
assert_equal [SRCFILE], @runs
|
186
|
-
end
|
187
|
-
|
188
|
-
def test_close_matches_on_name_do_not_trigger_rule
|
189
|
-
create_file("testdata/x.c")
|
190
|
-
rule '.o' => ['.c'] do |t|
|
191
|
-
@runs << t.name
|
192
|
-
end
|
193
|
-
assert_raises(RuntimeError) { Task['testdata/x.obj'].invoke }
|
194
|
-
assert_raises(RuntimeError) { Task['testdata/x.xyo'].invoke }
|
195
|
-
end
|
196
|
-
|
197
|
-
def test_rule_rebuilds_obj_when_source_is_newer
|
198
|
-
create_timed_files(OBJFILE, SRCFILE)
|
199
|
-
rule(/\.o$/ => ['.c']) do
|
200
|
-
@runs << :RULE
|
201
|
-
end
|
202
|
-
Task[OBJFILE].invoke
|
203
|
-
assert_equal [:RULE], @runs
|
204
|
-
end
|
205
|
-
|
206
|
-
def test_rule_with_two_sources_runs_if_both_sources_are_present
|
207
|
-
create_timed_files(OBJFILE, SRCFILE, SRCFILE2)
|
208
|
-
rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
|
209
|
-
@runs << :RULE
|
210
|
-
end
|
211
|
-
Task[OBJFILE].invoke
|
212
|
-
assert_equal [:RULE], @runs
|
213
|
-
end
|
214
|
-
|
215
|
-
def test_rule_with_two_sources_but_one_missing_does_not_run
|
216
|
-
create_timed_files(OBJFILE, SRCFILE)
|
217
|
-
delete_file(SRCFILE2)
|
218
|
-
rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
|
219
|
-
@runs << :RULE
|
220
|
-
end
|
221
|
-
Task[OBJFILE].invoke
|
222
|
-
assert_equal [], @runs
|
223
|
-
end
|
224
|
-
|
225
|
-
def test_rule_with_two_sources_builds_both_sources
|
226
|
-
task 'x.aa'
|
227
|
-
task 'x.bb'
|
228
|
-
rule '.a' => '.aa' do
|
229
|
-
@runs << "A"
|
230
|
-
end
|
231
|
-
rule '.b' => '.bb' do
|
232
|
-
@runs << "B"
|
233
|
-
end
|
234
|
-
rule ".c" => ['.a', '.b'] do
|
235
|
-
@runs << "C"
|
236
|
-
end
|
237
|
-
Task["x.c"].invoke
|
238
|
-
assert_equal ["A", "B", "C"], @runs.sort
|
239
|
-
end
|
240
|
-
|
241
|
-
def test_second_rule_runs_when_first_rule_doesnt
|
242
|
-
create_timed_files(OBJFILE, SRCFILE)
|
243
|
-
delete_file(SRCFILE2)
|
244
|
-
rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
|
245
|
-
@runs << :RULE1
|
246
|
-
end
|
247
|
-
rule OBJFILE => [lambda{SRCFILE}] do
|
248
|
-
@runs << :RULE2
|
249
|
-
end
|
250
|
-
Task[OBJFILE].invoke
|
251
|
-
assert_equal [:RULE2], @runs
|
252
|
-
end
|
253
|
-
|
254
|
-
def test_second_rule_doest_run_if_first_triggers
|
255
|
-
create_timed_files(OBJFILE, SRCFILE, SRCFILE2)
|
256
|
-
rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
|
257
|
-
@runs << :RULE1
|
258
|
-
end
|
259
|
-
rule OBJFILE => [lambda{SRCFILE}] do
|
260
|
-
@runs << :RULE2
|
261
|
-
end
|
262
|
-
Task[OBJFILE].invoke
|
263
|
-
assert_equal [:RULE1], @runs
|
264
|
-
end
|
265
|
-
|
266
|
-
def test_second_rule_doest_run_if_first_triggers_with_reversed_rules
|
267
|
-
create_timed_files(OBJFILE, SRCFILE, SRCFILE2)
|
268
|
-
rule OBJFILE => [lambda{SRCFILE}] do
|
269
|
-
@runs << :RULE1
|
270
|
-
end
|
271
|
-
rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
|
272
|
-
@runs << :RULE2
|
273
|
-
end
|
274
|
-
Task[OBJFILE].invoke
|
275
|
-
assert_equal [:RULE1], @runs
|
276
|
-
end
|
277
|
-
|
278
|
-
def test_rule_with_proc_dependent_will_trigger
|
279
|
-
mkdir_p("testdata/src/jw")
|
280
|
-
create_file("testdata/src/jw/X.java")
|
281
|
-
rule %r(classes/.*\.class) => [
|
282
|
-
proc { |fn| fn.pathmap("%{classes,testdata/src}d/%n.java") }
|
283
|
-
] do |task|
|
284
|
-
assert_equal task.name, 'classes/jw/X.class'
|
285
|
-
assert_equal task.source, 'testdata/src/jw/X.java'
|
286
|
-
@runs << :RULE
|
287
|
-
end
|
288
|
-
Task['classes/jw/X.class'].invoke
|
289
|
-
assert_equal [:RULE], @runs
|
290
|
-
ensure
|
291
|
-
rm_r("testdata/src", :verbose=>false) rescue nil
|
292
|
-
end
|
293
|
-
|
294
|
-
def test_proc_returning_lists_are_flattened_into_prereqs
|
295
|
-
ran = false
|
296
|
-
mkdir_p("testdata/flatten")
|
297
|
-
create_file("testdata/flatten/a.txt")
|
298
|
-
task 'testdata/flatten/b.data' do |t|
|
299
|
-
ran = true
|
300
|
-
touch t.name, :verbose => false
|
301
|
-
end
|
302
|
-
rule '.html' =>
|
303
|
-
proc { |fn|
|
304
|
-
[
|
305
|
-
fn.ext("txt"),
|
306
|
-
"testdata/flatten/b.data"
|
307
|
-
]
|
308
|
-
} do |task|
|
309
|
-
end
|
310
|
-
Task['testdata/flatten/a.html'].invoke
|
311
|
-
assert ran, "Should have triggered flattened dependency"
|
312
|
-
ensure
|
313
|
-
rm_r("testdata/flatten", :verbose=>false) rescue nil
|
314
|
-
end
|
315
|
-
|
316
|
-
def test_recursive_rules_will_work_as_long_as_they_terminate
|
317
|
-
actions = []
|
318
|
-
create_file("testdata/abc.xml")
|
319
|
-
rule '.y' => '.xml' do actions << 'y' end
|
320
|
-
rule '.c' => '.y' do actions << 'c'end
|
321
|
-
rule '.o' => '.c' do actions << 'o'end
|
322
|
-
rule '.exe' => '.o' do actions << 'exe'end
|
323
|
-
Task["testdata/abc.exe"].invoke
|
324
|
-
assert_equal ['y', 'c', 'o', 'exe'], actions
|
325
|
-
end
|
326
|
-
|
327
|
-
def test_recursive_rules_that_dont_terminate_will_overflow
|
328
|
-
create_file("testdata/a.a")
|
329
|
-
prev = 'a'
|
330
|
-
('b'..'z').each do |letter|
|
331
|
-
rule ".#{letter}" => ".#{prev}" do |t| puts "#{t.name}" end
|
332
|
-
prev = letter
|
333
|
-
end
|
334
|
-
ex = assert_raises(Rake::RuleRecursionOverflowError) {
|
335
|
-
Task["testdata/a.z"].invoke
|
336
|
-
}
|
337
|
-
assert_match(/a\.z => testdata\/a.y/, ex.message)
|
338
|
-
end
|
339
|
-
|
340
|
-
def test_rules_with_bad_dependents_will_fail
|
341
|
-
rule "a" => [ 1 ] do |t| puts t.name end
|
342
|
-
assert_raises(RuntimeError) do Task['a'].invoke end
|
343
|
-
end
|
344
|
-
|
345
|
-
end
|
346
|
-
|