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


PHP Package::setDistUrl方法代码示例

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


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

示例1: createPackage

 private static function createPackage($name, $url, $ref)
 {
     $package = new Package\Package($name, '1.0.0', 'v1.0.0');
     $package->setDistUrl($url);
     $package->setDistReference($ref);
     return $package;
 }
开发者ID:brunoric,项目名称:prestissimo,代码行数:7,代码来源:ParallelDownloaderTest.php

示例2: createComposerPackage

 /**
  * @param string $version
  * @param string $vendorDir
  * @return Package
  */
 public function createComposerPackage($version, $vendorDir)
 {
     $package = new Package($this->package, $version, $version);
     $package->setTargetDir($vendorDir);
     $package->setInstallationSource('dist');
     $package->setDistType($this->getPlatform() == 'linux' ? 'tar' : 'zip');
     $package->setDistUrl($this->getDownloadUrl($version));
     return $package;
 }
开发者ID:sgc-fireball,项目名称:selenium-server-standalone-installer,代码行数:14,代码来源:PhantomJSDownloader.php

示例3: createComposerInMemoryPackage

 public static function createComposerInMemoryPackage($targetDir, $version)
 {
     $url = self::getURL($version);
     $versionParser = new VersionParser();
     $normVersion = $versionParser->normalize($version);
     $package = new Package(self::PHANTOMJS_NAME, $normVersion, $version);
     $package->setTargetDir($targetDir);
     $package->setInstallationSource('dist');
     $package->setDistType(pathinfo($url, PATHINFO_EXTENSION) === 'zip' ? 'zip' : 'tar');
     // set zip, tarball
     $package->setDistUrl($url);
     return $package;
 }
开发者ID:jfanctil,项目名称:lamoria,代码行数:13,代码来源:Installer.php

