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


PHP PackageInterface::getPrettyVersion方法代码示例

本文整理汇总了PHP中Composer\Package\PackageInterface::getPrettyVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP PackageInterface::getPrettyVersion方法的具体用法?PHP PackageInterface::getPrettyVersion怎么用?PHP PackageInterface::getPrettyVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Composer\Package\PackageInterface的用法示例。


在下文中一共展示了PackageInterface::getPrettyVersion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: formatVersion

 public static function formatVersion(PackageInterface $package, $truncate = true)
 {
     if (!$package->isDev() || !in_array($package->getSourceType(), array('hg', 'git'))) {
         return $package->getPrettyVersion();
     }
     return $package->getPrettyVersion() . ' ' . ($truncate ? substr($package->getSourceReference(), 0, 6) : $package->getSourceReference());
 }
开发者ID:nicodmf,项目名称:composer,代码行数:7,代码来源:VersionParser.php

示例2: formatVersion

 public static function formatVersion(PackageInterface $package, $truncate = true)
 {
     if (!$package->isDev() || !in_array($package->getSourceType(), array('hg', 'git'))) {
         return $package->getPrettyVersion();
     }
     // if source reference is a sha1 hash -- truncate
     if ($truncate && strlen($package->getSourceReference()) === 40) {
         return $package->getPrettyVersion() . ' ' . substr($package->getSourceReference(), 0, 7);
     }
     return $package->getPrettyVersion() . ' ' . $package->getSourceReference();
 }
开发者ID:rkallensee,项目名称:composer,代码行数:11,代码来源:VersionParser.php

示例3: determineBuildNumberFromPackage

 /**
  * Try to determine the build number from a composer package
  *
  * @param \Composer\Package\PackageInterface $package
  *
  * @return string
  */
 public static function determineBuildNumberFromPackage(PackageInterface $package)
 {
     if ($package->isDev()) {
         $buildNumber = self::determineBuildNumberFromBrowscapBuildFile();
         if (is_null($buildNumber)) {
             $buildNumber = substr($package->getSourceReference(), 0, 8);
         }
     } else {
         $installedVersion = $package->getPrettyVersion();
         // SemVer supports build numbers, but fall back to just using
         // version number if not available; at time of writing, composer
         // did not support SemVer 2.0.0 build numbers fully:
         // @see https://github.com/composer/composer/issues/2422
         $plusPos = strpos($installedVersion, '+');
         if ($plusPos !== false) {
             $buildNumber = substr($installedVersion, $plusPos + 1);
         } else {
             $buildNumber = self::determineBuildNumberFromBrowscapBuildFile();
             if (is_null($buildNumber)) {
                 $buildNumber = $installedVersion;
             }
         }
     }
     return $buildNumber;
 }
开发者ID:mimmi20,项目名称:detector,代码行数:32,代码来源:ComposerHook.php

示例4: 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

示例5: 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

示例6: update

 /**
  * {@inheritDoc}
  */
 public function update(PackageInterface $initial, PackageInterface $target, $path)
 {
     if (!$target->getSourceReference()) {
         throw new \InvalidArgumentException('Package ' . $target->getPrettyName() . ' is missing reference information');
     }
     $name = $target->getName();
     if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
         $from = $initial->getSourceReference();
         $to = $target->getSourceReference();
         $name .= ' ' . $initial->getPrettyVersion();
     } else {
         $from = $initial->getFullPrettyVersion();
         $to = $target->getFullPrettyVersion();
     }
     $this->io->writeError("  - Updating <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)");
     $urls = $target->getSourceUrls();
     while ($url = array_shift($urls)) {
         try {
             if (Filesystem::isLocalPath($url)) {
                 $url = realpath($url);
             }
             $this->doUpdate($initial, $target, $path, $url);
             break;
         } catch (\Exception $e) {
             if ($this->io->isDebug()) {
                 $this->io->writeError('Failed: [' . get_class($e) . '] ' . $e->getMessage());
             } elseif (count($urls)) {
                 $this->io->writeError('    Failed, trying the next URL');
             } else {
                 throw $e;
             }
         }
     }
     $this->io->writeError('');
 }
开发者ID:linearsoft,项目名称:composer-svn-export,代码行数:38,代码来源:Downloader.php

