[Rake-devel] Specifying a tar command for a GemPackageTask
Jim Weirich
jim at weirichhouse.org
Wed Nov 8 01:20:56 EST 2006
Daniel Berger wrote:
>
>
> On 11/6/06, *Jim Weirich* <jim at weirichhouse.org
> <mailto:jim at weirichhouse.org>> wrote:
>
>
> Daniel Berger said:
> > I do have gtar installed on this system, but I need a way to tell the
> > GemPackageTask to use it. Is there a way to do that? If not,
> can we add
> > it?
>
> This is a reasonable request. Got a patch?
>
>
> Yep:
>
> --- packagetask.orig Mon Nov 6 12:28:05 2006
> +++ packagetask.rb Tue Nov 7 12:02:37 2006
> @@ -68,6 +68,9 @@
> # List of files to be included in the package.
> attr_accessor :package_files
>
> + # Tar command used for gzipped or bzip2'd archives. The default is
> 'tar'.
> + attr_accessor :tar_command
> +
> # Create a Package Task with the given name and version.
> def initialize(name=nil, version=nil)
> init(name, version)
> @@ -85,6 +88,7 @@
> @need_tar_gz = false
> @need_tar_bz2 = false
> @need_zip = false
> + @tar_command = 'tar'
> end
>
> # Create the tasks defined by this task library.
> @@ -114,7 +118,7 @@
> 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
>
> That's against 0.7.1, not CVS. Let me know if that's a problem and I'll
> resubmit it.
I've applied this and the gem task description changes to my local
working copy. I also included a zip_command in the package task. I'll
commit these when I finish some other changes that are in progress.
-- Jim Weirich
More information about the Rake-devel
mailing list