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

Daniel Berger djberg96 at gmail.com
Wed Nov 8 09:01:19 EST 2006


On 11/7/06, Jim Weirich <jim at weirichhouse.org> wrote:
>
> 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.


Thanks Jim.

Ideally, Rake should use a bonafide wrapper around libtar since there may
come a point where someone on Solaris (or some other commerical UNIX
platform) may not have the luxury of using GNU tar.  Unfortunately, the
project that set out to do this ('archive') appears to be on the backburner
while Austin prepares for his wedding.

I did create a project called archive-tar-external a while back that might
be useful in the interim, but I'm not sure how you feel about 3rd party
packages being used within Rake.  If you're interested, I could refactor
that bit of code.  If not, I understand.

Regards,

Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rake-devel/attachments/20061108/70a24a54/attachment.html 


More information about the Rake-devel mailing list