本文整理汇总了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);
}
}
示例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));
}
示例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);
}
}
}
}
示例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'));
}