diff --git a/lib/rake/packagetask.rb b/lib/rake/packagetask.rb index 249ee72b1..cdb4879f5 100644 --- a/lib/rake/packagetask.rb +++ b/lib/rake/packagetask.rb @@ -63,6 +63,9 @@ class PackageTask < TaskLib # is false). attr_accessor :need_tar_bz2 + # True if a xz'd tar file (tar.xz) should be produced (default is false) + attr_accessor :need_tar_xz + # True if a zip file should be produced (default is false) attr_accessor :need_zip @@ -94,6 +97,7 @@ def init(name, version) @need_tar = false @need_tar_gz = false @need_tar_bz2 = false + @need_tar_xz = false @need_zip = false @tar_command = 'tar' @zip_command = 'zip' @@ -120,7 +124,8 @@ def define [ [need_tar, tgz_file, "z"], [need_tar_gz, tar_gz_file, "z"], - [need_tar_bz2, tar_bz2_file, "j"] + [need_tar_bz2, tar_bz2_file, "j"], + [need_tar_xz, tar_xz_file, "J"] ].each do |(need, file, flag)| if need task :package => ["#{package_dir}/#{file}"] @@ -189,6 +194,12 @@ def tar_bz2_file "#{package_name}.tar.bz2" end + # The package name with .tar.xz added + + def tar_xz_file + "#{package_name}.tar.xz" + end + # The package name with .zip added def zip_file diff --git a/test/test_rake_package_task.rb b/test/test_rake_package_task.rb index 87cb57c10..d7821e032 100644 --- a/test/test_rake_package_task.rb +++ b/test/test_rake_package_task.rb @@ -19,6 +19,7 @@ def test_initialize p.need_tar = true p.need_tar_gz = true p.need_tar_bz2 = true + p.need_tar_xz = true p.need_zip = true } @@ -32,6 +33,7 @@ def test_initialize assert Rake::Task['pkg/pkgr-1.2.3.tgz'] assert Rake::Task['pkg/pkgr-1.2.3.tar.gz'] assert Rake::Task['pkg/pkgr-1.2.3.tar.bz2'] + assert Rake::Task['pkg/pkgr-1.2.3.tar.xz'] assert Rake::Task['pkg/pkgr-1.2.3.zip'] assert Rake::Task['pkg/pkgr-1.2.3'] assert Rake::Task[:clobber_package] @@ -76,4 +78,3 @@ def test_package_name_noversion end end -