classes/Builder.php
static function archiveDir( $sourcedir, $archivefile, $no_top_dir=false )
    {
        // please tar cmd on win - OH MY!

        $archivefile = str_replace( '\\', '/', $archivefile );
        $sourcedir = str_replace( '\\', '/', realpath( $sourcedir ) );

        if( $no_top_dir )
        {
            $srcdir = '.';
            $workdir = $sourcedir;
        }
        else
        {
            $srcdir = basename( $sourcedir );
            $workdir = dirname( $sourcedir );
        }
        $archivedir = dirname( $archivefile );
        $extra = '';

        $tar = self::getTool( 'tar' );

        if ( substr( $archivefile, -7 ) == '.tar.gz' || substr( $archivefile, -4 ) == '.tgz' )
        {
            $cmd = "$tar -z -cvf";
            $extra = "-C " . escapeshellarg( $workdir );
            $workdir = $archivedir;
            $archivefile = basename( $archivefile );
        }
        else if ( substr( $archivefile, -8 ) == '.tar.bz2' )
        {
            $cmd = "$tar -j -cvf";
            $extra = "-C " . escapeshellarg( $workdir );
            $workdir = $archivedir;
            $archivefile = basename( $archivefile );
        }
        else if ( substr( $archivefile, -4 ) == '.tar' )
        {
            $cmd = "$tar -cvf";
            $extra = "-C " . escapeshellarg( $workdir );
            $workdir = $archivedir;
            $archivefile = basename( $archivefile );
        }
        else if ( substr( $archivefile, -4 ) == '.zip' )
        {
            $zip = self::getTool( 'zip' );
            $cmd = "$zip -9 -r";
        }
        else
        {
            throw new pakeException( "Can not determine archive type from filename: $archivefile" );
        }

        pake_sh( self::getCdCmd( $workdir ) . " && $cmd $archivefile $extra $srcdir" );

        pake_echo_action( 'file+', $archivefile );
    }
static function archiveDir( $sourcedir, $archivefile, $no_top_dir=false )
    {
        // please tar cmd on win - OH MY!

        $archivefile = str_replace( '\\', '/', $archivefile );
        $sourcedir = str_replace( '\\', '/', realpath( $sourcedir ) );

        if( $no_top_dir )
        {
            $srcdir = '.';
            $workdir = $sourcedir;
        }
        else
        {
            $srcdir = basename( $sourcedir );
            $workdir = dirname( $sourcedir );
        }
        $archivedir = dirname( $archivefile );
        $extra = '';

        $tar = self::getTool( 'tar' );

        if ( substr( $archivefile, -7 ) == '.tar.gz' || substr( $archivefile, -4 ) == '.tgz' )
        {
            $cmd = "$tar -z -cvf";
            $extra = "-C " . escapeshellarg( $workdir );
            $workdir = $archivedir;
            $archivefile = basename( $archivefile );
        }
        else if ( substr( $archivefile, -8 ) == '.tar.bz2' )
        {
            $cmd = "$tar -j -cvf";
            $extra = "-C " . escapeshellarg( $workdir );
            $workdir = $archivedir;
            $archivefile = basename( $archivefile );
        }
        else if ( substr( $archivefile, -4 ) == '.tar' )
        {
            $cmd = "$tar -cvf";
            $extra = "-C " . escapeshellarg( $workdir );
            $workdir = $archivedir;
            $archivefile = basename( $archivefile );
        }
        else if ( substr( $archivefile, -4 ) == '.zip' )
        {
            $zip = self::getTool( 'zip' );
            $cmd = "$zip -9 -r";
        }
        else
        {
            throw new pakeException( "Can not determine archive type from filename: $archivefile" );
        }

        pake_sh( self::getCdCmd( $workdir ) . " && $cmd $archivefile $extra $srcdir" );

        pake_echo_action( 'file+', $archivefile );
    }
static function archiveDir ( $ sourcedir , $ archivefile , $ no_top_dir = false ) { // please tar cmd on win - OH MY!
 $ archivefile = str_replace ( '\\' , '/' , $ archivefile ) ; $ sourcedir = str_replace ( '\\' , '/' , realpath ( $ sourcedir ) ) ; if ( $ no_top_dir ) { $ srcdir = '.' ; $ workdir = $ sourcedir ; } else { $ srcdir = basename ( $ sourcedir ) ; $ workdir = dirname ( $ sourcedir ) ; } $ archivedir = dirname ( $ archivefile ) ; $ extra = '' ; $ tar = self :: getTool ( 'tar' ) ; if ( substr ( $ archivefile , - 7 ) == '.tar.gz' || substr ( $ archivefile , - 4 ) == '.tgz' ) { $ cmd = "$tar -z -cvf" ; $ extra = "-C " . escapeshellarg ( $ workdir ) ; $ workdir = $ archivedir ; $ archivefile = basename ( $ archivefile ) ; } else if ( substr ( $ archivefile , - 8 ) == '.tar.bz2' ) { $ cmd = "$tar -j -cvf" ; $ extra = "-C " . escapeshellarg ( $ workdir ) ; $ workdir = $ archivedir ; $ archivefile = basename ( $ archivefile ) ; } else if ( substr ( $ archivefile , - 4 ) == '.tar' ) { $ cmd = "$tar -cvf" ; $ extra = "-C " . escapeshellarg ( $ workdir ) ; $ workdir = $ archivedir ; $ archivefile = basename ( $ archivefile ) ; } else if ( substr ( $ archivefile , - 4 ) == '.zip' ) { $ zip = self :: getTool ( 'zip' ) ; $ cmd = "$zip -9 -r" ; } else { throw new pakeException ( "Can not determine archive type from filename: $archivefile" ) ; } pake_sh ( self :: getCdCmd ( $ workdir ) . " && $cmd $archivefile $extra $srcdir" ) ; pake_echo_action ( 'file+' , $ archivefile ) ; }
Creates an archive out of a directory.

Uses command-lne tar as Zeta Cmponents do no compress well, and pake
relies on phar which is buggy/unstable on old php versions

@param boolean $no_top_dir when set, $sourcedir directory is not packaged as top-level dir in archive
@todo for tar formats, fix the extra "." dir packaged
Creates an archive out of a directory .