1
0
mirror of synced 2024-12-05 03:06:05 +03:00

[DDC-1807] Fix composer bin support and keep BC with PEAR installer.

This commit is contained in:
Benjamin Eberlei 2012-05-22 20:26:03 +02:00
parent e2d15c3a04
commit be6fb617df
5 changed files with 66 additions and 6 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
include('doctrine.php'); include('doctrine.php');

50
bin/doctrine-pear.php Normal file
View File

@ -0,0 +1,50 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/
require_once 'Doctrine/Common/ClassLoader.php';
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine');
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Symfony');
$classLoader->register();
$configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php';
$helperSet = null;
if (file_exists($configFile)) {
if ( ! is_readable($configFile)) {
trigger_error(
'Configuration file [' . $configFile . '] does not have read permission.', E_ERROR
);
}
require $configFile;
foreach ($GLOBALS as $helperSetCandidate) {
if ($helperSetCandidate instanceof \Symfony\Component\Console\Helper\HelperSet) {
$helperSet = $helperSetCandidate;
break;
}
}
}
$helperSet = ($helperSet) ?: new \Symfony\Component\Console\Helper\HelperSet();
\Doctrine\ORM\Tools\Console\ConsoleRunner::run($helperSet);

View File

@ -17,12 +17,17 @@
* <http://www.doctrine-project.org>. * <http://www.doctrine-project.org>.
*/ */
require_once 'Doctrine/Common/ClassLoader.php'; if (!@include __DIR__ . '/../../../autoload.php') {
die(<<<'EOT'
This command can only be run when Doctrine is installed through Composer.
EOT
);
}
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine'); $classLoader = new \Doctrine\Common\ClassLoader('Doctrine');
$classLoader->register(); $classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Symfony', 'Doctrine'); $classLoader = new \Doctrine\Common\ClassLoader('Symfony');
$classLoader->register(); $classLoader->register();
$configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php'; $configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php';

View File

@ -19,7 +19,7 @@
--> -->
<fileset id="bin-scripts" dir="./bin"> <fileset id="bin-scripts" dir="./bin">
<include name="doctrine"/> <include name="doctrine"/>
<include name="doctrine.php"/> <include name="doctrine-pear.php"/>
<include name="doctrine.bat"/> <include name="doctrine.bat"/>
</fileset> </fileset>
@ -104,7 +104,7 @@
<ignore>Symfony/Component/Console/</ignore> <ignore>Symfony/Component/Console/</ignore>
<release> <release>
<install as="doctrine" name="bin/doctrine" /> <install as="doctrine" name="bin/doctrine" />
<install as="doctrine.php" name="bin/doctrine.php" /> <install as="doctrine.php" name="bin/doctrine-pear.php" />
<install as="doctrine.bat" name="bin/doctrine.bat" /> <install as="doctrine.bat" name="bin/doctrine.bat" />
</release> </release>
<replacement path="bin/doctrine" type="pear-config" from="@php_bin@" to="php_bin" /> <replacement path="bin/doctrine" type="pear-config" from="@php_bin@" to="php_bin" />

View File

@ -14,11 +14,16 @@
"require": { "require": {
"php": ">=5.3.2", "php": ">=5.3.2",
"ext-pdo": "*", "ext-pdo": "*",
"doctrine/dbal": "2.3.*" "doctrine/dbal": "2.3.*",
"symfony/console": "2.*"
},
"suggest": {
"symfony/yaml": "If you want to using YAML Metadata Mapping Driver"
}, },
"autoload": { "autoload": {
"psr-0": { "Doctrine\\ORM": "lib/" } "psr-0": { "Doctrine\\ORM": "lib/" }
}, },
"bin": ["bin/doctrine", "bin/doctrine.php"],
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.3.x-dev" "dev-master": "2.3.x-dev"