当前位置: 首页>>代码示例>>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;未经允许,请勿转载。