1
0
Fork 0

Merge pull request #603 from Seldaek/composerfiles

Moved vendor/.composer/* up into vendor/, fixes #497
pull/602/merge
Nils Adermann 2012-04-19 13:05:09 -07:00
commit 437dd36e7d
8 changed files with 87 additions and 68 deletions

View File

@ -1,28 +1,29 @@
* 1.0.0-alpha3
* Schema: Added 'require-dev' for development-time requirements (tests, etc), install with --dev
* Schema: Removed 'recommend'
* Schema: 'suggest' is now informational and can use any description for a package, not only a constraint
* Added caching of repository metadata (faster startup times & failover if packagist is down)
* Added include_path support for legacy projects that are full of require_once statements
* Added installation notifications API to allow better statistics on Composer repositories
* Improved repository protocol to have large cacheable parts
* 1.0.0-alpha2 (2012-04-03)
* Added `create-project` command to install a project from scratch with composer
* Added automated `classmap` autoloading support for non-PSR-0 compliant projects
* Added human readable error reporting when deps can not be solved
* Added support for private GitHub and SVN repositories (use --no-interaction for CI)
* Added "file" downloader type to download plain files
* Added support for authentication with svn repositories
* Added autoload support for PEAR repositories
* Improved clones from GitHub which now automatically select between git/https/http protocols
* Improved `validate` command to give more feedback
* Improved the `search` & `show` commands output
* Removed dependency on filter_var
* Various robustness & error handling improvements, docs fixes and more bug fixes
* 1.0.0-alpha1 (2012-03-01)
* Initial release
* 1.0.0-alpha3
* Schema: Added 'require-dev' for development-time requirements (tests, etc), install with --dev
* Schema: Removed 'recommend'
* Schema: 'suggest' is now informational and can use any description for a package, not only a constraint
* Break: .composer/autoload.php and other files in vendor/.composer have been moved to vendor/
* Added caching of repository metadata (faster startup times & failover if packagist is down)
* Added include_path support for legacy projects that are full of require_once statements
* Added installation notifications API to allow better statistics on Composer repositories
* Improved repository protocol to have large cacheable parts
* 1.0.0-alpha2 (2012-04-03)
* Added `create-project` command to install a project from scratch with composer
* Added automated `classmap` autoloading support for non-PSR-0 compliant projects
* Added human readable error reporting when deps can not be solved
* Added support for private GitHub and SVN repositories (use --no-interaction for CI)
* Added "file" downloader type to download plain files
* Added support for authentication with svn repositories
* Added autoload support for PEAR repositories
* Improved clones from GitHub which now automatically select between git/https/http protocols
* Improved `validate` command to give more feedback
* Improved the `search` & `show` commands output
* Removed dependency on filter_var
* Various robustness & error handling improvements, docs fixes and more bug fixes
* 1.0.0-alpha1 (2012-03-01)
* Initial release

View File

@ -80,7 +80,7 @@ capable of autoloading all of the classes in any of the libraries that it
downloads. To use it, just add the following line to your code's bootstrap
process:
require 'vendor/.composer/autoload.php';
require 'vendor/autoload.php';
Woh! Now start using monolog! To keep learning more about Composer, keep
reading the "Basic Usage" chapter.

View File

@ -136,10 +136,10 @@ but it makes life quite a bit simpler.
## Autoloading
For libraries that specify autoload information, Composer generates a
`vendor/.composer/autoload.php` file. You can simply include this file and you
`vendor/autoload.php` file. You can simply include this file and you
will get autoloading for free.
require 'vendor/.composer/autoload.php';
require 'vendor/autoload.php';
This makes it really easy to use third party code. For example: If your
project depends on monolog, you can just start using classes from it, and they
@ -168,13 +168,13 @@ be in your project root. An example filename would be `src/Acme/Foo.php`
containing an `Acme\Foo` class.
After adding the `autoload` field, you have to re-run `install` to re-generate
the `vendor/.composer/autoload.php` file.
the `vendor/autoload.php` file.
Including that file will also return the autoloader instance, so you can store
the return value of the include call in a variable and add more namespaces.
This can be useful for autoloading classes in a test suite, for example.
$loader = require 'vendor/.composer/autoload.php';
$loader = require 'vendor/autoload.php';
$loader->add('Acme\Test', __DIR__);
In addition to PSR-0 autoloading, classmap is also supported. This allows
@ -182,7 +182,7 @@ classes to be autoloaded even if they do not conform to PSR-0. See the
[autoload reference](04-schema.md#autoload) for more details.
> **Note:** Composer provides its own autoloader. If you don't want to use
that one, you can just include `vendor/.composer/autoload_namespaces.php`,
that one, you can just include `vendor/autoload_namespaces.php`,
which returns an associative array mapping namespaces to directories.
← [Intro](00-intro.md) | [Libraries](02-libraries.md) →

View File

@ -25,7 +25,7 @@ use Composer\Util\Filesystem;
*/
class AutoloadGenerator
{
public function dump(RepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir)
public function dump(RepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $bcLinks = false)
{
$filesystem = new Filesystem();
$filesystem->ensureDirectoryExists($installationManager->getVendorPath());
@ -96,6 +96,17 @@ EOF;
}
file_put_contents($targetDir.'/autoload.php', $this->getAutoloadFile(true, true, (Boolean) $includePathFile));
copy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
// TODO BC feature, add E_DEPRECATED in autoload.php on April 30th, remove after May 30th
if ($bcLinks) {
file_put_contents($targetDir.'/.composer/autoload_namespaces.php', "<?php\n// Deprecated file, use the one in root of vendor dir\nreturn include dirname(__DIR__).'/autoload_namespaces.php';\n");
file_put_contents($targetDir.'/.composer/autoload_classmap.php', "<?php\n// Deprecated file, use the one in root of vendor dir\nreturn include dirname(__DIR__).'/autoload_classmap.php';\n");
file_put_contents($targetDir.'/.composer/autoload.php', "<?php\n// Deprecated file, use the one in root of vendor dir\nreturn include dirname(__DIR__).'/autoload.php';\n");
file_put_contents($targetDir.'/.composer/ClassLoader.php', "<?php\n// Deprecated file, use the one in root of vendor dir\nreturn include dirname(__DIR__).'/ClassLoader.php';\n");
if ($includePathFile) {
file_put_contents($targetDir.'/.composer/include_paths.php', "<?php\n// Deprecated file, use the one in root of vendor dir\nreturn include dirname(__DIR__).'/include_paths.php';\n");
}
}
}
public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)

