コード例 #1
0
ファイル: package.php プロジェクト: Nycto/Round-Eights
// 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";
}
// 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";
コード例 #2
0
ファイル: Dir.php プロジェクト: Nycto/Round-Eights
 public function testContains()
 {
     $dir = new \r8\FileSys\Dir();
     try {
         $dir->contains("file");
         $this->fail("An expected exception was not thrown");
     } catch (\r8\Exception\Variable $err) {
         $this->assertSame("No directory has been set for this instance", $err->getMessage());
     }
     $dir->setPath($this->dir);
     $this->assertTrue($dir->contains("first"));
     $this->assertTrue($dir->contains("third/fourth/"));
     $this->assertTrue($dir->contains("./third/fourth/"));
     $this->assertTrue($dir->contains(new \r8\FileSys\Dir("third")));
     $this->assertTrue($dir->contains("one"));
     $this->assertTrue($dir->contains("second/second-one"));
     $this->assertTrue($dir->contains("third/fourth/fourth-one"));
     $this->assertTrue($dir->contains("./one"));
     $this->assertTrue($dir->contains(new \r8\FileSys\File("third/fourth/fourth-one")));
     $this->assertTrue($dir->contains($this->dir));
     $this->assertFalse($dir->contains("notAFile"));
     $this->assertFalse($dir->contains("/dir/to/a/non/existant/file"));
 }