rake 0.4.15 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rake might be problematic. Click here for more details.

data/CHANGES CHANGED
@@ -1,5 +1,25 @@
1
1
  = Rake Changelog
2
2
 
3
+ == Version 0.5.0
4
+
5
+ * Fixed documentation that was lacking the Rake module name (Tilman
6
+ Sauerbeck).
7
+ * Added tar.gz and tar.bz2 support to package task (Tilman Sauerbeck).
8
+ * Recursive rules are now supported (Tilman Sauerbeck).
9
+ * Added warning option for the Test Task (requested by Eric Hodel).
10
+ * The jamis rdoc template is only used if it exists.
11
+ * Added fix for Ruby 1.8.2 test/unit and rails problem.
12
+ * Added contributed rake man file (Jani Monoses).
13
+ * Added Brian Chandler's fix for problems in --trace and --dry-run
14
+ mode.
15
+
16
+ == Version 0.4.15
17
+
18
+ * Fixed a bug that prevented the TESTOPTS flag from working with the
19
+ revised for 1.8.2 test task.
20
+ * Updated the docs on --trace to indicate that it also enables a full
21
+ backtrace on errors.
22
+
3
23
  == Version 0.4.14
4
24
 
5
25
  * Modified the TestTask to workaround the Ruby 1.8.2 change in
data/README CHANGED
@@ -100,6 +100,8 @@ other projects with similar (and not so similar) goals.
100
100
 
101
101
  [<b>nobu.nokada@softhome.net</b>] For the initial patch for rule support.
102
102
 
103
+ [<b>Tilman Sauerbeck <tilman@code-monkey.de></b>] For the recursive rule patch.
104
+
103
105
  == License
104
106
 
105
107
  Rake is available under an MIT-style license.
data/Rakefile CHANGED
@@ -17,16 +17,29 @@ require 'rake/testtask'
17
17
  require 'rake/rdoctask'
18
18
 
19
19
  CLEAN.include('**/*.o')
20
- CLOBBER.include('doc/example/main')
20
+ CLOBBER.include('doc/example/main', 'testdata')
21
+ CLOBBER.include('test/data/**/temp_*')
22
+
23
+
24
+ def announce(msg='')
25
+ STDERR.puts msg
26
+ end
21
27
 
22
28
  # Determine the current version of the software
23
29
 
24
30
  if `ruby -Ilib ./bin/rake --version` =~ /\S+$/
25
- PKG_VERSION = $&
31
+ CURRENT_VERSION = $&
32
+ else
33
+ CURRENT_VERSION = "0.0.0"
34
+ end
35
+
36
+ if ENV['REL']
37
+ PKG_VERSION = ENV['REL']
26
38
  else
27
- PKG_VERSION = "0.0.0"
39
+ PKG_VERSION = CURRENT_VERSION
28
40
  end
29
41
 
42
+
30
43
  SRC_RB = FileList['lib/**/*.rb']
31
44
 
32
45
  # The default task is run if rake is given no explicit arguments.
@@ -42,22 +55,25 @@ Rake::TestTask.new(:testall) do |t|
42
55
  'test/contrib/test*.rb',
43
56
  'test/fun*.rb'
44
57
  ]
58
+ t.warning = true if t.respond_to? :warning
45
59
  t.verbose = true
46
60
  end
47
61
 
48
62
  Rake::TestTask.new(:test) do |t|
49
63
  t.test_files = FileList['test/test*.rb']
64
+ t.warning = true if t.respond_to? :warning
50
65
  t.verbose = true
51
66
  end
52
67
 
53
68
  Rake::TestTask.new(:testfun) do |t|
54
69
  t.pattern = 'test/fun*.rb'
55
- t.verbose = true
70
+ t.warning = true if t.respond_to? :warning
56
71
  end
57
72
 
58
73
  Rake::TestTask.new(:testcontrib) do |t|
59
74
  t.pattern = 'test/contrib/test*.rb'
60
75
  t.verbose = true
76
+ t.warning = true if t.respond_to? :warning
61
77
  end
62
78
 
63
79
  directory 'testdata'
@@ -72,14 +88,6 @@ task :tc => [:testcontrib]
72
88
 
73
89
  # CVS Tasks ----------------------------------------------------------
74
90
 
