Esempio n. 1
0
 */
// Get the base path for the r8 files
$base = realpath(rtrim(__DIR__, "/") . "/..") . "/";
// include r8
require_once $base . 'src/RoundEights.php';
// Create the phar file
include "make.php";
// Pull the base temporary directory. Keep creating directory names
// until we find one that doesn't yet exist
do {
    $tempDir = new \r8\FileSys\Dir(rtrim(sys_get_temp_dir(), "/") . "/RoundEights_" . uniqid());
} while ($tempDir->isDir());
// Pull the destination directory that the package will be pooled in
$dest = new \r8\FileSys\Dir($tempDir->getSubPath("RoundEights")->getPath());
// Create the destination dir
$dest->make();
echo "Temporary directory created: " . $dest->getPath() . "\n";
// Pull a list of dirs and files that need to be copied and their destination
$copy = array("src" => "", "tests" => "", "README.md" => "README.txt", "LICENSE.md" => "LICENSE.txt", "tools/RoundEights-" . r8_VERSION . ".phar" => "");
// Copy the above files
foreach ($copy as $source => $destination) {
    echo "Copying: " . $source . " ";
    if (!file_exists($base . $source)) {
        die("\nCould not locate required path: " . $base . $source);
    }
    $result = system("cp -R " . escapeshellarg($base . $source) . " " . escapeshellarg($dest->getSubPath($destination)->getPath()));
    if ($result === FALSE) {
        die("Failed");
    }
    echo "complete\n";
}
Esempio n. 2
0
 public function testMake_noPerms()
 {
     $dir = new \r8\FileSys\Dir($this->dir . "/this/is/a/new/dir");
     chmod($this->dir, 00);
     try {
         $dir->make();
         $this->fail("An expected exception was not thrown");
     } catch (\r8\Exception\FileSystem $err) {
         $this->assertSame("Unable to create directory", $err->getMessage());
     }
 }