2011-09-14 12:57:40 +00:00
|
|
|
<?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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Composer\Console;
|
|
|
|
|
|
|
|
use Symfony\Component\Console\Application as BaseApplication;
|
|
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
use Symfony\Component\Finder\Finder;
|
2011-10-27 23:19:34 +00:00
|
|
|
use Composer\Command;
|
2011-09-20 21:34:06 +00:00
|
|
|
use Composer\Composer;
|
2011-09-14 12:57:40 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The console application that handles the commands
|
|
|
|
*
|
|
|
|
* @author Ryan Weaver <ryan@knplabs.com>
|
|
|
|
*/
|
|
|
|
class Application extends BaseApplication
|
|
|
|
{
|
|
|
|
private $composer;
|
|
|
|
|
2011-09-25 18:00:44 +00:00
|
|
|
public function __construct(Composer $composer)
|
2011-09-14 12:57:40 +00:00
|
|
|
{
|
|
|
|
parent::__construct('Composer', Composer::VERSION);
|
|
|
|
|
|
|
|
$this->composer = $composer;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Runs the current application.
|
|
|
|
*
|
|
|
|
* @param InputInterface $input An Input instance
|
|
|
|
* @param OutputInterface $output An Output instance
|
|
|
|
*
|
|
|
|
* @return integer 0 if everything went fine, or an error code
|
|
|
|
*/
|
|
|
|
public function doRun(InputInterface $input, OutputInterface $output)
|
|
|
|
{
|
|
|
|
$this->registerCommands();
|
|
|
|
|
|
|
|
return parent::doRun($input, $output);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return Composer
|
|
|
|
*/
|
|
|
|
public function getComposer()
|
|
|
|
{
|
|
|
|
return $this->composer;
|
|
|
|
}
|
|
|
|
|
2011-09-20 21:34:06 +00:00
|
|
|
/**
|
2011-09-25 21:19:12 +00:00
|
|
|
* Initializes all the composer commands
|
2011-09-14 12:57:40 +00:00
|
|
|
*/
|
|
|
|
protected function registerCommands()
|
|
|
|
{
|
2011-11-08 10:51:01 +00:00
|
|
|
$this->add(new Command\AboutCommand());
|
2011-10-27 23:19:34 +00:00
|
|
|
$this->add(new Command\InstallCommand());
|
2011-10-30 22:15:55 +00:00
|
|
|
$this->add(new Command\UpdateCommand());
|
2011-11-12 18:44:24 +00:00
|
|
|
$this->add(new Command\SelfUpdateCommand());
|
2011-10-27 23:19:34 +00:00
|
|
|
$this->add(new Command\DebugPackagesCommand());
|
2011-09-14 12:57:40 +00:00
|
|
|
}
|
2011-09-20 21:34:06 +00:00
|
|
|
}
|