deepCopy() public method

Copies a file and creates the destination directory if needed.
public deepCopy ( string $from, string $to )
$from string File to copy
$to string Destination to copy the file to, relative to the base staging directory.
Example #1
0
<?php

require __DIR__ . '/artifacts/Burgomaster.php';
$stageDirectory = __DIR__ . '/artifacts/staging';
$projectRoot = __DIR__ . '/../';
$burgomaster = new \Burgomaster($stageDirectory, $projectRoot);
$metaFiles = ['README.md', 'LICENSE.md', 'NOTICE.md', 'CHANGELOG.md'];
foreach ($metaFiles as $file) {
    $burgomaster->deepCopy($file, $file);
}
// Copy each dependency to the staging directory. Copy *.php and *.pem files.
$burgomaster->recursiveCopy('src/Aws', 'Aws', ['php', 'json']);
$burgomaster->recursiveCopy('vendor/guzzle/guzzle/src/Guzzle', 'Guzzle', ['php', 'pem']);
$burgomaster->recursiveCopy('vendor/doctrine/cache/lib/Doctrine', 'Doctrine');
$burgomaster->recursiveCopy('vendor/psr/log/Psr', 'Psr');
$burgomaster->recursiveCopy('vendor/monolog/monolog/src/Monolog', 'Monlog');
$burgomaster->recursiveCopy('vendor/symfony/event-dispatcher/Symfony', 'Symfony');
$burgomaster->createAutoloader();
$burgomaster->createZip(__DIR__ . '/artifacts/aws.zip');
$burgomaster->createPhar(__DIR__ . '/artifacts/aws.phar');
$burgomaster->startSection('test_phar');
$burgomaster->debug('Phar output: ' . $burgomaster->exec('php ' . __DIR__ . '/test_phar.php'));
$burgomaster->endSection();
Example #2
0
<?php

require __DIR__ . '/artifacts/Burgomaster.php';
$stageDirectory = __DIR__ . '/artifacts/staging';
$projectRoot = __DIR__ . '/../';
$packager = new \Burgomaster($stageDirectory, $projectRoot);
// Copy basic files to the stage directory. Note that we have chdir'd onto
// the $projectRoot directory, so use relative paths.
foreach (['README.md', 'LICENSE'] as $file) {
    $packager->deepCopy($file, $file);
}
// Copy each dependency to the staging directory. Copy *.php and *.pem files.
$packager->recursiveCopy('src', 'GuzzleHttp5Legacy', ['php']);
$packager->recursiveCopy('vendor/react/promise/src', 'React/Promise');
$packager->recursiveCopy('vendor/guzzlehttp/ringphp/src', 'GuzzleHttp5Legacy/Ring');
$packager->recursiveCopy('vendor/guzzlehttp/streams/src', 'GuzzleHttp5Legacy/Stream');
$packager->createAutoloader(['React/Promise/functions.php']);
$packager->createPhar(__DIR__ . '/artifacts/guzzle.phar');
$packager->createZip(__DIR__ . '/artifacts/guzzle.zip');
Example #3
0
<?php

// directory paths
$baseDirectory = realpath(__DIR__ . '/..');
$buildDirectory = $baseDirectory . '/build';
$artifactsDirectory = $buildDirectory . '/artifacts';
$stagingDirectory = $artifactsDirectory . '/staging';
// create all needed directories.
if (!file_exists($artifactsDirectory)) {
    mkdir($artifactsDirectory);
}
// setup packager
require $baseDirectory . '/vendor/mtdowling/burgomaster/src/Burgomaster.php';
$packager = new \Burgomaster($stagingDirectory, $baseDirectory);
// include readme and license files
foreach (['README.md', 'LICENSE'] as $file) {
    $packager->deepCopy($file, $file);
}
// include source
$packager->recursiveCopy('src', 'GW2Treasures/GW2Api', ['php']);
// include cacert.pem
$packager->deepCopy('src/cacert.pem', 'GW2Treasures/GW2Api/cacert.pem');
// create the autoloader
$packager->createAutoloader();
// build phar and zip archives
$packager->createPhar($buildDirectory . '/artifacts/gw2api.phar');
$packager->createZip($buildDirectory . '/artifacts/gw2api.zip');