diff --git a/CHANGES b/CHANGES index 91131d346..56082a42e 100644 --- a/CHANGES +++ b/CHANGES @@ -22,6 +22,12 @@ * Added test for noop, bad_option and verbose flags to sh command. * Removed dependency on internal fu_xxx functions from FileUtils. * Added a 'shame' task to the Rakefile. +* Added tar_command and zip_command options to the Package task. +* Added a description to the gem task in GemPackageTask. +* Fixed a bug when rules have multiple prerequisites (patch by Joel + VanderWerf) +* Added a protected 'require "rubygems"' to test/test_application to + unbreak cruisecontrol.rb. == Version 0.7.1 diff --git a/Rakefile b/Rakefile index 5dd861d31..4d72cd9cf 100644 --- a/Rakefile +++ b/Rakefile @@ -16,7 +16,7 @@ require 'rake/clean' require 'rake/testtask' require 'rake/rdoctask' -CLEAN.include('**/*.o') +CLEAN.include('**/*.o', '*.dot') CLOBBER.include('doc/example/main', 'testdata') CLOBBER.include('test/data/**/temp_*') CLOBBER.include('test/data/chains/play.*') @@ -373,3 +373,7 @@ end # Require experimental XForge/Metaproject support. load 'xforge.rf' if File.exist?('xforge.rf') + +task :where_am_i do + puts Rake.original_dir +end diff --git a/lib/rake.rb b/lib/rake.rb index 60e1209c7..95b85a1b0 100755 --- a/lib/rake.rb +++ b/lib/rake.rb @@ -29,7 +29,7 @@ # referenced as a library via a require statement, but it can be # distributed independently as an application. -RAKEVERSION = '0.7.1.5' +RAKEVERSION = '0.7.1.6' require 'rbconfig' require 'ftools' diff --git a/lib/rake/gempackagetask.rb b/lib/rake/gempackagetask.rb index 0fadea72d..f29d7f34f 100644 --- a/lib/rake/gempackagetask.rb +++ b/lib/rake/gempackagetask.rb @@ -77,6 +77,7 @@ def init(gem) def define super task :package => [:gem] + desc "Build the gem file #{gem_file}" task :gem => ["#{package_dir}/#{gem_file}"] file "#{package_dir}/#{gem_file}" => [package_dir] + @gem_spec.files do when_writing("Creating GEM") { diff --git a/lib/rake/packagetask.rb b/lib/rake/packagetask.rb index 11dd3dab3..71b66a648 100644 --- a/lib/rake/packagetask.rb +++ b/lib/rake/packagetask.rb @@ -68,6 +68,12 @@ class PackageTask < TaskLib # List of files to be included in the package. attr_accessor :package_files + # Tar command for gzipped or bzip2ed archives. The default is 'tar'. + attr_accessor :tar_command + + # Zip command for zipped archives. The default is 'zip'. + attr_accessor :zip_command + # Create a Package Task with the given name and version. def initialize(name=nil, version=nil) init(name, version) @@ -85,6 +91,8 @@ def init(name, version) @need_tar_gz = false @need_tar_bz2 = false @need_zip = false + @tar_command = 'tar' + @zip_command = 'zip' end # Create the tasks defined by this task library. @@ -114,7 +122,7 @@ def define task :package => ["#{package_dir}/#{file}"] file "#{package_dir}/#{file}" => [package_dir_path] + package_files do chdir(package_dir) do - sh %{tar #{flag}cvf #{file} #{package_name}} + sh %{#{@tar_command} #{flag}cvf #{file} #{package_name}} end end end @@ -124,7 +132,7 @@ def define task :package => ["#{package_dir}/#{zip_file}"] file "#{package_dir}/#{zip_file}" => [package_dir_path] + package_files do chdir(package_dir) do - sh %{zip -r #{zip_file} #{package_name}} + sh %{#{@zip_command} -r #{zip_file} #{package_name}} end end end diff --git a/rakelib/shame.rake b/rakelib/shame.rake index f50f64c0c..a8c5b631a 100644 --- a/rakelib/shame.rake +++ b/rakelib/shame.rake @@ -5,6 +5,7 @@ begin require 'rbosax' require 'code_statistics' + desc "Publish Code/Test Ratio on iChat" task :shame do stats = CodeStatistics.new(['Rake', 'lib'], ['Unit tests', 'test']) code = stats.send :calculate_code diff --git a/test/test_application.rb b/test/test_application.rb index 852f161f4..3e9ed55eb 100644 --- a/test/test_application.rb +++ b/test/test_application.rb @@ -1,5 +1,11 @@ #!/usr/bin/env ruby +begin + require 'rubygems' +rescue LoadError + # got no gems +end + require 'test/unit' require 'rake' require 'test/capture_stdout'