rake 0.9.2.2 → 13.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +7 -0
  2. data/History.rdoc +2403 -0
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +64 -106
  5. data/doc/command_line_usage.rdoc +65 -21
  6. data/doc/glossary.rdoc +40 -49
  7. data/doc/jamis.rb +1 -0
  8. data/doc/rake.1 +156 -0
  9. data/doc/rakefile.rdoc +127 -62
  10. data/{bin → exe}/rake +1 -7
  11. data/lib/rake/application.rb +507 -271
  12. data/lib/rake/backtrace.rb +24 -0
  13. data/lib/rake/clean.rb +54 -8
  14. data/lib/rake/cloneable.rb +11 -19
  15. data/lib/rake/cpu_counter.rb +107 -0
  16. data/lib/rake/default_loader.rb +5 -0
  17. data/lib/rake/dsl_definition.rb +67 -48
  18. data/lib/rake/early_time.rb +5 -1
  19. data/lib/rake/ext/core.rb +5 -6
  20. data/lib/rake/ext/string.rb +61 -52
  21. data/lib/rake/file_creation_task.rb +4 -3
  22. data/lib/rake/file_list.rb +81 -49
  23. data/lib/rake/file_task.rb +15 -8
  24. data/lib/rake/file_utils.rb +63 -43
  25. data/lib/rake/file_utils_ext.rb +14 -25
  26. data/lib/rake/invocation_chain.rb +25 -19
  27. data/lib/rake/invocation_exception_mixin.rb +1 -0
  28. data/lib/rake/late_time.rb +18 -0
  29. data/lib/rake/linked_list.rb +112 -0
  30. data/lib/rake/loaders/makefile.rb +23 -9
  31. data/lib/rake/multi_task.rb +4 -6
  32. data/lib/rake/name_space.rb +36 -23
  33. data/lib/rake/packagetask.rb +71 -34
  34. data/lib/rake/phony.rb +16 -0
  35. data/lib/rake/private_reader.rb +21 -0
  36. data/lib/rake/promise.rb +100 -0
  37. data/lib/rake/pseudo_status.rb +8 -2
  38. data/lib/rake/rake_module.rb +41 -3
  39. data/lib/rake/rake_test_loader.rb +9 -4
  40. data/lib/rake/rule_recursion_overflow_error.rb +2 -2
  41. data/lib/rake/scope.rb +43 -0
  42. data/lib/rake/task.rb +186 -79
  43. data/lib/rake/task_argument_error.rb +1 -0
  44. data/lib/rake/task_arguments.rb +46 -15
  45. data/lib/rake/task_manager.rb +91 -67
  46. data/lib/rake/tasklib.rb +2 -12
  47. data/lib/rake/testtask.rb +61 -63
  48. data/lib/rake/thread_history_display.rb +49 -0
  49. data/lib/rake/thread_pool.rb +163 -0
  50. data/lib/rake/trace_output.rb +23 -0
  51. data/lib/rake/version.rb +5 -3
  52. data/lib/rake/win32.rb +14 -18
  53. data/lib/rake.rb +35 -33
  54. data/rake.gemspec +100 -0
  55. metadata +74 -176
  56. data/.gemtest +0 -0
  57. data/CHANGES +0 -522
  58. data/Rakefile +0 -369
  59. data/TODO +0 -20
  60. data/doc/rake.1.gz +0 -0
  61. data/doc/release_notes/rake-0.4.14.rdoc +0 -23
  62. data/doc/release_notes/rake-0.4.15.rdoc +0 -35
  63. data/doc/release_notes/rake-0.5.0.rdoc +0 -53
  64. data/doc/release_notes/rake-0.5.3.rdoc +0 -78
  65. data/doc/release_notes/rake-0.5.4.rdoc +0 -46
  66. data/doc/release_notes/rake-0.6.0.rdoc +0 -141
  67. data/doc/release_notes/rake-0.7.0.rdoc +0 -119
  68. data/doc/release_notes/rake-0.7.1.rdoc +0 -59
  69. data/doc/release_notes/rake-0.7.2.rdoc +0 -121
  70. data/doc/release_notes/rake-0.7.3.rdoc +0 -47
  71. data/doc/release_notes/rake-0.8.0.rdoc +0 -114
  72. data/doc/release_notes/rake-0.8.2.rdoc +0 -165
  73. data/doc/release_notes/rake-0.8.3.rdoc +0 -112
  74. data/doc/release_notes/rake-0.8.4.rdoc +0 -147
  75. data/doc/release_notes/rake-0.8.5.rdoc +0 -53
  76. data/doc/release_notes/rake-0.8.6.rdoc +0 -55
  77. data/doc/release_notes/rake-0.8.7.rdoc +0 -55
  78. data/doc/release_notes/rake-0.9.0.rdoc +0 -112
  79. data/doc/release_notes/rake-0.9.1.rdoc +0 -52
  80. data/doc/release_notes/rake-0.9.2.rdoc +0 -49
  81. data/install.rb +0 -90
  82. data/lib/rake/alt_system.rb +0 -109
  83. data/lib/rake/classic_namespace.rb +0 -11
  84. data/lib/rake/contrib/compositepublisher.rb +0 -21
  85. data/lib/rake/contrib/ftptools.rb +0 -150
  86. data/lib/rake/contrib/publisher.rb +0 -73
  87. data/lib/rake/contrib/rubyforgepublisher.rb +0 -16
  88. data/lib/rake/contrib/sshpublisher.rb +0 -50
  89. data/lib/rake/contrib/sys.rb +0 -191
  90. data/lib/rake/ext/module.rb +0 -39
  91. data/lib/rake/ext/time.rb +0 -14
  92. data/lib/rake/gempackagetask.rb +0 -15
  93. data/lib/rake/pathmap.rb +0 -1
  94. data/lib/rake/rdoctask.rb +0 -234
  95. data/lib/rake/ruby182_test_unit_fix.rb +0 -25
  96. data/lib/rake/runtest.rb +0 -21
  97. data/test/file_creation.rb +0 -34
  98. data/test/helper.rb +0 -492
  99. data/test/test_rake.rb +0 -40
  100. data/test/test_rake_application.rb +0 -489
  101. data/test/test_rake_application_options.rb +0 -335
  102. data/test/test_rake_clean.rb +0 -14
  103. data/test/test_rake_definitions.rb +0 -80
  104. data/test/test_rake_directory_task.rb +0 -46
  105. data/test/test_rake_dsl.rb +0 -77
  106. data/test/test_rake_early_time.rb +0 -31
  107. data/test/test_rake_extension.rb +0 -59
  108. data/test/test_rake_file_creation_task.rb +0 -56
  109. data/test/test_rake_file_list.rb +0 -628
  110. data/test/test_rake_file_list_path_map.rb +0 -8
  111. data/test/test_rake_file_task.rb +0 -102
  112. data/test/test_rake_file_utils.rb +0 -305
  113. data/test/test_rake_ftp_file.rb +0 -59
  114. data/test/test_rake_functional.rb +0 -450
  115. data/test/test_rake_invocation_chain.rb +0 -52
  116. data/test/test_rake_makefile_loader.rb +0 -44
  117. data/test/test_rake_multi_task.rb +0 -51
  118. data/test/test_rake_name_space.rb +0 -43
  119. data/test/test_rake_package_task.rb +0 -79
  120. data/test/test_rake_path_map.rb +0 -157
  121. data/test/test_rake_path_map_explode.rb +0 -34
  122. data/test/test_rake_path_map_partial.rb +0 -18
  123. data/test/test_rake_pseudo_status.rb +0 -21
  124. data/test/test_rake_rake_test_loader.rb +0 -21
  125. data/test/test_rake_rdoc_task.rb +0 -83
  126. data/test/test_rake_require.rb +0 -40
  127. data/test/test_rake_rules.rb +0 -327
  128. data/test/test_rake_task.rb +0 -267
  129. data/test/test_rake_task_argument_parsing.rb +0 -103
  130. data/test/test_rake_task_arguments.rb +0 -88
  131. data/test/test_rake_task_lib.rb +0 -9
  132. data/test/test_rake_task_manager.rb +0 -157
  133. data/test/test_rake_task_manager_argument_resolution.rb +0 -36
  134. data/test/test_rake_task_with_arguments.rb +0 -173
  135. data/test/test_rake_test_task.rb +0 -120
  136. data/test/test_rake_top_level_functions.rb +0 -111
  137. data/test/test_rake_win32.rb +0 -72
  138. data/test/test_sys.rb +0 -20
