Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support xz compress format for packagetask #129

Merged
merged 1 commit into from
May 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion lib/rake/packagetask.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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'
Expand All @@ -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}"]
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion test/test_rake_package_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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]
Expand Down Expand Up @@ -76,4 +78,3 @@ def test_package_name_noversion
end

end