當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Package::setDevAutoload方法代碼示例

本文整理匯總了PHP中Composer\Package\Package::setDevAutoload方法的典型用法代碼示例。如果您正苦於以下問題:PHP Package::setDevAutoload方法的具體用法?PHP Package::setDevAutoload怎麽用?PHP Package::setDevAutoload使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Composer\Package\Package的用法示例。


在下文中一共展示了Package::setDevAutoload方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: build

 public function build($rootDirectory, $optimize = false, $noDevMode = false)
 {
     $packages = $this->loadPackages($rootDirectory);
     $evm = new EventDispatcher(new Composer(), $this->io);
     $generator = new AutoloadGenerator($evm, $this->io);
     $generator->setDevMode(!$noDevMode);
     $installationManager = new InstallationManager();
     $installationManager->addInstaller(new FiddlerInstaller());
     $this->io->write('Building fiddler.json projects.');
     foreach ($packages as $packageName => $config) {
         if (strpos($packageName, 'vendor') === 0) {
             continue;
         }
         $this->io->write(' [Build] <info>' . $packageName . '</info>');
         $mainPackage = new Package($packageName, "@stable", "@stable");
         $mainPackage->setType('fiddler');
         $mainPackage->setAutoload($config['autoload']);
         $mainPackage->setDevAutoload($config['autoload-dev']);
         $localRepo = new FiddlerInstalledRepository();
         $this->resolvePackageDependencies($localRepo, $packages, $packageName);
         $composerConfig = new Config(true, $rootDirectory);
         $composerConfig->merge(array('config' => array('vendor-dir' => $config['path'] . '/vendor')));
         $generator->dump($composerConfig, $localRepo, $mainPackage, $installationManager, 'composer', $optimize);
     }
 }
開發者ID:sidisinsane,項目名稱:fiddler,代碼行數:25,代碼來源:Build.php

示例2: build

 public function build($rootDirectory, $optimize = false, $noDevMode = false)
 {
     $this->io->write(sprintf('<info>Generating autoload files for monorepo sub-packages %s dev-dependencies.</info>', $noDevMode ? 'without' : 'with'));
     $start = microtime(true);
     $packages = $this->loadPackages($rootDirectory);
     $evm = new EventDispatcher(new Composer(), $this->io);
     $generator = new AutoloadGenerator($evm, $this->io);
     $generator->setDevMode(!$noDevMode);
     $installationManager = new InstallationManager();
     $installationManager->addInstaller(new MonorepoInstaller());
     foreach ($packages as $packageName => $config) {
         if (strpos($packageName, 'vendor') === 0) {
             continue;
         }
         $this->io->write(sprintf(' [Subpackage] <comment>%s</comment>', $packageName));
         $mainPackage = new Package($packageName, "@stable", "@stable");
         $mainPackage->setType('monorepo');
         $mainPackage->setAutoload($config['autoload']);
         $mainPackage->setDevAutoload($config['autoload-dev']);
         $localRepo = new MonorepoInstalledRepository();
         $this->resolvePackageDependencies($localRepo, $packages, $packageName);
         $composerConfig = new Config(true, $rootDirectory);
         $composerConfig->merge(array('config' => array('vendor-dir' => $config['path'] . '/vendor')));
         $generator->dump($composerConfig, $localRepo, $mainPackage, $installationManager, 'composer', $optimize);
         $binDir = $config['path'] . '/vendor/bin';
         // remove old symlinks
         array_map('unlink', glob($binDir . '/*'));
         foreach ($localRepo->getPackages() as $package) {
             foreach ($package->getBinaries() as $binary) {
                 if (!is_dir($binDir)) {
                     mkdir($binDir, 0755, true);
                 }
                 $binFile = $binDir . '/' . basename($binary);
                 symlink($rootDirectory . '/' . $binary, $binFile);
             }
         }
     }
     $duration = microtime(true) - $start;
     $this->io->write(sprintf('Monorepo subpackage autoloads generated in <comment>%0.2f</comment> seconds.', $duration));
 }
開發者ID:beberlei,項目名稱:composer-monorepo-plugin,代碼行數:40,代碼來源:Build.php

示例3: build

 public function build($rootDirectory, $optimize = false, $noDevMode = false)
 {
     $packages = $this->loadPackages($rootDirectory);
     $evm = new EventDispatcher(new Composer(), $this->io);
     $generator = new AutoloadGenerator($evm, $this->io);
     $generator->setDevMode(!$noDevMode);
     $installationManager = new InstallationManager();
     $installationManager->addInstaller(new FiddlerInstaller());
     $this->io->write('Building fiddler.json projects.');
     foreach ($packages as $packageName => $config) {
         if (strpos($packageName, 'vendor') === 0) {
             continue;
         }
         $this->io->write(' [Build] <info>' . $packageName . '</info>');
         $mainPackage = new Package($packageName, "@stable", "@stable");
         $mainPackage->setType('fiddler');
         $mainPackage->setAutoload($config['autoload']);
         $mainPackage->setDevAutoload($config['autoload-dev']);
         $localRepo = new FiddlerInstalledRepository();
         $this->resolvePackageDependencies($localRepo, $packages, $packageName);
         $composerConfig = new Config(true, $rootDirectory);
         $composerConfig->merge(array('config' => array('vendor-dir' => $config['path'] . '/vendor')));
         $generator->dump($composerConfig, $localRepo, $mainPackage, $installationManager, 'composer', $optimize);
         $binDir = $config['path'] . '/vendor/bin';
         // remove old symlinks
         array_map('unlink', glob($binDir . '/*'));
         foreach ($localRepo->getPackages() as $package) {
             foreach ($package->getBinaries() as $binary) {
                 if (!is_dir($binDir)) {
                     mkdir($binDir, 0755, true);
                 }
                 $binFile = $binDir . '/' . basename($binary);
                 symlink($rootDirectory . '/' . $binary, $binFile);
             }
         }
     }
 }
開發者ID:JasLin,項目名稱:fiddler,代碼行數:37,代碼來源:Build.php

示例4: testMainPackageDevAutoloadingDisabledByDefault

 public function testMainPackageDevAutoloadingDisabledByDefault()
 {
     $package = new Package('a', '1.0', '1.0');
     $package->setAutoload(array('psr-0' => array('Main' => 'src/')));
     $package->setDevAutoload(array('files' => array('devfiles/foo.php')));
     $this->repository->expects($this->once())->method('getCanonicalPackages')->will($this->returnValue(array()));
     $this->fs->ensureDirectoryExists($this->workingDir . '/composer');
     $this->fs->ensureDirectoryExists($this->workingDir . '/src/Main');
     file_put_contents($this->workingDir . '/src/Main/ClassMain.php', '<?php namespace Main; class ClassMain {}');
     $this->fs->ensureDirectoryExists($this->workingDir . '/devfiles');
     file_put_contents($this->workingDir . '/devfiles/foo.php', '<?php function foo() { echo "foo"; }');
     $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1');
     // check standard autoload
     $this->assertAutoloadFiles('main4', $this->vendorDir . '/composer');
     $this->assertAutoloadFiles('classmap7', $this->vendorDir . '/composer', 'classmap');
     // make sure dev autoload is disabled when dev mode is set to false
     $this->assertFalse(is_file($this->vendorDir . '/composer/autoload_files.php'));
 }
開發者ID:Teino1978-Corp,項目名稱:Teino1978-Corp-composer,代碼行數:18,代碼來源:AutoloadGeneratorTest.php


注:本文中的Composer\Package\Package::setDevAutoload方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。