@@ -1,102 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
- require 'fileutils'
3
-
4
- class TestRakeFileTask < Rake::TestCase
5
- include Rake
6
-
7
- def setup
8
- super
9
-
10
- Task.clear
11
- @runs = Array.new
12
- FileUtils.rm_f NEWFILE
13
- FileUtils.rm_f OLDFILE
14
- end
15
-
16
- def test_file_need
17
- name = "dummy"
18
- file name
19
-
20
- ftask = Task[name]
21
-
22
- assert_equal name.to_s, ftask.name
23
- File.delete(ftask.name) rescue nil
24
-
25
- assert ftask.needed?, "file should be needed"
26
-
27
- open(ftask.name, "w") { |f| f.puts "HI" }
28
-
29
- assert_equal nil, ftask.prerequisites.collect{|n| Task[n].timestamp}.max
30
- assert ! ftask.needed?, "file should not be needed"
31
- ensure
32
- File.delete(ftask.name) rescue nil
33
- end
34
-
35
- def test_file_times_new_depends_on_old
36
- create_timed_files(OLDFILE, NEWFILE)
37
-
38
- t1 = Rake.application.intern(FileTask, NEWFILE).enhance([OLDFILE])
39
- t2 = Rake.application.intern(FileTask, OLDFILE)
40
- assert ! t2.needed?, "Should not need to build old file"
41
- assert ! t1.needed?, "Should not need to rebuild new file because of old"
42
- end
43
-
44
- def test_file_times_old_depends_on_new
45
- create_timed_files(OLDFILE, NEWFILE)
46
-
47
- t1 = Rake.application.intern(FileTask,OLDFILE).enhance([NEWFILE])
48
- t2 = Rake.application.intern(FileTask, NEWFILE)
49
- assert ! t2.needed?, "Should not need to build new file"
50
- preq_stamp = t1.prerequisites.collect{|t| Task[t].timestamp}.max
51
- assert_equal t2.timestamp, preq_stamp
52
- assert t1.timestamp < preq_stamp, "T1 should be older"
53
- assert t1.needed?, "Should need to rebuild old file because of new"
54
- end
55
-
56
- def test_file_depends_on_task_depend_on_file
57
- create_timed_files(OLDFILE, NEWFILE)
58
-
59
- file NEWFILE => [:obj] do |t| @runs << t.name end
60
- task :obj => [OLDFILE] do |t| @runs << t.name end
61
- file OLDFILE do |t| @runs << t.name end
62
-
63
- Task[:obj].invoke
64
- Task[NEWFILE].invoke
65
- assert ! @runs.include?(NEWFILE)
66
- end
67
-
68
- def test_existing_file_depends_on_non_existing_file
69
- @ran = false
70
-
71
- create_file(OLDFILE)
72
- delete_file(NEWFILE)
73
- file NEWFILE do
74
- @ran = true
75
- end
76
-
77
- file OLDFILE => NEWFILE
78
-
79
- Task[OLDFILE].invoke
80
-
81
- assert @ran
82
- end
83
-
84
- # I have currently disabled this test. I'm not convinced that
85
- # deleting the file target on failure is always the proper thing to
86
- # do. I'm willing to hear input on this topic.
87
- def ztest_file_deletes_on_failure
88
- task :obj
89
- file NEWFILE => [:obj] do |t|
90
- FileUtils.touch NEWFILE
91
- fail "Ooops"
92
- end
93
- assert Task[NEWFILE]
94
- begin
95
- Task[NEWFILE].invoke
96
- rescue Exception
97
- end
98
- assert( ! File.exist?(NEWFILE), "NEWFILE should be deleted")
99
- end
100
-
101
- end
102
-
@@ -1,305 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
- require 'fileutils'
3
- require 'stringio'
4
-
5
- class TestRakeFileUtils < Rake::TestCase
6
-
7
- def teardown
8
- FileUtils::LN_SUPPORTED[0] = true
9
- RakeFileUtils.verbose_flag = Rake::FileUtilsExt::DEFAULT
10
-
11
- super
12
- end
13
-
14
- def test_rm_one_file
15
- create_file("a")
16
- FileUtils.rm_rf "a"
17
- refute File.exist?("a")
18
- end
19
-
20
- def test_rm_two_files
21
- create_file("a")
22
- create_file("b")
23
- FileUtils.rm_rf ["a", "b"]
24
- refute File.exist?("a")
25
- refute File.exist?("b")
26
- end
27
-
28
- def test_rm_filelist
29
- list = Rake::FileList.new << "a" << "b"
30
- list.each { |fn| create_file(fn) }
31
- FileUtils.rm_r list
32
- refute File.exist?("a")
33
- refute File.exist?("b")
34
- end
35
-
36
- def test_ln
37
- open("a", "w") { |f| f.puts "TEST_LN" }
38
-
39
- Rake::FileUtilsExt.safe_ln("a", "b", :verbose => false)
40
-
41
- assert_equal "TEST_LN\n", File.read('b')
42
- end
43
-
44
- class BadLink
45
- include Rake::FileUtilsExt
46
- attr_reader :cp_args
47
- def initialize(klass)
48
- @failure_class = klass
49
- end
50
- def cp(*args)
51
- @cp_args = args
52
- end
53
- def ln(*args)
54
- fail @failure_class, "ln not supported"
55
- end
56
- public :safe_ln
57
- end
58
-
59
- def test_safe_ln_failover_to_cp_on_standard_error
60
- FileUtils::LN_SUPPORTED[0] = true
61
- c = BadLink.new(StandardError)
62
- c.safe_ln "a", "b"
63
- assert_equal ['a', 'b'], c.cp_args
64
- c.safe_ln "x", "y"
65
- assert_equal ['x', 'y'], c.cp_args
66
- end
67
-
68
- def test_safe_ln_failover_to_cp_on_not_implemented_error
69
- FileUtils::LN_SUPPORTED[0] = true
70
- c = BadLink.new(NotImplementedError)
71
- c.safe_ln "a", "b"
72
- assert_equal ['a', 'b'], c.cp_args
73
- end
74
-
75
- def test_safe_ln_fails_on_script_error
76
- FileUtils::LN_SUPPORTED[0] = true
77
- c = BadLink.new(ScriptError)
78
- assert_raises(ScriptError) do c.safe_ln "a", "b" end
79
- end
80
-
81
- def test_verbose
82
- verbose true
83
- assert_equal true, verbose
84
- verbose false
85
- assert_equal false, verbose
86
- verbose(true) {
87
- assert_equal true, verbose
88
- }
89
- assert_equal false, verbose
90
- end
91
-
92
- def test_nowrite
93
- nowrite true
94
- assert_equal true, nowrite
95
- nowrite false
96
- assert_equal false, nowrite
97
- nowrite(true){
98
- assert_equal true, nowrite
99
- }
100
- assert_equal false, nowrite
101
- end
102
-
103
- def test_file_utils_methods_are_available_at_top_level
104
- create_file("a")
105
-
106
- capture_io do
107
- rm_rf "a"
108
- end
109
-
110
- refute File.exist?("a")
111
- end
112
-
113
- def test_fileutils_methods_dont_leak
114
- obj = Object.new
115
- assert_raises(NoMethodError) { obj.copy } # from FileUtils
116
- assert_raises(NoMethodError) { obj.ruby "-v" } # from RubyFileUtils
117
- end
118
-
119
- def test_sh
120
- shellcommand
121
-
122
- verbose(false) { sh %{#{Rake::TestCase::RUBY} shellcommand.rb} }
123
- assert true, "should not fail"
124
- end
125
-
126
- def test_sh_with_a_single_string_argument
127
- check_expansion
128
-
129
- ENV['RAKE_TEST_SH'] = 'someval'
130
- verbose(false) {
131
- sh %{#{RUBY} check_expansion.rb #{env_var} someval}
132
- }
133
- end
134
-
135
- def test_sh_with_multiple_arguments
136
- check_no_expansion
137
- ENV['RAKE_TEST_SH'] = 'someval'
138
-
139
- verbose(false) {
140
- sh RUBY, 'check_no_expansion.rb', env_var, 'someval'
141
- }
142
- end
143
-
144
- def test_sh_failure
145
- shellcommand
146
-
147
- assert_raises(RuntimeError) {
148
- verbose(false) { sh %{#{RUBY} shellcommand.rb 1} }
149
- }
150
- end
151
-
152
- def test_sh_special_handling
153
- shellcommand
154
-
155
- count = 0
156
- verbose(false) {
157
- sh(%{#{RUBY} shellcommand.rb}) do |ok, res|
158
- assert(ok)
159
- assert_equal 0, res.exitstatus
160
- count += 1
161
- end
162
- sh(%{#{RUBY} shellcommand.rb 1}) do |ok, res|
163
- assert(!ok)
164
- assert_equal 1, res.exitstatus
165
- count += 1
166
- end
167
- }
168
- assert_equal 2, count, "Block count should be 2"
169
- end
170
-
171
- def test_sh_noop
172
- shellcommand
173
-
174
- verbose(false) { sh %{shellcommand.rb 1}, :noop=>true }
175
- assert true, "should not fail"
176
- end
177
-
178
- def test_sh_bad_option
179
- shellcommand
180
-
181
- ex = assert_raises(ArgumentError) {
182
- verbose(false) { sh %{shellcommand.rb}, :bad_option=>true }
183
- }
184
- assert_match(/bad_option/, ex.message)
185
- end
186
-
187
- def test_sh_verbose
188
- shellcommand
189
-
190
- _, err = capture_io do
191
- verbose(true) {
192
- sh %{shellcommand.rb}, :noop=>true
193
- }
194
- end
195
-
196
- assert_equal "shellcommand.rb\n", err
197
- end
198
-
199
- def test_sh_verbose_false
200
- shellcommand
201
-
202
- _, err = capture_io do
203
- verbose(false) {
204
- sh %{shellcommand.rb}, :noop=>true
205
- }
206
- end
207
-
208
- assert_equal '', err
209
- end
210
-
211
- def test_sh_verbose_flag_nil
212
- shellcommand
213
-
214
- RakeFileUtils.verbose_flag = nil
215
-
216
- assert_silent do
217
- sh %{shellcommand.rb}, :noop=>true
218
- end
219
- end
220
-
221
- def test_ruby_with_a_single_string_argument
222
- check_expansion
223
-
224
- ENV['RAKE_TEST_SH'] = 'someval'
225
-
226
- verbose(false) {
227
- replace_ruby {
228
- ruby %{check_expansion.rb #{env_var} someval}
229
- }
230
- }
231
- end
232
-
233
- def test_ruby_with_multiple_arguments
234
- check_no_expansion
235
-
236
- ENV['RAKE_TEST_SH'] = 'someval'
237
- verbose(false) {
238
- replace_ruby {
239
- ruby 'check_no_expansion.rb', env_var, 'someval'
240
- }
241
- }
242
- end
243
-
244
- def test_split_all
245
- assert_equal ['a'], Rake::FileUtilsExt.split_all('a')
246
- assert_equal ['..'], Rake::FileUtilsExt.split_all('..')
247
- assert_equal ['/'], Rake::FileUtilsExt.split_all('/')
248
- assert_equal ['a', 'b'], Rake::FileUtilsExt.split_all('a/b')
249
- assert_equal ['/', 'a', 'b'], Rake::FileUtilsExt.split_all('/a/b')
250
- assert_equal ['..', 'a', 'b'], Rake::FileUtilsExt.split_all('../a/b')
251
- end
252
-
253
- def command name, text
254
- open name, 'w', 0750 do |io|
255
- io << text
256
- end
257
- end
258
-
259
- def check_no_expansion
260
- command 'check_no_expansion.rb', <<-CHECK_EXPANSION
261
- if ARGV[0] != ARGV[1]
262
- exit 0
263
- else
264
- exit 1
265
- end
266
- CHECK_EXPANSION
267
- end
268
-
269
- def check_expansion
270
- command 'check_expansion.rb', <<-CHECK_EXPANSION
271
- if ARGV[0] != ARGV[1]
272
- exit 1
273
- else
274
- exit 0
275
- end
276
- CHECK_EXPANSION
277
- end
278
-
279
- def replace_ruby
280
- ruby = FileUtils::RUBY
281
- FileUtils.send :remove_const, :RUBY
282
- FileUtils.const_set :RUBY, RUBY
283
- yield
284
- ensure
285
- FileUtils.send :remove_const, :RUBY
286
- FileUtils.const_set:RUBY, ruby
287
- end
288
-
289
- def shellcommand
290
- command 'shellcommand.rb', <<-SHELLCOMMAND
291
- #!/usr/bin/env ruby
292
-
293
- exit((ARGV[0] || "0").to_i)
294
- SHELLCOMMAND
295
- end
296
-
297
- def env_var
298
- windows? ? '%RAKE_TEST_SH%' : '$RAKE_TEST_SH'
299
- end
300
-
301
- def windows?
302
- ! File::ALT_SEPARATOR.nil?
303
- end
304
-
305
- end
@@ -1,59 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
- require 'date'
3
- require 'time'
4
- require 'rake/contrib/ftptools'
5
-
6
- class FakeDate
7
- def self.today
8
- Date.new(2003,10,3)
9
- end
10
- def self.now
11
- Time.local(2003,10,3,12,00,00)
12
- end
13
- end
14
-
15
- class TestRakeFtpFile < Rake::TestCase
16
-
17
- def setup
18
- super
19
-
20
- Rake::FtpFile.class_eval { @date_class = FakeDate; @time_class = FakeDate }
21
- end
22
-
23
- def test_general
24
- file = Rake::FtpFile.new("here", "-rw-r--r-- 1 a279376 develop 121770 Mar 6 14:50 wiki.pl")
25
- assert_equal "wiki.pl", file.name
26
- assert_equal "here/wiki.pl", file.path
27
- assert_equal "a279376", file.owner
28
- assert_equal "develop", file.group
29
- assert_equal 0644, file.mode
30
- assert_equal 121770, file.size
31
- assert_equal Time.mktime(2003,3,6,14,50,0,0), file.time
32
- assert ! file.directory?
33
- assert ! file.symlink?
34
- end
35
-
36
- def test_far_date
37
- file = Rake::FtpFile.new(".", "drwxr-xr-x 3 a279376 develop 4096 Nov 26 2001 vss")
38
- assert_equal Time.mktime(2001,11,26,0,0,0,0), file.time
39
- end
40
-
41
- def test_close_date
42
- file = Rake::FtpFile.new(".", "drwxr-xr-x 3 a279376 develop 4096 Nov 26 15:35 vss")
43
- assert_equal Time.mktime(2002,11,26,15,35,0,0), file.time
44
- end
45
-
46
- def test_directory
47
- file = Rake::FtpFile.new(".", "drwxrwxr-x 9 a279376 develop 4096 Mar 13 14:32 working")
48
- assert file.directory?
49
- assert !file.symlink?
50
- end
51
-
52
- def test_symlink
53
- file = Rake::FtpFile.new(".", "lrwxrwxrwx 1 a279376 develop 64 Mar 26 2002 xtrac -> /home/a279376/working/ics/development/java/com/fmr/fwp/ics/xtrac")
54
- assert_equal 'xtrac', file.name
55
- assert file.symlink?
56
- assert !file.directory?
57
- end
58
- end
59
-