Kwiki::Kwiki::Command::Distfile - Methods that creates distfiles.


Kwiki-Kwiki documentation Contained in the Kwiki-Kwiki distribution.

Index


Code Index:

NAME

Top

Kwiki::Kwiki::Command::Distfile - Methods that creates distfiles.

DESCRIPTION

Top

See Kwiki::Kwiki for all documentation.

COPYRIGHT

Top


Kwiki-Kwiki documentation Contained in the Kwiki-Kwiki distribution.

package Kwiki::Kwiki::Command::Distfile;
use strict;
use base 'Kwiki::Kwiki::Command';
use Archive::Tar;
use Cwd qw(cwd);
use File::Basename;

sub process {
    my $self = shift;

    # Generate a manifest
    my @files;
    File::Find::find({
        wanted => sub {
            my ($dev,$ino,$mode,$nlink,$uid,$gid);
            (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_))
                && -f _
                && $File::Find::name !~ m#^\./$self->{ROOT}/#
                && $File::Find::name !~ m/~$/
                && push @files, $File::Find::name;
        }}, '.');

    # Tar it, dereference symlinks so files under lib/ are
    # surely distributed.
    my $tar = Archive::Tar->new;
    $tar->add_files(@files);
    $tar->write($self->distfile_name, 1, "Kwiki-Kwiki");
    print $self->distfile_name . " created.\n";
}

sub distfile_name {
    basename(&cwd) . ".tar.gz";
}

1;

__END__