示例7: remove

 /**
  * {@inheritDoc}
  */
 public function remove(PackageInterface $package, $path)
 {
     $this->enforceCleanDirectory($path);
     $this->io->write("  - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
     if (!$this->filesystem->removeDirectory($path)) {
         throw new \RuntimeException('Could not completely delete ' . $path . ', aborting.');
     }
 }
开发者ID:nicodmf,项目名称:composer,代码行数:11,代码来源:VcsDownloader.php

示例8: __construct

 /**
  * Constructor.
  *
  * @param string             $name
  * @param string             $type
  * @param PackageInterface   $package
  * @param Link               $link
  * @param Dependency[]|false $children
  */
 public function __construct($name, $type, PackageInterface $package, Link $link, $children)
 {
     $this->name = $name;
     $this->type = $type;
     $this->package = $package;
     $this->link = $link;
     $this->setChildren($children);
     $this->relationship = (new DependencyRelationship())->setSourceName($package->getPrettyName())->setSourceVersion($package->getPrettyVersion())->setTargetName($link->getTarget())->setTargetVersion($link->getPrettyConstraint())->setReason($link->getDescription());
 }
开发者ID:gandalf3,项目名称:bolt,代码行数:18,代码来源:Dependency.php

示例9: update

 /**
  * {@inheritDoc}
  */
 public function update(PackageInterface $initial, PackageInterface $target, $path)
 {
     if (!$target->getSourceReference()) {
         throw new \InvalidArgumentException('Package ' . $target->getPrettyName() . ' is missing reference information');
     }
     $this->io->write("  - Package <info>" . $target->getName() . "</info> (<comment>" . $target->getPrettyVersion() . "</comment>)");
     $this->enforceCleanDirectory($path);
     $this->doUpdate($initial, $target, $path);
     $this->io->write('');
 }
开发者ID:robo47,项目名称:composer,代码行数:13,代码来源:VcsDownloader.php

示例10: remove

 public function remove(PackageInterface $package, $path)
 {
     $this->io->write("  - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
     $this->cleanChanges($package, $path, false);
     if (!$this->filesystem->removeDirectory($path)) {
         if (!defined('PHP_WINDOWS_VERSION_BUILD') || usleep(250) && !$this->filesystem->removeDirectory($path)) {
             throw new \RuntimeException('Could not completely delete ' . $path . ', aborting.');
         }
     }
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:10,代码来源:VcsDownloader.php

示例11: dump

 public function dump(PackageInterface $package)
 {
     $keys = array('binaries' => 'bin', 'type', 'extra', 'installationSource' => 'installation-source', 'autoload', 'notificationUrl' => 'notification-url', 'includePaths' => 'include-path');
     $data = array();
     $data['name'] = $package->getPrettyName();
     $data['version'] = $package->getPrettyVersion();
     $data['version_normalized'] = $package->getVersion();
     if ($package->getTargetDir()) {
         $data['target-dir'] = $package->getTargetDir();
     }
     if ($package->getSourceType()) {
         $data['source']['type'] = $package->getSourceType();
         $data['source']['url'] = $package->getSourceUrl();
         $data['source']['reference'] = $package->getSourceReference();
     }
     if ($package->getDistType()) {
         $data['dist']['type'] = $package->getDistType();
         $data['dist']['url'] = $package->getDistUrl();
         $data['dist']['reference'] = $package->getDistReference();
         $data['dist']['shasum'] = $package->getDistSha1Checksum();
     }
     if ($package->getArchiveExcludes()) {
         $data['archive']['exclude'] = $package->getArchiveExcludes();
     }
     foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
         if ($links = $package->{'get' . ucfirst($opts['method'])}()) {
             foreach ($links as $link) {
                 $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
             }
             ksort($data[$type]);
         }
     }
     if ($packages = $package->getSuggests()) {
         ksort($packages);
         $data['suggest'] = $packages;
     }
     if ($package->getReleaseDate()) {
         $data['time'] = $package->getReleaseDate()->format('Y-m-d H:i:s');
     }
     $data = $this->dumpValues($package, $keys, $data);
     if ($package instanceof CompletePackageInterface) {
         $keys = array('scripts', 'license', 'authors', 'description', 'homepage', 'keywords', 'repositories', 'support');
         $data = $this->dumpValues($package, $keys, $data);
         if (isset($data['keywords']) && is_array($data['keywords'])) {
             sort($data['keywords']);
         }
     }
     if ($package instanceof RootPackageInterface) {
         $minimumStability = $package->getMinimumStability();
         if ($minimumStability) {
             $data['minimum-stability'] = $minimumStability;
         }
     }
     return $data;
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:55,代码来源:ArrayDumper.php

示例12: download

 /**
  * {@inheritDoc}
  */
 public function download(PackageInterface $package, $path)
 {
     $url = $package->getDistUrl();
     $checksum = $package->getDistSha1Checksum();
     if (!is_dir($path)) {
         if (file_exists($path)) {
             throw new \UnexpectedValueException($path . ' exists and is not a directory');
         }
         if (!mkdir($path, 0777, true)) {
             throw new \UnexpectedValueException($path . ' does not exist and could not be created');
         }
     }
     $fileName = rtrim($path . '/' . md5(time() . rand()) . '.' . pathinfo($url, PATHINFO_EXTENSION), '.');
     $this->io->write("  - Package <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
     if (!extension_loaded('openssl') && (0 === strpos($url, 'https:') || 0 === strpos($url, 'http://github.com'))) {
         // bypass https for github if openssl is disabled
         if (preg_match('{^https?://(github.com/[^/]+/[^/]+/(zip|tar)ball/[^/]+)$}i', $url, $match)) {
             $url = 'http://nodeload.' . $match[1];
         } else {
             throw new \RuntimeException('You must enable the openssl extension to download files via https');
         }
     }
     $rfs = new RemoteFilesystem($this->io);
     $rfs->copy($package->getSourceUrl(), $url, $fileName);
     $this->io->write('');
     if (!file_exists($fileName)) {
         throw new \UnexpectedValueException($url . ' could not be saved to ' . $fileName . ', make sure the' . ' directory is writable and you have internet connectivity');
     }
     if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
         throw new \UnexpectedValueException('The checksum verification of the archive failed (downloaded from ' . $url . ')');
     }
     $this->io->write('    Unpacking archive');
     $this->extract($fileName, $path);
     $this->io->write('    Cleaning up');
     unlink($fileName);
     // If we have only a one dir inside it suppose to be a package itself
     $contentDir = glob($path . '/*');
     if (1 === count($contentDir)) {
         $contentDir = $contentDir[0];
         // Rename the content directory to avoid error when moving up
         // a child folder with the same name
         $temporaryName = md5(time() . rand());
         rename($contentDir, $temporaryName);
         $contentDir = $temporaryName;
         foreach (array_merge(glob($contentDir . '/.*'), glob($contentDir . '/*')) as $file) {
             if (trim(basename($file), '.')) {
                 rename($file, $path . '/' . basename($file));
             }
         }
         rmdir($contentDir);
     }
     $this->io->write('');
 }
开发者ID:natxet,项目名称:composer,代码行数:56,代码来源:FileDownloader.php

示例13: notifyInstall

 /**
  * {@inheritDoc}
  */
 public function notifyInstall(PackageInterface $package)
 {
     if (!$this->notifyUrl || !$this->config->get('notify-on-install')) {
         return;
     }
     // TODO use an optional curl_multi pool for all the notifications
     $url = str_replace('%package%', $package->getPrettyName(), $this->notifyUrl);
     $params = array('version' => $package->getPrettyVersion(), 'version_normalized' => $package->getVersion());
     $opts = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query($params, '', '&'), 'timeout' => 3));
     $context = stream_context_create($opts);
     @file_get_contents($url, false, $context);
 }
开发者ID:rufinus,项目名称:composer,代码行数:15,代码来源:ComposerRepository.php

示例14: convertPackageVersion

 /**
  * Convert a package version into string representation.
  *
  * @param PackageInterface $package       The package to extract the version from.
  *
  * @param bool             $fullReference Flag if the complete reference shall be added or an abbreviated form.
  *
  * @return string
  *
  * @throws \RuntimeException If the package is a dev package and does not have valid reference information.
  */
 public static function convertPackageVersion(PackageInterface $package, $fullReference = false)
 {
     $version = $package->getPrettyVersion();
     if ('dev' === $package->getStability()) {
         if (null === ($reference = $package->getDistReference())) {
             if (null === ($reference = $package->getSourceReference())) {
                 throw new \RuntimeException('Unable to determine reference for ' . $package->getPrettyName());
             }
         }
         $version .= '#' . (!$fullReference ? substr($reference, 0, 8) : $reference);
     }
     return $version;
 }
开发者ID:aschempp,项目名称:tenside-core,代码行数:24,代码来源:PackageConverter.php

示例15: doDownload

 public function doDownload(PackageInterface $package, $path)
 {
     $ref = $package->getSourceReference();
     $label = $package->getPrettyVersion();
     $this->io->write('    Cloning ' . $ref);
     $this->initPerforce($package, $path);
     $this->perforce->setStream($ref);
     $this->perforce->p4Login($this->io);
     $this->perforce->writeP4ClientSpec();
     $this->perforce->connectClient();
     $this->perforce->syncCodeBase($label);
     $this->perforce->cleanupClientSpec();
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:13,代码来源:PerforceDownloader.php


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