[Rake-devel] Specifying a tar command for a GemPackageTask

Daniel Berger djberg96 at gmail.com
Tue Nov 7 14:10:22 EST 2006


On 11/6/06, Jim Weirich <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.

Thanks,

Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rake-devel/attachments/20061107/0080738c/attachment-0001.html 


More information about the Rake-devel mailing list