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
data/test/in_environment.rb
DELETED
@@ -1,35 +0,0 @@
|
|
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=nil)
|
7
|
-
settings ||= {}
|
8
|
-
full_settings = {"RAKEOPT" => nil}.merge(settings)
|
9
|
-
original_settings = set_env(full_settings)
|
10
|
-
yield
|
11
|
-
ensure
|
12
|
-
set_env(original_settings) rescue nil
|
13
|
-
end
|
14
|
-
|
15
|
-
# Set the environment according to the settings hash.
|
16
|
-
def set_env(settings) # :nodoc:
|
17
|
-
result = {}
|
18
|
-
|
19
|
-
settings.each do |k, v|
|
20
|
-
result[k] = ENV[k]
|
21
|
-
|
22
|
-
if k == 'PWD'
|
23
|
-
result[k] = Dir.pwd
|
24
|
-
Dir.chdir(v)
|
25
|
-
elsif v.nil?
|
26
|
-
ENV.delete(k)
|
27
|
-
else
|
28
|
-
ENV[k] = v
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
result
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
data/test/reqfile.rb
DELETED
data/test/reqfile2.rb
DELETED
data/test/shellcommand.rb
DELETED
data/test/test_rake.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
require File.expand_path('../helper', __FILE__)
|
2
|
-
|
3
|
-
class TestRake < Rake::TestCase
|
4
|
-
def test_each_dir_parent
|
5
|
-
assert_equal ['a'], alldirs('a')
|
6
|
-
assert_equal ['a/b', 'a'], alldirs('a/b')
|
7
|
-
assert_equal ['/a/b', '/a', '/'], alldirs('/a/b')
|
8
|
-
if File.dirname("c:/foo") == "c:"
|
9
|
-
# Under Unix
|
10
|
-
assert_equal ['c:/a/b', 'c:/a', 'c:'], alldirs('c:/a/b')
|
11
|
-
assert_equal ['c:a/b', 'c:a'], alldirs('c:a/b')
|
12
|
-
else
|
13
|
-
# Under Windows
|
14
|
-
assert_equal ['c:/a/b', 'c:/a', 'c:/'], alldirs('c:/a/b')
|
15
|
-
assert_equal ['c:a/b', 'c:a'], alldirs('c:a/b')
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def alldirs(fn)
|
20
|
-
result = []
|
21
|
-
Rake.each_dir_parent(fn) { |d| result << d }
|
22
|
-
result
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_can_override_application
|
26
|
-
old_app = Rake.application
|
27
|
-
fake_app = Object.new
|
28
|
-
Rake.application = fake_app
|
29
|
-
assert_equal fake_app, Rake.application
|
30
|
-
ensure
|
31
|
-
Rake.application = old_app
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_original_dir_reports_current_dir
|
35
|
-
assert_equal Dir.pwd, Rake.original_dir
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
@@ -1,364 +0,0 @@
|
|
1
|
-
require File.expand_path('../helper', __FILE__)
|
2
|
-
|
3
|
-
class TestRakeApplication < Rake::TestCase
|
4
|
-
include InEnvironment
|
5
|
-
|
6
|
-
def setup
|
7
|
-
super
|
8
|
-
|
9
|
-
@app = Rake::Application.new
|
10
|
-
@app.options.rakelib = []
|
11
|
-
Rake::TaskManager.record_task_metadata = true
|
12
|
-
end
|
13
|
-
|
14
|
-
def teardown
|
15
|
-
Rake::TaskManager.record_task_metadata = false
|
16
|
-
|
17
|
-
super
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_constant_warning
|
21
|
-
_, err = capture_io do @app.instance_eval { const_warning("Task") } end
|
22
|
-
assert_match(/warning/i, err)
|
23
|
-
assert_match(/deprecated/i, err)
|
24
|
-
assert_match(/Task/i, err)
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_display_tasks
|
28
|
-
@app.options.show_tasks = :tasks
|
29
|
-
@app.options.show_task_pattern = //
|
30
|
-
@app.last_description = "COMMENT"
|
31
|
-
@app.define_task(Rake::Task, "t")
|
32
|
-
out, = capture_io do @app.instance_eval { display_tasks_and_comments } end
|
33
|
-
assert_match(/^rake t/, out)
|
34
|
-
assert_match(/# COMMENT/, out)
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_display_tasks_with_long_comments
|
38
|
-
in_environment('RAKE_COLUMNS' => '80') do
|
39
|
-
@app.options.show_tasks = :tasks
|
40
|
-
@app.options.show_task_pattern = //
|
41
|
-
@app.last_description = "1234567890" * 8
|
42
|
-
@app.define_task(Rake::Task, "t")
|
43
|
-
out, = capture_io do @app.instance_eval { display_tasks_and_comments } end
|
44
|
-
assert_match(/^rake t/, out)
|
45
|
-
assert_match(/# 12345678901234567890123456789012345678901234567890123456789012345\.\.\./, out)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_display_tasks_with_task_name_wider_than_tty_display
|
50
|
-
in_environment('RAKE_COLUMNS' => '80') do
|
51
|
-
@app.options.show_tasks = :tasks
|
52
|
-
@app.options.show_task_pattern = //
|
53
|
-
task_name = "task name" * 80
|
54
|
-
@app.last_description = "something short"
|
55
|
-
@app.define_task(Rake::Task, task_name )
|
56
|
-
out, = capture_io do @app.instance_eval { display_tasks_and_comments } end
|
57
|
-
# Ensure the entire task name is output and we end up showing no description
|
58
|
-
assert_match(/rake #{task_name} # .../, out)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_display_tasks_with_very_long_task_name_to_a_non_tty_shows_name_and_comment
|
63
|
-
@app.options.show_tasks = :tasks
|
64
|
-
@app.options.show_task_pattern = //
|
65
|
-
@app.tty_output = false
|
66
|
-
description = "something short"
|
67
|
-
task_name = "task name" * 80
|
68
|
-
@app.last_description = "something short"
|
69
|
-
@app.define_task(Rake::Task, task_name )
|
70
|
-
out, = capture_io do @app.instance_eval { display_tasks_and_comments } end
|
71
|
-
# Ensure the entire task name is output and we end up showing no description
|
72
|
-
assert_match(/rake #{task_name} # #{description}/, out)
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_display_tasks_with_long_comments_to_a_non_tty_shows_entire_comment
|
76
|
-
@app.options.show_tasks = :tasks
|
77
|
-
@app.options.show_task_pattern = //
|
78
|
-
@app.tty_output = false
|
79
|
-
@app.last_description = "1234567890" * 8
|
80
|
-
@app.define_task(Rake::Task, "t")
|
81
|
-
out, = capture_io do @app.instance_eval { display_tasks_and_comments } end
|
82
|
-
assert_match(/^rake t/, out)
|
83
|
-
assert_match(/# #{@app.last_description}/, out)
|
84
|
-
end
|
85
|
-
|
86
|
-
def test_display_tasks_with_long_comments_to_a_non_tty_with_columns_set_truncates_comments
|
87
|
-
in_environment("RAKE_COLUMNS" => '80') do
|
88
|
-
@app.options.show_tasks = :tasks
|
89
|
-
@app.options.show_task_pattern = //
|
90
|
-
@app.tty_output = false
|
91
|
-
@app.last_description = "1234567890" * 8
|
92
|
-
@app.define_task(Rake::Task, "t")
|
93
|
-
out, = capture_io do @app.instance_eval { display_tasks_and_comments } end
|
94
|
-
assert_match(/^rake t/, out)
|
95
|
-
assert_match(/# 12345678901234567890123456789012345678901234567890123456789012345\.\.\./, out)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
def test_describe_tasks
|
100
|
-
@app.options.show_tasks = :describe
|
101
|
-
@app.options.show_task_pattern = //
|
102
|
-
@app.last_description = "COMMENT"
|
103
|
-
@app.define_task(Rake::Task, "t")
|
104
|
-
out, = capture_io do @app.instance_eval { display_tasks_and_comments } end
|
105
|
-
assert_match(/^rake t$/, out)
|
106
|
-
assert_match(/^ {4}COMMENT$/, out)
|
107
|
-
end
|
108
|
-
|
109
|
-
def test_show_lines
|
110
|
-
@app.options.show_tasks = :lines
|
111
|
-
@app.options.show_task_pattern = //
|
112
|
-
@app.last_description = "COMMENT"
|
113
|
-
@app.define_task(Rake::Task, "t")
|
114
|
-
@app['t'].locations << "HERE:1"
|
115
|
-
out, = capture_io do @app.instance_eval { display_tasks_and_comments } end
|
116
|
-
assert_match(/^rake t +[^:]+:\d+ *$/, out)
|
117
|
-
end
|
118
|
-
|
119
|
-
def test_finding_rakefile
|
120
|
-
assert_match(/Rakefile/i, @app.instance_eval { have_rakefile })
|
121
|
-
end
|
122
|
-
|
123
|
-
def test_not_finding_rakefile
|
124
|
-
@app.instance_eval { @rakefiles = ['NEVER_FOUND'] }
|
125
|
-
assert( ! @app.instance_eval do have_rakefile end )
|
126
|
-
assert_nil @app.rakefile
|
127
|
-
end
|
128
|
-
|
129
|
-
def test_load_rakefile
|
130
|
-
in_environment("PWD" => "test/data/unittest") do
|
131
|
-
@app.instance_eval do
|
132
|
-
handle_options
|
133
|
-
options.silent = true
|
134
|
-
load_rakefile
|
135
|
-
end
|
136
|
-
assert_equal "rakefile", @app.rakefile.downcase
|
137
|
-
assert_match(%r(unittest$), Dir.pwd)
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
def test_load_rakefile_doesnt_print_rakefile_directory_from_same_dir
|
142
|
-
in_environment("PWD" => "test/data/unittest") do
|
143
|
-
_, err = capture_io do
|
144
|
-
@app.instance_eval do
|
145
|
-
@original_dir = File.expand_path(".") # pretend we started from the unittest dir
|
146
|
-
raw_load_rakefile
|
147
|
-
end
|
148
|
-
end
|
149
|
-
_, location = @app.find_rakefile_location
|
150
|
-
refute_match(/\(in #{location}\)/, err)
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
def test_load_rakefile_from_subdir
|
155
|
-
in_environment("PWD" => "test/data/unittest/subdir") do
|
156
|
-
@app.instance_eval do
|
157
|
-
handle_options
|
158
|
-
options.silent = true
|
159
|
-
load_rakefile
|
160
|
-
end
|
161
|
-
assert_equal "rakefile", @app.rakefile.downcase
|
162
|
-
assert_match(%r(unittest$), Dir.pwd)
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
def test_load_rakefile_prints_rakefile_directory_from_subdir
|
167
|
-
in_environment("PWD" => "test/data/unittest/subdir") do
|
168
|
-
_, err = capture_io do
|
169
|
-
@app.instance_eval do
|
170
|
-
raw_load_rakefile
|
171
|
-
end
|
172
|
-
end
|
173
|
-
_, location = @app.find_rakefile_location
|
174
|
-
assert_match(/\(in #{location}\)/, err)
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
def test_load_rakefile_doesnt_print_rakefile_directory_from_subdir_if_silent
|
179
|
-
in_environment("PWD" => "test/data/unittest/subdir") do
|
180
|
-
_, err = capture_io do
|
181
|
-
@app.instance_eval do
|
182
|
-
handle_options
|
183
|
-
options.silent = true
|
184
|
-
raw_load_rakefile
|
185
|
-
end
|
186
|
-
end
|
187
|
-
_, location = @app.find_rakefile_location
|
188
|
-
refute_match(/\(in #{location}\)/, err)
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
def test_load_rakefile_not_found
|
193
|
-
in_environment("PWD" => "/", "RAKE_SYSTEM" => 'not_exist') do
|
194
|
-
@app.instance_eval do
|
195
|
-
handle_options
|
196
|
-
options.silent = true
|
197
|
-
end
|
198
|
-
ex = assert_raises(RuntimeError) do
|
199
|
-
@app.instance_eval do raw_load_rakefile end
|
200
|
-
end
|
201
|
-
assert_match(/no rakefile found/i, ex.message)
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
|
-
def test_load_from_system_rakefile
|
206
|
-
in_environment('RAKE_SYSTEM' => 'test/data/sys') do
|
207
|
-
@app.options.rakelib = []
|
208
|
-
@app.instance_eval do
|
209
|
-
handle_options
|
210
|
-
options.silent = true
|
211
|
-
options.load_system = true
|
212
|
-
options.rakelib = []
|
213
|
-
load_rakefile
|
214
|
-
end
|
215
|
-
assert_equal "test/data/sys", @app.system_dir
|
216
|
-
assert_nil @app.rakefile
|
217
|
-
end
|
218
|
-
end
|
219
|
-
|
220
|
-
def test_load_from_calculated_system_rakefile
|
221
|
-
flexmock(@app, :standard_system_dir => "__STD_SYS_DIR__")
|
222
|
-
in_environment('RAKE_SYSTEM' => nil) do
|
223
|
-
@app.options.rakelib = []
|
224
|
-
@app.instance_eval do
|
225
|
-
handle_options
|
226
|
-
options.silent = true
|
227
|
-
options.load_system = true
|
228
|
-
options.rakelib = []
|
229
|
-
load_rakefile
|
230
|
-
end
|
231
|
-
assert_equal "__STD_SYS_DIR__", @app.system_dir
|
232
|
-
end
|
233
|
-
end
|
234
|
-
|
235
|
-
def test_windows
|
236
|
-
assert ! (@app.windows? && @app.unix?)
|
237
|
-
end
|
238
|
-
|
239
|
-
def test_loading_imports
|
240
|
-
mock = flexmock("loader")
|
241
|
-
mock.should_receive(:load).with("x.dummy").once
|
242
|
-
@app.instance_eval do
|
243
|
-
add_loader("dummy", mock)
|
244
|
-
add_import("x.dummy")
|
245
|
-
load_imports
|
246
|
-
end
|
247
|
-
end
|
248
|
-
|
249
|
-
def test_building_imported_files_on_demand
|
250
|
-
mock = flexmock("loader")
|
251
|
-
mock.should_receive(:load).with("x.dummy").once
|
252
|
-
mock.should_receive(:make_dummy).with_no_args.once
|
253
|
-
@app.instance_eval do
|
254
|
-
intern(Rake::Task, "x.dummy").enhance do mock.make_dummy end
|
255
|
-
add_loader("dummy", mock)
|
256
|
-
add_import("x.dummy")
|
257
|
-
load_imports
|
258
|
-
end
|
259
|
-
end
|
260
|
-
|
261
|
-
def test_handle_options_should_strip_options_from_ARGV
|
262
|
-
assert !@app.options.trace
|
263
|
-
|
264
|
-
valid_option = '--trace'
|
265
|
-
ARGV.clear
|
266
|
-
ARGV << valid_option
|
267
|
-
|
268
|
-
@app.handle_options
|
269
|
-
|
270
|
-
assert !ARGV.include?(valid_option)
|
271
|
-
assert @app.options.trace
|
272
|
-
end
|
273
|
-
|
274
|
-
def test_good_run
|
275
|
-
ran = false
|
276
|
-
ARGV.clear
|
277
|
-
ARGV << '--rakelib=""'
|
278
|
-
@app.options.silent = true
|
279
|
-
@app.instance_eval do
|
280
|
-
intern(Rake::Task, "default").enhance { ran = true }
|
281
|
-
end
|
282
|
-
in_environment("PWD" => "test/data/default") do
|
283
|
-
@app.run
|
284
|
-
end
|
285
|
-
assert ran
|
286
|
-
end
|
287
|
-
|
288
|
-
def test_display_task_run
|
289
|
-
ran = false
|
290
|
-
ARGV.clear
|
291
|
-
ARGV << '-f' << '-s' << '--tasks' << '--rakelib=""'
|
292
|
-
@app.last_description = "COMMENT"
|
293
|
-
@app.define_task(Rake::Task, "default")
|
294
|
-
out, = capture_io { @app.run }
|
295
|
-
assert @app.options.show_tasks
|
296
|
-
assert ! ran
|
297
|
-
assert_match(/rake default/, out)
|
298
|
-
assert_match(/# COMMENT/, out)
|
299
|
-
end
|
300
|
-
|
301
|
-
def test_display_prereqs
|
302
|
-
ran = false
|
303
|
-
ARGV.clear
|
304
|
-
ARGV << '-f' << '-s' << '--prereqs' << '--rakelib=""'
|
305
|
-
@app.last_description = "COMMENT"
|
306
|
-
t = @app.define_task(Rake::Task, "default")
|
307
|
-
t.enhance([:a, :b])
|
308
|
-
@app.define_task(Rake::Task, "a")
|
309
|
-
@app.define_task(Rake::Task, "b")
|
310
|
-
out, = capture_io { @app.run }
|
311
|
-
assert @app.options.show_prereqs
|
312
|
-
assert ! ran
|
313
|
-
assert_match(/rake a$/, out)
|
314
|
-
assert_match(/rake b$/, out)
|
315
|
-
assert_match(/rake default\n( *(a|b)\n){2}/m, out)
|
316
|
-
end
|
317
|
-
|
318
|
-
def test_bad_run
|
319
|
-
@app.intern(Rake::Task, "default").enhance { fail }
|
320
|
-
ARGV.clear
|
321
|
-
ARGV << '-f' << '-s' << '--rakelib=""'
|
322
|
-
assert_raises(SystemExit) {
|
323
|
-
_, err = capture_io { @app.run }
|
324
|
-
assert_match(/see full trace/, err)
|
325
|
-
}
|
326
|
-
ensure
|
327
|
-
ARGV.clear
|
328
|
-
end
|
329
|
-
|
330
|
-
def test_bad_run_with_trace
|
331
|
-
@app.intern(Rake::Task, "default").enhance { fail }
|
332
|
-
ARGV.clear
|
333
|
-
ARGV << '-f' << '-s' << '-t'
|
334
|
-
assert_raises(SystemExit) {
|
335
|
-
_, err = capture_io { @app.run }
|
336
|
-
refute_match(/see full trace/, err)
|
337
|
-
}
|
338
|
-
ensure
|
339
|
-
ARGV.clear
|
340
|
-
end
|
341
|
-
|
342
|
-
def test_run_with_bad_options
|
343
|
-
@app.intern(Rake::Task, "default").enhance { fail }
|
344
|
-
ARGV.clear
|
345
|
-
ARGV << '-f' << '-s' << '--xyzzy'
|
346
|
-
assert_raises(SystemExit) {
|
347
|
-
capture_io { @app.run }
|
348
|
-
}
|
349
|
-
ensure
|
350
|
-
ARGV.clear
|
351
|
-
end
|
352
|
-
|
353
|
-
def test_deprecation_message
|
354
|
-
in_environment do
|
355
|
-
_, err = capture_io do
|
356
|
-
@app.deprecate("a", "b", "c")
|
357
|
-
end
|
358
|
-
assert_match(/'a' is deprecated/i, err)
|
359
|
-
assert_match(/use 'b' instead/i, err)
|
360
|
-
assert_match(/at c$/i, err)
|
361
|
-
end
|
362
|
-
end
|
363
|
-
end
|
364
|
-
|