getPath() public method

Returns the path to the git repository.
public getPath ( ) : string
return string A directory path
コード例 #1
0
 /**
  * @inheritdoc
  */
 public function getName(Repository $repository)
 {
     $name = basename($repository->getPath());
     if (preg_match('/^(.*)\\.git$/', $name, $vars)) {
         return $vars[1];
     }
     return $name;
 }
コード例 #2
0
ファイル: Inspector.php プロジェクト: swisnl/game-of-tests
 /**
  * @param $repository
  * @return string
  * @throws \Swis\GoT\Exception\CannotFindRemoteException
  */
 protected function getRemoteUrl(Repository $repository)
 {
     try {
         $process = new Process('git config --get remote.origin.url');
         $process->setWorkingDirectory($repository->getPath());
         $process->run();
         $output = trim($process->getOutput());
     } catch (\Exception $e) {
         throw new Exception\CannotFindRemoteException();
     }
     return $output;
 }
コード例 #3
0
ファイル: build.php プロジェクト: webflo/drupal-core-strict
$metapackage_repository->run('config', ['user.email', '*****@*****.**']);
$branches = array_filter($repository->getReferences()->getRemoteBranches(), function (Branch $branch) {
    if ($branch->isRemote() && preg_match('/^origin\\/8\\./', $branch->getName(), $matches)) {
        return TRUE;
    }
    return FALSE;
});
$tags = array_filter($repository->getReferences()->getTags(), function (Tag $tag) {
    return preg_match('/^8\\.[0-9]+\\.[0-9]+/', $tag->getName());
});
$refs = $tags + $branches;
$refs_array = [];
foreach ($refs as $ref) {
    $name = str_replace('origin/', '', $ref->getName());
    if ($ref instanceof Branch) {
        $name .= '-dev';
    }
    $refs_array[$name] = $ref;
}
$sorted = \Composer\Semver\Semver::sort(array_keys($refs_array));
foreach ($sorted as $version) {
    /** @var Gitonomy\Git\Reference\Tag|Gitonomy\Git\Reference\Branch $ref */
    $ref = $refs_array[$version];
    $repository->run('reset', ['--hard', $ref->getCommitHash()]);
    $path = $repository->getPath() . '/composer.lock';
    if (file_exists($path)) {
        $packageBuilder = PackageBuilder::fromLockfile($path);
        $dump = new Dumper($ref, $packageBuilder->buildPackage(), $metapackage_repository);
        $dump->write();
    }
}