75
- desc "Tag all the CVS files with the latest release number (TAG=x)"
76
- task :tag do
77
- rel = "REL_" + PKG_VERSION.gsub(/\./, '_')
78
- rel << ENV['TAG'] if ENV['TAG']
79
- puts rel
80
- sh %{cvs commit -m 'pre-tag commit'}
81
- sh %{cvs tag #{rel}}
82
- end
83
91
 
84
92
  # Install rake using the standard install.rb script.
85
93
 
@@ -94,7 +102,7 @@ rd = Rake::RDocTask.new("rdoc") { |rdoc|
94
102
  rdoc.rdoc_dir = 'html'
95
103
  # rdoc.template = 'kilmer'
96
104
  # rdoc.template = 'css2'
97
- rdoc.template = 'jamis'
105
+ rdoc.template = 'doc/jamis.rb'
98
106
  rdoc.title = "Rake -- Ruby Make"
99
107
  rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README'
100
108
  rdoc.rdoc_files.include('README', 'MIT-LICENSE', 'TODO', 'CHANGES')
@@ -220,3 +228,126 @@ end
220
228
  # publish.rf file is not found, the publish targets won't be defined.
221
229
 
222
230
  load "publish.rf" if File.exist? "publish.rf"
231
+
232
+ # Support Tasks ------------------------------------------------------
233
+
234
+ def egrep(pattern)
235
+ Dir['**/*.rb'].each do |fn|
236
+ count = 0
237
+ open(fn) do |f|
238
+ while line = f.gets
239
+ count += 1
240
+ if line =~ pattern
241
+ puts "#{fn}:#{count}:#{line}"
242
+ end
243
+ end
244
+ end
245
+ end
246
+ end
247
+
248
+ desc "Look for TODO and FIXME tags in the code"
249
+ task :todo do
250
+ egrep /#.*(FIXME|TODO|TBD)/
251
+ end
252
+
253
+ desc "Look for Debugging print lines"
254
+ task :dbg do
255
+ egrep /\bDBG|\bbreakpoint\b/
256
+ end
257
+
258
+ desc "List all ruby files"
259
+ task :rubyfiles do
260
+ puts Dir['**/*.rb'].reject { |fn| fn =~ /^pkg/ }
261
+ puts Dir['bin/*'].reject { |fn| fn =~ /CVS|(~$)|(\.rb$)/ }
262
+ end
263
+
264
+ # --------------------------------------------------------------------
265
+ # Creating a release
266
+
267
+ desc "Make a new release"
268
+ task :release => [
269
+ :prerelease,
270
+ :clobber,
271
+ :testall,
272
+ :update_version,
273
+ :package,
274
+ :tag] do
275
+
276
+ announce
277
+ announce "**************************************************************"
278
+ announce "* Release #{PKG_VERSION} Complete."
279
+ announce "* Packages ready to upload."
280
+ announce "**************************************************************"
281
+ announce
282
+ end
283
+
284
+ # Validate that everything is ready to go for a release.
285
+ task :prerelease do
286
+ announce
287
+ announce "**************************************************************"
288
+ announce "* Making RubyGem Release #{PKG_VERSION}"
289
+ announce "* (current version #{CURRENT_VERSION})"
290
+ announce "**************************************************************"
291
+ announce
292
+
293
+ # Is a release number supplied?
294
+ unless ENV['REL']
295
+ fail "Usage: rake release REL=x.y.z [REUSE=tag_suffix]"
296
+ end
297
+
298
+ # Is the release different than the current release.
299
+ # (or is REUSE set?)
300
+ if PKG_VERSION == CURRENT_VERSION && ! ENV['REUSE']
301
+ fail "Current version is #{PKG_VERSION}, must specify REUSE=tag_suffix to reuse version"
302
+ end
303
+
304
+ # Are all source files checked in?
305
+ if ENV['RELTEST']
306
+ announce "Release Task Testing, skipping checked-in file test"
307
+ else
308
+ announce "Checking for unchecked-in files..."
309
+ data = `cvs -q update`
310
+ unless data =~ /^$/
311
+ fail "CVS update is not clean ... do you have unchecked-in files?"
312
+ end
313
+ announce "No outstanding checkins found ... OK"
314
+ end
315
+ end
316
+
317
+ task :update_version => [:prerelease] do
318
+ if PKG_VERSION == CURRENT_VERSION
319
+ announce "No version change ... skipping version update"
320
+ else
321
+ announce "Updating Rake version to #{PKG_VERSION}"
322
+ open("lib/rake.rb") do |rakein|
323
+ open("lib/rake.rb.new", "w") do |rakeout|
324
+ rakein.each do |line|
325
+ if line =~ /^RAKEVERSION\s*=\s*/
326
+ rakeout.puts "RAKEVERSION = '#{PKG_VERSION}'"
327
+ else
328
+ rakeout.puts line
329
+ end
330
+ end
331
+ end
332
+ end
333
+ mv "lib/rake.rb.new", "lib/rake.rb"
334
+ if ENV['RELTEST']
335
+ announce "Release Task Testing, skipping commiting of new version"
336
+ else
337
+ sh %{cvs commit -m "Updated to version #{PKG_VERSION}" lib/rake.rb}
338
+ end
339
+ end
340
+ end
341
+
342
+ desc "Tag all the CVS files with the latest release number (REL=x.y.z)"
343
+ task :tag => [:prerelease] do
344
+ reltag = "REL_#{PKG_VERSION.gsub(/\./, '_')}"
345
+ reltag << ENV['REUSE'].gsub(/\./, '_') if ENV['REUSE']
346
+ announce "Tagging CVS with [#{reltag}]"
347
+ if ENV['RELTEST']
348
+ announce "Release Task Testing, skipping CVS tagging"
349
+ else
350
+ sh %{cvs tag #{reltag}}
351
+ end
352
+ end
353
+
data/doc/rake.1.gz ADDED
Binary file
data/doc/rakefile.rdoc CHANGED
@@ -128,8 +128,8 @@ prerequisite a source file with an extension of ".c" must exist. If
128
128
  Rake is able to find a file named "mycode.c", it will automatically
129
129
  create a task that builds "mycode.o" from "mycode.c".
130
130
 
131
- Notice that the source file "mycode.c" must exist. Rake does not
132
- (currently) try to do multi-level task synthesis.
131
+ If the file "mycode.c" does not exist, rake will attempt
132
+ to recursively synthesize a rule for it.
133
133
 
134
134
  When a task is synthesized from a rule, the +source+ attribute of the
135
135
  task is set to the matching source file. This allows us to write
@@ -0,0 +1,35 @@
1
+ = Rake 0.4.15 Released
2
+
3
+ == Changes
4
+
5
+ Version 0.4.15 is a bug fix update for the Ruby 1.8.2 compatibility
6
+ changes. This release includes:
7
+
8
+ * Fixed a bug that prevented the TESTOPTS flag from working with the
9
+ revised for 1.8.2 test task.
10
+
11
+ * Updated the docs on --trace to indicate that it also enables a full
12
+ backtrace on errors.
13
+
14
+ * Several fixes for new warnings generated.
15
+
16
+ == Mini-Roadmap
17
+
18
+ I will continue to issue Rake updates in the 0.4.xx series as new
19
+ Ruby-1.8.2 issues become manifest. Once the codebase stabilizes, I
20
+ will release a 0.5.0 version incorporating all the changes. If you
21
+ are not using Ruby-1.8.2 and wish to avoid version churn, I recommend
22
+ staying with a release prior to Rake-0.4.14.
23
+
24
+ == What is Rake
25
+
26
+ Rake is a build tool similar to the make program in many ways. But
27
+ instead of cryptic make recipes, Rake uses standard Ruby code to
28
+ declare tasks and dependencies. You have the full power of a modern
29
+ scripting language built right into your build tool.
30
+
31
+ == Availability
32
+
33
+ Home Page:: http://rake.rubyforge.org/
34
+ Download:: http://rubyforge.org/project/showfiles.php?group_id=50
35
+
@@ -0,0 +1,53 @@
1
+ = Rake 0.5.0 Released
2
+
3
+ It has been a long time in coming, but we finally have a new version
4
+ of Rake available.
5
+
6
+ == Changes
7
+
8
+ * Fixed bug where missing intermediate file dependencies could cause
9
+ an abort with --trace or --dry-run. (Brian Chandler)
10
+
11
+ * Recursive rules are now supported (Tilman Sauerbeck).
12
+
13
+ * Added tar.gz and tar.bz2 support to package task (Tilman Sauerbeck).
14
+
15
+ * Added warning option for the Test Task (requested by Eric Hodel).
16
+
17
+ * The jamis rdoc template is only used if it exists.
18
+
19
+ * Added fix for Ruby 1.8.2 test/unit and rails problem.
20
+
21
+ * Added contributed rake man file. (Jani Monoses)
22
+
23
+ * Fixed documentation that was lacking the Rake module name (Tilman
24
+ Sauerbeck).
25
+
26
+ == What is Rake
27
+
28
+ Rake is a build tool similar to the make program in many ways. But
29
+ instead of cryptic make recipes, Rake uses standard Ruby code to
30
+ declare tasks and dependencies. You have the full power of a modern
31
+ scripting language built right into your build tool.
32
+
33
+ == Availability
34
+
35
+ The easiest way to get and install rake is via RubyGems ...
36
+
37
+ gem install rake (you may need root/admin privileges)
38
+
39
+ Otherwise, you can get it from the more traditional places:
40
+
41
+ Home Page:: http://rake.rubyforge.org/
42
+ Download:: http://rubyforge.org/project/showfiles.php?group_id=50
43
+
44
+ == Thanks
45
+
46
+ Lots of people provided input to this release. Thanks to Tilman
47
+ Sauerbeck for numerous patches, documentation fixes and suggestions.
48
+ And for also pushing me to get this release out. Also, thanks to
49
+ Brian Chandler for the finding and fixing --trace/dry-run fix. That
50
+ was an obscure bug. Also to Eric Hodel for some good suggestions.
51
+
52
+ -- Jim Weirich
53
+
data/lib/rake.rb CHANGED
@@ -29,7 +29,7 @@
29
29
  # referenced as a library via a require statement, but it can be
30
30
  # distributed independently as an application.
31
31
 
32
- RAKEVERSION = '0.4.15'
32
+ RAKEVERSION = '0.5.0'
33
33
 
34
34
  require 'rbconfig'
35
35
  require 'ftools'
@@ -219,7 +219,9 @@ class Task
219
219
  # task with the prerequisites and actions from the rule. Set the
220
220
  # source attribute of the task appropriately for the rule. Return
221
221
  # the enhanced task or nil of no rule was found.
222
- def enhance_with_matching_rule(task_name)
222
+ def enhance_with_matching_rule(task_name, level=0)
223
+ fail Rake::RuleRecursionOverflowError,
224
+ "Rule Recursion Too Deep" if level >= 16
223
225
  RULES.each do |pattern, extensions, block|
224
226
  if md = pattern.match(task_name)
225
227
  ext = extensions.first
@@ -235,10 +237,17 @@ class Task
235
237
  task = FileTask.define_task({task_name => [source]}, &block)
236
238
  task.source = source
237
239
  return task
240
+ elsif parent = enhance_with_matching_rule(source, level+1)
241
+ task = FileTask.define_task({task_name => [parent.name]}, &block)
242
+ task.source = parent.name
243
+ return task
238
244
  end
239
245
  end
240
246
  end
241
247
  nil
248
+ rescue Rake::RuleRecursionOverflowError => ex
249
+ ex.add_target(task_name)
250
+ fail ex
242
251
  end
243
252
 
244
253
  private
@@ -277,6 +286,9 @@ class FileTask < Task
277
286
  latest_prereq = @prerequisites.collect{|n| Task[n].timestamp}.max
278
287
  return false if latest_prereq.nil?
279
288
  timestamp < latest_prereq
289
+ rescue Errno::ENOENT => ex # one of the prereqs does not exist
290
+ raise unless $dryrun or $trace
291
+ true
280
292
  end
281
293
 
282
294
  # Time stamp for file task.
@@ -558,6 +570,21 @@ include RakeFileUtils
558
570
 
559
571
  module Rake
560
572
 
573
+ class RuleRecursionOverflowError < StandardError
574
+ def initialize(*args)
575
+ super
576
+ @targets = []
577
+ end
578
+
579
+ def add_target(target)
580
+ @targets << target
581
+ end
582
+
583
+ def message
584
+ super + ": [" + @targets.reverse.join(' => ') + "]"
585
+ end
586
+ end
587
+
561
588
  ####################################################################
562
589
  # A FileList is essentially an array with a few helper methods
563
590
  # defined to make file manipulation a bit easier.
@@ -27,12 +27,18 @@ module Rake
27
27
  # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tgz"</b>]
28
28
  # Create a gzipped tar package (if <em>need_tar</em> is true).
29
29
  #
30
+ # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tar.gz"</b>]
31
+ # Create a gzipped tar package (if <em>need_tar_gz</em> is true).
32
+ #
33
+ # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tar.bz2"</b>]
34
+ # Create a bzip2'd tar package (if <em>need_tar_bz2</em> is true).
35
+ #
30
36
  # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.zip"</b>]
31
37
  # Create a zip package archive (if <em>need_zip</em> is true).
32
38
  #
33
39
  # Example:
34
40
  #
35
- # PackageTask.new("rake", "1.2.3") do |p|
41
+ # Rake::PackageTask.new("rake", "1.2.3") do |p|
36
42
  # p.need_tar = true
37
43
  # p.package_files.include("lib/**/*.rb")
38
44
  # end
@@ -47,9 +53,15 @@ module Rake
47
53
  # Directory used to store the package files (default is 'pkg').
48
54
  attr_accessor :package_dir
49
55
 
50
- # True if a gzipped tar file should be produced (default is false).
56
+ # True if a gzipped tar file (tgz) should be produced (default is false).
51
57
  attr_accessor :need_tar
52
58
 
59
+ # True if a gzipped tar file (tar.gz) should be produced (default is false).
60
+ attr_accessor :need_tar_gz
61
+
62
+ # True if a bzip2'd tar file (tar.bz2) should be produced (default is false).
63
+ attr_accessor :need_tar_bz2
64
+
53
65
  # True if a zip file should be produced (default is false)
54
66
  attr_accessor :need_zip
55
67
 
@@ -70,6 +82,8 @@ module Rake
70
82
  @package_files = Rake::FileList.new
71
83
  @package_dir = 'pkg'
72
84
  @need_tar = false
85
+ @need_tar_gz = false
86
+ @need_tar_bz2 = false
73
87
  @need_zip = false
74
88
  end
75
89
 
@@ -91,15 +105,21 @@ module Rake
91
105
 
92
106
  task :clobber => [:clobber_package]
93
107
 
94
- if need_tar
95
- task :package => ["#{package_dir}/#{tgz_file}"]
96
- file "#{package_dir}/#{tgz_file}" => [package_dir_path] + package_files do
97
- chdir(package_dir) do
98
- sh %{tar zcvf #{tgz_file} #{package_name}}
108
+ [
109
+ [need_tar, tgz_file, "z"],
110
+ [need_tar_gz, tar_gz_file, "z"],
111
+ [need_tar_bz2, tar_bz2_file, "j"]
112
+ ].each do |(need, file, flag)|
113
+ if need
114
+ task :package => ["#{package_dir}/#{file}"]
115
+ file "#{package_dir}/#{file}" => [package_dir_path] + package_files do
116
+ chdir(package_dir) do
117
+ sh %{tar #{flag}cvf #{file} #{package_name}}
118
+ end
99
119
  end
100
120
  end
101
121
  end
102
-
122
+
103
123
  if need_zip
104
124
  task :package => ["#{package_dir}/#{zip_file}"]
105
125
  file "#{package_dir}/#{zip_file}" => [package_dir_path] + package_files do
@@ -142,6 +162,14 @@ module Rake
142
162
  "#{package_name}.tgz"
143
163
  end
144
164
 
165
+ def tar_gz_file
166
+ "#{package_name}.tar.gz"
167
+ end
168
+
169
+ def tar_bz2_file
170
+ "#{package_name}.tar.bz2"
171
+ end
172
+
145
173
  def zip_file
146
174
  "#{package_name}.zip"
147
175
  end
data/lib/rake/rdoctask.rb CHANGED
@@ -8,22 +8,22 @@ module Rake
8
8
  # Create a documentation task that will generate the RDoc files for
9
9
  # a project.
10
10
  #
11
- # The PackageTask will create the following targets:
11
+ # The RDocTask will create the following targets:
12
12
  #
13
13
  # [<b><em>rdoc</em></b>]
14
14
  # Main task for this RDOC task.
15
15
  #
16
16
  # [<b>:clobber_<em>rdoc</em></b>]
17
- # Delete all the package files. This target is automatically
17
+ # Delete all the rdoc files. This target is automatically
18
18
  # added to the main clobber target.
19
19
  #
20
20
  # [<b>:re<em>rdoc</em></b>]
21
- # Rebuild the package files from scratch, even if they are not out
21
+ # Rebuild the rdoc files from scratch, even if they are not out
22
22
  # of date.
23
23
  #
24
24
  # Simple Example:
25
25
  #
26
- # RDocTask.new do |rd|
26
+ # Rake::RDocTask.new do |rd|
27
27
  # rd.main = "README.rdoc"
28
28
  # rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
29
29
  # end
@@ -32,7 +32,7 @@ module Rake
32
32
  # generating two sets of documentation. For instance, if you want to have a
33
33
  # development set of documentation including private methods:
34
34
  #
35
- # RDocTask.new(:rdoc_dev) do |rd|
35
+ # Rake::RDocTask.new(:rdoc_dev) do |rd|
36
36
  # rd.main = "README.doc"
37
37
  # rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
38
38
  # rd.options << "--all"
@@ -0,0 +1,23 @@
1
+ module Test
2
+ module Unit
3
+ module Collector
4
+ class Dir
5
+ undef collect_file
6
+ def collect_file(name, suites, already_gathered)
7
+ # loadpath = $:.dup
8
+ dir = File.dirname(File.expand_path(name))
9
+ $:.unshift(dir) unless $:.first == dir
10
+ if(@req)
11
+ @req.require(name)
12
+ else
13
+ require(name)
14
+ end
15
+ find_test_cases(already_gathered).each{|t| add_suite(suites, t.suite)}
16
+ ensure
17
+ # $:.replace(loadpath)
18
+ $:.delete_at $:.rindex(dir)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
data/lib/rake/testtask.rb CHANGED
@@ -51,6 +51,10 @@ module Rake
51
51
  # is NONE)
52
52
  attr_accessor :options
53
53
 
54
+ # Request that the tests be run with the warning flag set.
55
+ # E.g. warning=true implies "ruby -w" used to run the tests.
56
+ attr_accessor :warning
57
+
54
58
  # Glob pattern to match test files. (default is 'test/test*.rb')
55
59
  attr_accessor :pattern
56
60
 
@@ -67,8 +71,10 @@ module Rake
67
71
  @name = name
68
72
  @libs = ["lib"]
69
73
  @pattern = nil
74
+ @options = nil
70
75
  @test_files = nil
71
76
  @verbose = false
77
+ @warning = false
72
78
  yield self if block_given?
73
79
  @pattern = 'test/test*.rb' if @pattern.nil? && @test_files.nil?
74
80
  define
@@ -77,10 +83,11 @@ module Rake
77
83
  # Create the tasks defined by this task lib.
78
84
  def define
79
85
  lib_path = @libs.join(File::PATH_SEPARATOR)
86
+ warning_flag = (@warning ? "-w " : "")
80
87
  desc "Run tests" + (@name==:test ? "" : " for #{@name}")
81
88
  task @name do
82
89
  RakeFileUtils.verbose(@verbose) do
83
- ruby %{-I#{lib_path} -S testrb #{file_list.join(' ')} #{option_list}}
90
+ ruby %{-I#{lib_path} #{warning_flag}-S testrb #{fix} #{file_list.join(' ')} #{option_list}}
84
91
  end
85
92
  end
86
93
  self
@@ -101,6 +108,23 @@ module Rake
101
108
  end
102
109
  end
103
110
 
111
+ def fix
112
+ case RUBY_VERSION
113
+ when '1.8.2'
114
+ find_fix_file 'rake/ruby182_test_unit_fix'
115
+ else
116
+ nil
117
+ end || ''
118
+ end
119
+
120
+ def find_fix_file(fn)
121
+ $LOAD_PATH.each do |path|
122
+ file_path = File.join(path, "#{fn}.rb")
123
+ return file_path if File.exist? file_path
124
+ end
125
+ nil
126
+ end
127
+
104
128
  end
105
129
  end
106
130
 
data/test/functional.rb CHANGED
@@ -11,35 +11,48 @@ end
11
11
  require 'test/unit'
12
12
  require 'fileutils'
13
13
 
14
+ # Version 2.1.9 of session has a bug where the @debug instance
15
+ # variable is not initialized, causing warning messages. This snippet
16
+ # of code fixes that problem.
17
+ module Session
18
+ class AbstractSession
19
+ alias old_initialize initialize
20
+ def initialize(*args)
21
+ @debug = nil
22
+ old_initialize(*args)
23
+ end
24
+ end
25
+ end
26
+
14
27
  class FunctionalTest < Test::Unit::TestCase
15
28
  def setup
16
29
  @rake_path = File.expand_path("bin/rake")
17
30
  lib_path = File.expand_path("lib")
18
31
  @ruby_options = "-I#{lib_path} -I."
19
- @verbose = true if ENV['VERBOSE']
32
+ @verbose = ! ENV['VERBOSE'].nil?
20
33
  end
21
34
 
22
35
  def test_rake_default
23
36
  Dir.chdir("test/data/default") do rake end
24
- assert_match /^DEFAULT$/, @out
37
+ assert_match(/^DEFAULT$/, @out)
25
38
  assert_status
26
39
  end
27
40
 
28
41
  def test_rake_error_on_bad_task
29
42
  Dir.chdir("test/data/default") do rake "xyz" end
30
- assert_match /rake aborted/, @out
43
+ assert_match(/rake aborted/, @out)
31
44
  assert_status(1)
32
45
  end
33
46
 
34
47
  def test_env_availabe_at_top_scope
35
48
  Dir.chdir("test/data/default") do rake "TESTTOPSCOPE=1" end
36
- assert_match /^TOPSCOPE$/, @out
49
+ assert_match(/^TOPSCOPE$/, @out)
37
50
  assert_status
38
51
  end
39
52
 
40
53
  def test_env_availabe_at_task_scope
41
54
  Dir.chdir("test/data/default") do rake "TESTTASKSCOPE=1 task_scope" end
42
- assert_match /^TASKSCOPE$/, @out
55
+ assert_match(/^TASKSCOPE$/, @out)
43
56
  assert_status
44
57
  end
45
58
 
@@ -68,6 +81,24 @@ class FunctionalTest < Test::Unit::TestCase
68
81
  assert_no_match %r{OTHER}, @out
69
82
  end
70
83
 
84
+ # Test for the trace/dry_run bug found by Brian Chandler
85
+ def test_dry_run_bug
86
+ Dir.chdir("test/data/dryrun") do rake end
87
+ FileUtils.rm_f "test/data/dryrun/temp_one"
88
+ Dir.chdir("test/data/dryrun") do rake "--dry-run" end
89
+ assert_no_match(/No such file/, @out)
90
+ assert_status
91
+ end
92
+
93
+ # Test for the trace/dry_run bug found by Brian Chandler
94
+ def test_trace_bug
95
+ Dir.chdir("test/data/dryrun") do rake end
96
+ FileUtils.rm_f "test/data/dryrun/temp_one"
97
+ Dir.chdir("test/data/dryrun") do rake "--trace" end
98
+ assert_no_match(/No such file/, @out)
99
+ assert_status
100
+ end
101
+
71
102
  private
72
103
 
73
104
  def rake(*option_list)
data/test/testfilelist.rb CHANGED
@@ -52,9 +52,9 @@ class TestFileList < Test::Unit::TestCase
52
52
  def test_add_return
53
53
  f = FileList.new
54
54
  g = f << "x"
55
- assert_equal f.id, g.id
55
+ assert_equal f.object_id, g.object_id
56
56
  h = f.include("y")
57
- assert_equal f.id, h.id
57
+ assert_equal f.object_id, h.object_id
58
58
  end
59
59
 
60
60
  def test_match
@@ -62,7 +62,7 @@ class TestFileList < Test::Unit::TestCase
62
62
  fl.include('test/test*.rb')
63
63
  assert fl.include?("test/testfilelist.rb")
64
64
  assert fl.size > 3
65
- fl.each { |fn| assert_match /\.rb$/, fn }
65
+ fl.each { |fn| assert_match(/\.rb$/, fn) }
66
66
  end
67
67
 
68
68
  def test_add_matching
@@ -102,7 +102,7 @@ class TestFileList < Test::Unit::TestCase
102
102
  assert_equal [
103
103
  'testdata/x.c', 'testdata/abc.c', 'testdata/existing'
104
104
  ], fl
105
- assert_equal fl.id, x.id
105
+ assert_equal fl.object_id, x.object_id
106
106
  fl.exclude('testdata/*.c')
107
107
  assert_equal ['testdata/existing'], fl
108
108
  fl.exclude('testdata/existing')
@@ -165,7 +165,7 @@ class TestFileList < Test::Unit::TestCase
165
165
  res = fl.sub!(/\.c$/, ".o")
166
166
  assert_equal ["x/a.o", "x/b.o"].sort, fl.sort
167
167
  assert_equal "x/a.c", f
168
- assert_equal fl.id, res.id
168
+ assert_equal fl.object_id, res.object_id
169
169
  end
170
170
 
171
171
  def test_sub_with_block
@@ -19,6 +19,8 @@ class TestPackageTask < Test::Unit::TestCase
19
19
  p.package_files.exclude(/~$/)
20
20
  p.package_dir = 'pkg'
21
21
  p.need_tar = true
22
+ p.need_tar_gz = true
23
+ p.need_tar_bz2 = true
22
24
  p.need_zip = true
23
25
  }
24
26
  assert_equal "pkg", pkg.package_dir
@@ -27,6 +29,8 @@ class TestPackageTask < Test::Unit::TestCase
27
29
  assert "1.2.3", pkg.version
28
30
  assert Task[:package]
29
31
  assert Task['pkg/pkgr-1.2.3.tgz']
32
+ assert Task['pkg/pkgr-1.2.3.tar.gz']
33
+ assert Task['pkg/pkgr-1.2.3.tar.bz2']
30
34
  assert Task['pkg/pkgr-1.2.3.zip']
31
35
  assert Task["pkg/pkgr-1.2.3"]
32
36
  assert Task[:clobber_package]
data/test/testtasks.rb CHANGED
@@ -178,8 +178,6 @@ class TestDirectoryTask < Test::Unit::TestCase
178
178
  end
179
179
  end
180
180
 
181
- __END__
182
-
183
181
  ######################################################################
184
182
  class TestDefinitions < Test::Unit::TestCase
185
183
  EXISTINGFILE = "testdata/existing"
@@ -267,12 +265,16 @@ class TestRules < Test::Unit::TestCase
267
265
  @runs = []
268
266
  end
269
267
 
268
+ def teardown
269
+ FileList['testdata/*'].each do |f| rm_r(f, :verbose=>false) end
270
+ end
271
+
270
272
  def test_multiple_rules1
271
273
  create_file(FTNFILE)
272
274
  delete_file(SRCFILE)
273
275
  delete_file(OBJFILE)
274
- rule /\.o$/ => ['.c'] do @runs << :C end
275
- rule /\.o$/ => ['.f'] do @runs << :F end
276
+ rule(/\.o$/ => ['.c']) do @runs << :C end
277
+ rule(/\.o$/ => ['.f']) do @runs << :F end
276
278
  t = Task[OBJFILE]
277
279
  t.invoke
278
280
  Task[OBJFILE].invoke
@@ -283,15 +285,15 @@ class TestRules < Test::Unit::TestCase
283
285
  create_file(FTNFILE)
284
286
  delete_file(SRCFILE)
285
287
  delete_file(OBJFILE)
286
- rule /\.o$/ => ['.f'] do @runs << :F end
287
- rule /\.o$/ => ['.c'] do @runs << :C end
288
+ rule(/\.o$/ => ['.f']) do @runs << :F end
289
+ rule(/\.o$/ => ['.c']) do @runs << :C end
288
290
  Task[OBJFILE].invoke
289
291
  assert_equal [:F], @runs
290
292
  end
291
293
 
292
294
  def test_create_with_source
293
295
  create_file(SRCFILE)
294
- rule /\.o$/ => ['.c'] do |t|
296
+ rule(/\.o$/ => ['.c']) do |t|
295
297
  @runs << t.name
296
298
  assert_equal OBJFILE, t.name
297
299
  assert_equal SRCFILE, t.source
@@ -302,7 +304,7 @@ class TestRules < Test::Unit::TestCase
302
304
 
303
305
  def test_single_dependent
304
306
  create_file(SRCFILE)
305
- rule /\.o$/ => '.c' do |t|
307
+ rule(/\.o$/ => '.c') do |t|
306
308
  @runs << t.name
307
309
  end
308
310
  Task[OBJFILE].invoke
@@ -341,7 +343,7 @@ class TestRules < Test::Unit::TestCase
341
343
 
342
344
  def test_precedence_rule_vs_implicit
343
345
  create_timed_files(OBJFILE, SRCFILE)
344
- rule /\.o$/ => ['.c'] do
346
+ rule(/\.o$/ => ['.c']) do
345
347
  @runs << :RULE
346
348
  end
347
349
  Task[OBJFILE].invoke
@@ -368,4 +370,29 @@ class TestRules < Test::Unit::TestCase
368
370
  ensure
369
371
  rm_r("testdata/src", :verbose=>false) rescue nil
370
372
  end
373
+
374
+ def test_recursive_rules
375
+ actions = []
376
+ create_file("testdata/abc.xml")
377
+ rule '.y' => '.xml' do actions << 'y' end
378
+ rule '.c' => '.y' do actions << 'c'end
379
+ rule '.o' => '.c' do actions << 'o'end
380
+ rule '.exe' => '.o' do actions << 'exe'end
381
+ Task["testdata/abc.exe"].invoke
382
+ assert_equal ['y', 'c', 'o', 'exe'], actions
383
+ end
384
+
385
+ def test_recursive_overflow
386
+ create_file("testdata/a.a")
387
+ prev = 'a'
388
+ ('b'..'z').each do |letter|
389
+ rule ".#{letter}" => ".#{prev}" do |t| puts "#{t.name}" end
390
+ prev = letter
391
+ end
392
+ ex = assert_raises(Rake::RuleRecursionOverflowError) {
393
+ Task["testdata/a.z"].invoke
394
+ }
395
+ assert_match(/a\.z => testdata\/a.y/, ex.message)
396
+ end
397
+
371
398
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.3
2
+ rubygems_version: 0.8.10
3
3
  specification_version: 1
4
4
  name: rake
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.4.15
7
- date: 2005-01-03
6
+ version: 0.5.0
7
+ date: 2005-03-25
8
8
  summary: Ruby based make-like utility.
9
9
  require_paths:
10
10
  - lib
@@ -30,8 +30,8 @@ files:
30
30
  - install.rb
31
31
  - CHANGES
32
32
  - README
33
- - TODO
34
33
  - Rakefile
34
+ - TODO
35
35
  - MIT-LICENSE
36
36
  - bin/rake
37
37
  - lib/rake.rb
@@ -42,6 +42,7 @@ files:
42
42
  - lib/rake/runtest.rb
43
43
  - lib/rake/testtask.rb
44
44
  - lib/rake/gempackagetask.rb
45
+ - lib/rake/ruby182_test_unit_fix.rb
45
46
  - lib/rake/contrib/ftptools.rb
46
47
  - lib/rake/contrib/sys.rb
47
48
  - lib/rake/contrib/compositepublisher.rb
@@ -67,12 +68,15 @@ files:
67
68
  - doc/rational.rdoc
68
69
  - doc/rakefile.rdoc
69
70
  - doc/release_notes
71
+ - doc/rake.1.gz
70
72
  - doc/example/Rakefile1
71
73
  - doc/example/Rakefile2
72
74
  - doc/example/a.c
73
75
  - doc/example/b.c
74
76
  - doc/example/main.c
75
77
  - doc/release_notes/rake-0.4.14.rdoc
78
+ - doc/release_notes/rake-0.4.15.rdoc
79
+ - doc/release_notes/rake-0.5.0.rdoc
76
80
  test_files: []
77
81
  rdoc_options:
78
82
  - "--title"
@@ -90,6 +94,8 @@ extra_rdoc_files:
90
94
  - doc/rational.rdoc
91
95
  - doc/rakefile.rdoc
92
96
  - doc/release_notes/rake-0.4.14.rdoc
97
+ - doc/release_notes/rake-0.4.15.rdoc
98
+ - doc/release_notes/rake-0.5.0.rdoc
93
99
  executables:
94
100
  - rake
95
101
  extensions: []