View File

@ -81,10 +81,10 @@ class Compiler
$this->addFile($phar, $file);
}
$this->addFile($phar, new \SplFileInfo(__DIR__.'/../../vendor/.composer/ClassLoader.php'));
$this->addFile($phar, new \SplFileInfo(__DIR__.'/../../vendor/.composer/autoload.php'));
$this->addFile($phar, new \SplFileInfo(__DIR__.'/../../vendor/.composer/autoload_namespaces.php'));
$this->addFile($phar, new \SplFileInfo(__DIR__.'/../../vendor/.composer/autoload_classmap.php'));
$this->addFile($phar, new \SplFileInfo(__DIR__.'/../../vendor/ClassLoader.php'));
$this->addFile($phar, new \SplFileInfo(__DIR__.'/../../vendor/autoload.php'));
$this->addFile($phar, new \SplFileInfo(__DIR__.'/../../vendor/autoload_namespaces.php'));
$this->addFile($phar, new \SplFileInfo(__DIR__.'/../../vendor/autoload_classmap.php'));
$this->addComposerBin($phar);
// Stubs

View File

@ -151,8 +151,15 @@ class Factory
protected function addLocalRepository(RepositoryManager $rm, $vendorDir)
{
$rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/.composer/installed.json')));
$rm->setLocalDevRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/.composer/installed_dev.json')));
// TODO BC feature, remove after May 30th
if (file_exists($vendorDir.'/.composer/installed.json')) {
rename($vendorDir.'/.composer/installed.json', $vendorDir.'/installed.json');
}
if (file_exists($vendorDir.'/.composer/installed_dev.json')) {
rename($vendorDir.'/.composer/installed_dev.json', $vendorDir.'/installed_dev.json');
}
$rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/installed.json')));
$rm->setLocalDevRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/installed_dev.json')));
}
protected function addPackagistRepository(array $localConfig)

View File

@ -152,7 +152,7 @@ class Installer
}
}
// dump suggestions
// output suggestions
foreach ($this->suggestedPackages as $suggestion) {
$this->io->write($suggestion['source'].' suggests installing '.$suggestion['target'].' ('.$suggestion['reason'].')');
}
@ -174,7 +174,7 @@ class Installer
$this->io->write('<info>Generating autoload files</info>');
$generator = new AutoloadGenerator;
$localRepos = new CompositeRepository($this->repositoryManager->getLocalRepositories());
$generator->dump($localRepos, $this->package, $this->installationManager, $this->installationManager->getVendorPath().'/.composer');
$generator->dump($localRepos, $this->package, $this->installationManager, $this->installationManager->getVendorPath(), true);
// dispatch post event
$eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;

View File

@ -1,25 +1,25 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
function includeIfExists($file) {
if (file_exists($file)) {
return include $file;
}
}
if ((!$loader = includeIfExists(__DIR__.'/../vendor/.composer/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../.composer/autoload.php'))) {
die('You must set up the project dependencies, run the following commands:'.PHP_EOL.
'curl -s http://getcomposer.org/installer | php'.PHP_EOL.
'php composer.phar install'.PHP_EOL);
}
return $loader;
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
function includeIfExists($file) {
if (file_exists($file)) {
return include $file;
}
}
if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
die('You must set up the project dependencies, run the following commands:'.PHP_EOL.
'curl -s http://getcomposer.org/installer | php'.PHP_EOL.
'php composer.phar install'.PHP_EOL);
}
return $loader;