Beispiel #1
0
 /**
  * Returns a new FileSys instance relative to this directory
  *
  * @param \r8\FileSys|String $subPath The subpath to search for
  * @return \r8\FileSys A new filesys object
  */
 public function getSubPath($subPath)
 {
     if (!$this->dirExists()) {
         throw new \r8\Exception\Variable("Dir", "No directory has been set for this instance");
     }
     $subPath = new \r8\FileSys\File($subPath);
     $subPath->resolve($this->getPath());
     if ($subPath->isDir()) {
         return new \r8\FileSys\Dir($subPath);
     } else {
         return $subPath;
     }
 }
Beispiel #2
0
    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";
}
// Remove the config file from pooled directory
if ($dest->contains("tests/config.php")) {
    $dest->getSubPath("tests/config.php")->delete();
    echo "test config file deleted\n";
}
$zipFile = new \r8\FileSys\File($base . "tools/RoundEights-" . r8_VERSION . ".zip");
$targzFile = new \r8\FileSys\File($base . "tools/RoundEights-" . r8_VERSION . ".tar.gz");
if ($zipFile->exists()) {
    echo "Removing existing zip file\n";
    $zipFile->delete();
}
if ($targzFile->exists()) {
    echo "Removing existing tar.gz file\n";
    $targzFile->delete();
}
// Create the archives archive
echo "Creating zip archive\n";
system("cd " . escapeshellarg($tempDir) . "; " . "zip -r " . escapeshellarg($zipFile->getPath()) . " " . escapeshellarg("RoundEights"));
echo "Creating tar.gz archive\n";
system("cd " . escapeshellarg($tempDir) . "; " . "tar -cvzf " . escapeshellarg($targzFile->getPath()) . " " . escapeshellarg("RoundEights"));
// Purge and remove the temporary dir
echo "Removing temporary directory\n";
Beispiel #3
0
 public function testMove_missing()
 {
     $file = new \r8\FileSys\File("/path/to/missing/file");
     try {
         $file->move($this->getTempFileName());
         $this->fail("An expected exception was not thrown");
     } catch (\r8\Exception\FileSystem\Missing $err) {
         $this->assertSame("Path does not exist", $err->getMessage());
     }
 }