本文整理匯總了PHP中Composer\Package\PackageInterface::setSourceReference方法的典型用法代碼示例。如果您正苦於以下問題:PHP PackageInterface::setSourceReference方法的具體用法?PHP PackageInterface::setSourceReference怎麽用?PHP PackageInterface::setSourceReference使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Composer\Package\PackageInterface
的用法示例。
在下文中一共展示了PackageInterface::setSourceReference方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: doUpdate
public function doUpdate(PackageInterface $initial, PackageInterface $target, $path)
{
$this->cleanEnv();
$path = $this->normalizePath($path);
if (!is_dir($path . '/.git')) {
throw new \RuntimeException('The .git directory is missing from ' . $path . ', see http://getcomposer.org/commit-deps for more information');
}
$ref = $target->getSourceReference();
$this->io->write(" Checking out " . $ref);
$command = 'git remote set-url composer %s && git fetch composer && git fetch --tags composer';
$this->process->execute('git remote -v', $output, $path);
if (preg_match('{^(?:composer|origin)\\s+https?://(.+):(.+)@([^/]+)}im', $output, $match)) {
$this->io->setAuthentication($match[3], urldecode($match[1]), urldecode($match[2]));
}
$commandCallable = function ($url) use($command) {
return sprintf($command, escapeshellarg($url));
};
$this->runCommand($commandCallable, $target->getSourceUrl(), $path);
if ($newRef = $this->updateToCommit($path, $ref, $target->getPrettyVersion(), $target->getReleaseDate())) {
if ($target->getDistReference() === $target->getSourceReference()) {
$target->setDistReference($newRef);
}
$target->setSourceReference($newRef);
}
}
示例2: doUpdate
/**
* {@inheritDoc}
*/
public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
{
GitUtil::cleanEnv();
if (!$this->hasMetadataRepository($path)) {
throw new \RuntimeException('The .git directory is missing from ' . $path . ', see https://getcomposer.org/commit-deps for more information');
}
$ref = $target->getSourceReference();
$this->io->writeError(" Checking out " . $ref);
$command = 'git remote set-url composer %s && git fetch composer && git fetch --tags composer';
$commandCallable = function ($url) use($command) {
return sprintf($command, ProcessExecutor::escape($url));
};
$this->gitUtil->runCommand($commandCallable, $url, $path);
if ($newRef = $this->updateToCommit($path, $ref, $target->getPrettyVersion(), $target->getReleaseDate())) {
if ($target->getDistReference() === $target->getSourceReference()) {
$target->setDistReference($newRef);
}
$target->setSourceReference($newRef);
}
}
示例3: updateInstallReferences
private function updateInstallReferences(PackageInterface $package, $reference)
{
if (!$reference) {
return;
}
$package->setSourceReference($reference);
$package->setDistReference($reference);
if (preg_match('{^https?://(?:(?:www\\.)?bitbucket\\.org|(api\\.)?github\\.com)/}i', $package->getDistUrl())) {
$package->setDistUrl(preg_replace('{(?<=/)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
}
}
示例4: doUpdate
/**
* {@inheritDoc}
*/
public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
{
GitUtil::cleanEnv();
if (!$this->hasMetadataRepository($path)) {
throw new \RuntimeException('The .git directory is missing from ' . $path . ', see https://getcomposer.org/commit-deps for more information');
}
$updateOriginUrl = false;
if (0 === $this->process->execute('git remote -v', $output, $path) && preg_match('{^origin\\s+(?P<url>\\S+)}m', $output, $originMatch) && preg_match('{^composer\\s+(?P<url>\\S+)}m', $output, $composerMatch)) {
if ($originMatch['url'] === $composerMatch['url'] && $composerMatch['url'] !== $target->getSourceUrl()) {
$updateOriginUrl = true;
}
}
$ref = $target->getSourceReference();
$this->io->writeError(" Checking out " . $ref);
$command = 'git remote set-url composer %s && git fetch composer && git fetch --tags composer';
$commandCallable = function ($url) use($command) {
return sprintf($command, ProcessExecutor::escape($url));
};
$this->gitUtil->runCommand($commandCallable, $url, $path);
if ($newRef = $this->updateToCommit($path, $ref, $target->getPrettyVersion(), $target->getReleaseDate())) {
if ($target->getDistReference() === $target->getSourceReference()) {
$target->setDistReference($newRef);
}
$target->setSourceReference($newRef);
}
if ($updateOriginUrl) {
$this->updateOriginUrl($path, $target->getSourceUrl());
}
}
示例5: setSourceReference
public function setSourceReference($reference)
{
return $this->aliasOf->setSourceReference($reference);
}