当前位置: 首页>>代码示例>>PHP>>正文


PHP PackageInterface::setSourceReference方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:25,代码来源:GitDownloader.php

示例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);
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:23,代码来源:GitDownloader.php

示例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()));
     }
 }
开发者ID:Rudloff,项目名称:composer,代码行数:11,代码来源:Installer.php

示例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());
     }
 }
开发者ID:dazzle-libraries,项目名称:composer,代码行数:32,代码来源:GitDownloader.php

示例5: setSourceReference

 public function setSourceReference($reference)
 {
     return $this->aliasOf->setSourceReference($reference);
 }
开发者ID:neon64,项目名称:composer,代码行数:4,代码来源:AliasPackage.php


注:本文中的Composer\Package\PackageInterface::setSourceReference方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。