/** * Creates the tarballs for a release */ function run_dist($task = null, $args = array(), $cliOpts = array()) { // copy workspace dir into dist dir, without git pake_mkdirs(Builder::distDir()); $finder = pakeFinder::type('any')->ignore_version_control(); pake_mirror($finder, realpath(Builder::workspaceDir()), realpath(Builder::distDir())); // remove unwanted files from dist dir // also: do we still need to run dos2unix? // create tarballs $cwd = getcwd(); chdir(dirname(Builder::distDir())); foreach (Builder::distFiles() as $distFile) { // php can not really create good zip files via phar: they are not compressed! if (substr($distFile, -4) == '.zip') { $cmd = Builder::tool('zip'); $extra = '-9 -r'; pake_sh("{$cmd} {$distFile} {$extra} " . basename(Builder::distDir())); } else { $finder = pakeFinder::type('any')->pattern(basename(Builder::distDir()) . '/**'); // see https://bugs.php.net/bug.php?id=58852 $pharFile = str_replace(Builder::libVersion(), '_LIBVERSION_', $distFile); pakeArchive::createArchive($finder, '.', $pharFile); rename($pharFile, $distFile); } } chdir($cwd); }
/** * create an executable PHAR-archive of Pake * * @return bool * @author Alexey Zakhlestin */ function run_phar() { $finder = pakeFinder::type('any')->ignore_version_control()->name('phar-stub.php', '*.class.php', 'init.php', 'pakeFunction.php'); pakeArchive::createPharArchive($finder, dirname(__FILE__), 'pake.phar', 'phar-stub.php', null, true); }