示例4: addDistToPackage

 /**
  * @param \Composer\Package\Package $package
  */
 public function addDistToPackage(\Composer\Package\Package $package)
 {
     $this->initializeData();
     $versionDigits = explode('.', $package->getPrettyVersion());
     if (count($versionDigits) === 3) {
         $branchVersion = $versionDigits[0] . '.' . $versionDigits[1];
         $patchlevelVersion = $versionDigits[0] . '.' . $versionDigits[1] . '.' . $versionDigits[2];
         if (isset($this->data[$branchVersion]) && isset($this->data[$branchVersion]['releases'][$patchlevelVersion])) {
             $releaseData = $this->data[$branchVersion]['releases'][$patchlevelVersion];
             if (isset($releaseData['checksums']['tar']['sha1']) && isset($releaseData['url']['tar'])) {
                 $package->setDistType('tar');
                 $package->setDistReference($patchlevelVersion);
                 $package->setDistUrl($releaseData['url']['tar']);
                 $package->setDistSha1Checksum($releaseData['checksums']['tar']['sha1']);
             }
         }
     }
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:21,代码来源:GetTypo3OrgService.php

示例5: install

 /**
  * Installation package
  *
  * @param Composer $composer
  */
 public function install(Composer $composer)
 {
     $this->init();
     /* Create Composer in-memory package */
     $versionParser = new VersionParser();
     $normVersion = $versionParser->normalize($this->version);
     $package = new Package($this->name, $normVersion, $this->version);
     $package->setInstallationSource('dist');
     $package->setDistUrl($this->url);
     $package->setDistType($this->distType);
     $package->setTargetDir($this->targetDir);
     /* Download the Archive */
     $downloadManager = $composer->getDownloadManager();
     $downloadManager->download($package, $this->targetDir, false);
     /* Copy binary to the "bin" file */
     $binDir = $composer->getConfig()->get('bin-dir');
     $this->copyToBinFolder($binDir);
 }
开发者ID:lawondyss,项目名称:canterville,代码行数:23,代码来源:BaseInstaller.php

示例6: installPhantomJS

 /**
  * Operating system dependend installation of PhantomJS
  */
 public static function installPhantomJS(Event $event)
 {
     $composer = $event->getComposer();
     $version = self::getVersion($composer);
     $url = self::getURL($version);
     $binDir = $composer->getConfig()->get('bin-dir');
     // the installation folder depends on the vendor-dir (default prefix is './vendor')
     $targetDir = $composer->getConfig()->get('vendor-dir') . self::PHANTOMJS_TARGETDIR;
     // Create Composer In-Memory Package
     $versionParser = new VersionParser();
     $normVersion = $versionParser->normalize($version);
     $package = new Package(self::PHANTOMJS_NAME, $normVersion, $version);
     $package->setTargetDir($targetDir);
     $package->setInstallationSource('dist');
     $package->setDistType(pathinfo($url, PATHINFO_EXTENSION) === 'zip' ? 'zip' : 'tar');
     // set zip, tarball
     $package->setDistUrl($url);
     // Download the Archive
     $downloadManager = $composer->getDownloadManager();
     $downloadManager->download($package, $targetDir, false);
     // Copy only the PhantomJS binary from the installation "target dir" to the "bin" folder
     self::copyPhantomJsBinaryToBinFolder($targetDir, $binDir);
 }
开发者ID:ambates,项目名称:phantomjs-installer,代码行数:26,代码来源:Installer.php

示例7: doUpdateItself

 /**
  * @param array $tag
  * @param Composer $composer
  * @param OutputInterface $output
  */
 protected function doUpdateItself(array $tag, Composer $composer, OutputInterface $output)
 {
     $output->writeln('Discovered a new version of the application: <info>' . $tag['name'] . '</info>');
     // create install package
     $package = new Package('anime-db/anime-db', $tag['version'], $tag['name']);
     $package->setDistType('zip');
     $package->setDistUrl($tag['zipball_url']);
     $package->setInstallationSource('dist');
     // download new version
     $target = sys_get_temp_dir() . '/anime-db';
     $this->getContainer()->get('filesystem')->remove($target);
     $composer->download($package, $target);
     $new_package = $composer->getPackageFromConfigFile($target . '/composer.json');
     $dispatcher = $this->getContainer()->get('event_dispatcher');
     // notify about downloaded
     $dispatcher->dispatch(StoreEvents::DOWNLOADED, new Downloaded($target, $new_package, $composer->getRootPackage()));
     // rewriting the application files
     $this->rewriting($target);
     // notify about updated
     // event will be sent after the update application components
     $this->getContainer()->get('anime_db.event_dispatcher')->dispatch(StoreEvents::UPDATED, new Updated($new_package));
     $composer->reload();
     $output->writeln('<info>Update itself has been completed</info>');
 }
开发者ID:anime-db,项目名称:anime-db,代码行数:29,代码来源:UpdateCommand.php

示例8: install

 /**
  * Operating system dependend installation of CasperJS
  */
 public static function install(Event $event)
 {
     //Install PhantomJs before CasperJs
     \PhantomInstaller\Installer::installPhantomJS($event);
     $composer = $event->getComposer();
     $version = self::getVersion($composer);
     $url = self::getURL($version);
     $binDir = $composer->getConfig()->get('bin-dir');
     // the installation folder depends on the vendor-dir (default prefix is './vendor')
     $targetDir = $composer->getConfig()->get('vendor-dir') . self::CASPERJS_TARGETDIR;
     // Create Composer In-Memory Package
     $versionParser = new VersionParser();
     $normVersion = $versionParser->normalize($version);
     $package = new Package(self::CASPERJS_NAME, $normVersion, $version);
     $package->setTargetDir($targetDir);
     $package->setInstallationSource('dist');
     $package->setDistType('zip');
     $package->setDistUrl($url);
     // Download the Archive
     $downloadManager = $composer->getDownloadManager();
     $downloadManager->download($package, $targetDir, false);
     // Create CasperJS launcher in the "bin" folder
     self::createCasperJsBinaryToBinFolder($targetDir, $binDir);
 }
开发者ID:jerome-breton,项目名称:casperjs-installer,代码行数:27,代码来源:Installer.php

示例9: build

 public function build(Addon $addon)
 {
     $composer = $this->packagist->getComposer();
     $downloader = $composer->getDownloadManager();
     $packageVersions = $this->packagist->getPackageVersions($addon->Name);
     $time = time();
     if (!$packageVersions) {
         throw new Exception('Could not find corresponding Packagist versions');
     }
     // Get the latest local and packagist version pair.
     $version = $addon->Versions()->filter('Development', true)->first();
     foreach ($packageVersions as $packageVersion) {
         if ($packageVersion->getVersionNormalized() != $version->Version) {
             continue;
         }
         $path = implode('/', array(TEMP_FOLDER, self::ADDONS_DIR, $addon->Name));
         // Convert PackagistAPI result into class compatible with Composer logic
         $package = new Package($addon->Name, $packageVersion->getVersionNormalized(), $packageVersion->getVersion());
         $package->setExtra($packageVersion->getExtra());
         if ($source = $packageVersion->getSource()) {
             $package->setSourceUrl($source->getUrl());
             $package->setSourceType($source->getType());
             $package->setSourceReference($source->getReference());
         }
         if ($dist = $packageVersion->getDist()) {
             $package->setDistUrl($dist->getUrl());
             $package->setDistType($dist->getType());
             $package->setDistReference($dist->getReference());
         }
         $this->download($package, $path);
         $this->buildReadme($addon, $path);
         $this->buildScreenshots($addon, $package, $path);
     }
     $addon->LastBuilt = $time;
     $addon->write();
 }
开发者ID:newleeland,项目名称:addons.silverstripe.org,代码行数:36,代码来源:AddonBuilder.php

示例10: installPhantomJS

 /**
  * Operating system dependend installation of PhantomJS
  */
 public static function installPhantomJS(Event $event)
 {
     $composer = $event->getComposer();
     $version = self::getVersion($composer);
     $url = self::getURL($version);
     // Create Composer In-Memory Package
     $versionParser = new VersionParser();
     $normVersion = $versionParser->normalize($version);
     $package = new Package(self::PHANTOMJS_NAME, $normVersion, $version);
     $package->setTargetDir(self::PHANTOMJS_TARGETDIR);
     $package->setInstallationSource('dist');
     $package->setDistType(pathinfo($url, PATHINFO_EXTENSION) === 'zip' ? 'zip' : 'tar');
     // set zip, tarball
     $package->setDistUrl($url);
     // Download the Archive
     //$io = $event->getIO();
     //$io->write('<info>Fetching PhantomJS v'.$version.'</info>');
     $downloadManager = $composer->getDownloadManager();
     $downloadManager->download($package, self::PHANTOMJS_TARGETDIR, false);
     // Copy all PhantomJS files to "bin" folder
     // self::recursiveCopy(self::PHANTOMJS_TARGETDIR, './bin');
     // Copy only the PhantomJS binary to the "bin" folder
     self::copyPhantomJsBinaryToBinFolder($composer);
 }
开发者ID:ChrisNolan1992,项目名称:phantomjs-installer,代码行数:27,代码来源:Installer.php

示例11: addPackages

 /**
  * @param array $releases
  * @param string $connectPackage
  * @return RepositoryInterface
  */
 private function addPackages(array $releases, $connectPackage)
 {
     return new ArrayRepository(array_map(function ($release) use($connectPackage) {
         $distUrl = sprintf($this->distUrlFormat, $connectPackage, $release, $connectPackage, $release);
         $package = new Package(strtolower($connectPackage), $release, $release);
         $package->setDistUrl($distUrl);
         $package->setDistType('tar');
         $package->setType('magento-module');
         $package->setExtra(['package-xml' => "package.xml"]);
         return $package;
     }, $releases));
 }
开发者ID:adam-paterson,项目名称:magento-connect-composer-plugin,代码行数:17,代码来源:Plugin.php

示例12: addPackages

 /**
  * @param array $releases
  * @param string $connectPackage
  * @param VersionParser $versionParser
  * @return RepositoryInterface
  */
 private function addPackages(array $releases, $connectPackage, VersionParser $versionParser)
 {
     $releases = array_filter($releases, function ($release) use($versionParser) {
         try {
             $versionParser->normalize($release);
         } catch (UnexpectedValueException $e) {
             $this->writeVerbose(sprintf('Version "%s" is not valid. Skipping this version.', $release));
             return false;
         }
         return true;
     });
     return new ArrayRepository(array_map(function ($release) use($connectPackage, $versionParser) {
         $distUrl = sprintf($this->distUrlFormat, $connectPackage, $release, $connectPackage, $release);
         $release = $versionParser->normalize($release);
         $package = new Package(strtolower($connectPackage), $release, $release);
         $package->setDistUrl($distUrl);
         $package->setDistType('tar');
         $package->setType('magento-module');
         $package->setExtra(['package-xml' => "package.xml"]);
         return $package;
     }, $releases));
 }
开发者ID:AydinHassan,项目名称:magento-connect-composer-plugin,代码行数:28,代码来源:Plugin.php

示例13: download

 public function download()
 {
     $package = new Package('ownCloud', '8.2.0', '8.2.0');
     $package->setDistUrl('https://download.owncloud.org/community/owncloud-8.2.0.zip');
     return $this->downloader->download($package, __DIR__ . '/test');
 }
开发者ID:VicDeo,项目名称:poc,代码行数:6,代码来源:Downloader.php

示例14: activate

 public function activate(Composer $composer, IOInterface $io)
 {
     $installer = new PlatformInstaller($io, $composer);
     $composer->getInstallationManager()->addInstaller($installer);
     // Look for extra platform-installer definition
     $pi = false;
     $package = $composer->getPackage();
     $config = $composer->getConfig();
     $extra = $package->getExtra();
     if (!empty($extra['platform-installer'])) {
         $pi = $extra['platform-installer'];
     }
     if (false === $pi) {
         return;
     }
     // Cycle through platform installers
     $installNow = array();
     foreach ($pi as $platform => $installer) {
         if ('all' === strtolower($platform)) {
             foreach ($installer as $install) {
                 if (!empty($install['url'])) {
                     if (empty($install['dir'])) {
                         $install['dir'] = $config->get('vendor-dir') . '/steveorevo/platform/' . strtolower($platform);
                     }
                     if (!is_dir($install['dir'])) {
                         array_push($installNow, $install);
                     }
                 }
             }
         } else {
             foreach ($installer as $install) {
                 if (empty($install['dir'])) {
                     $install['dir'] = $config->get('vendor-dir') . '/steveorevo/platform/' . strtolower($platform);
                 }
                 // Check for architecture
                 $arch = "";
                 if (substr($platform, -3) === "_64" || substr($platform, -3) === "_32") {
                     $arch = substr($platform, -3);
                     $platform = substr($platform, 0, -3);
                 }
                 // Prevent matching 'win' within 'Darwin' and computer name conflicts on Mac
                 $uname = php_uname();
                 if (PHP_OS === "Darwin") {
                     $platform = str_ireplace('Darwin', 'Macintosh', $platform);
                     $uname = str_ireplace('Darwin', 'Macintosh', $uname);
                     $uname = str_ireplace(gethostname(), '', $uname);
                 }
                 if (false !== stripos($uname, $platform)) {
                     if ($arch !== "") {
                         if ($arch === '_' . 8 * PHP_INT_SIZE) {
                             if (!is_dir($install['dir'])) {
                                 array_push($installNow, $install);
                             }
                         }
                     } else {
                         if (!is_dir($install['dir'])) {
                             array_push($installNow, $install);
                         }
                     }
                 }
             }
         }
     }
     // Download platform installers
     foreach ($installNow as $install) {
         $targetDir = $install['dir'];
         $url = $install['url'];
         $downloadManager = $composer->getDownloadManager();
         $version = $package->getVersion();
         $versionParser = new VersionParser();
         $normVersion = $versionParser->normalize($version);
         $package = new Package($url, $normVersion, $version);
         $package->setTargetDir($targetDir);
         $package->setInstallationSource('dist');
         if (false === strpos($url, '.zip')) {
             $package->setDistType('tar');
         } else {
             $package->setDistType('zip');
         }
         $package->setDistUrl($url);
         try {
             $downloadManager->download($package, $targetDir, false);
         } catch (\Exception $e) {
             if ($e instanceof \Composer\Downloader\TransportException && $e->getStatusCode() === 404) {
                 $io->write("<warning>File not found: {$url}</warning>");
             } else {
                 $io->write("<warning>Error downloading: {$url}</warning>");
             }
         }
     }
 }
开发者ID:steveorevo,项目名称:platform-installer-plugin,代码行数:91,代码来源:PlatformInstallerPlugin.php

示例15: bindPackageValues

 /**
  * @param string $newName
  * @param array $package
  * @return Package
  */
 protected static function bindPackageValues($newName, array $package)
 {
     $new = new Package($newName, $package['version'], $package['version']);
     $new->setType('dist');
     if (isset($package['bin'])) {
         $new->setBinaries($package['bin']);
     }
     if (isset($package['dist']['type'])) {
         $new->setDistType($package['dist']['type']);
     }
     if (isset($package['dist']['url'])) {
         $new->setDistUrl($package['dist']['url']);
     }
     if (isset($package['excludes'])) {
         $new->setArchiveExcludes($package['excludes']);
     }
     return $new;
 }
开发者ID:REZ1DENT3,项目名称:mystem,代码行数:23,代码来源:MystemBinaryInstaller.php


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