Skip to content

Commit

Permalink
Moves CLI to separate package
Browse files Browse the repository at this point in the history
  • Loading branch information
jedrzejchalubek committed Jan 23, 2017
1 parent 422079d commit 98f88a8
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 502 deletions.
6 changes: 1 addition & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,14 @@
"php": ">=5.6"
},
"require-dev": {
"symfony/console": "~2.3|~3.0",
"symfony/finder": "~2.3|~3.0",

"brain/monkey": "~1.3.0",
"mockery/mockery": "~1.0.0",
"phpunit/phpunit": "~5.3.0",
"satooshi/php-coveralls": "~1.0.0",
"php-mock/php-mock-phpunit": "^1.1"
},
"suggest": {
"symfony/console": "[Gin CLI] Required for the proper operation of Console component",
"symfony/finder": "[Gin CLI] Needed for `gin tonik:shake` command"
"tonik/cli": "Required for the proper operation of Gin CLI"
},
"autoload": {
"psr-4": {
Expand Down
110 changes: 30 additions & 80 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions gin

This file was deleted.

61 changes: 3 additions & 58 deletions src/Gin/Foundation/Console/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,10 @@

namespace Tonik\Gin\Foundation\Console;

use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\InputOption;
use Tonik\CLI\CLI as Kernel;

class CLI
{
/**
* Console application instance.
*
* @var \Symfony\Component\Console\Application
*/
protected $app;

/**
* List of commands to register.
*
* @var array
*/
protected $commands = [
'Tonik\Gin\Foundation\Console\Command\ShakeCommand'
];

/**
* Console application banner.
*
Expand All @@ -36,48 +19,10 @@ class CLI
';

/**
* Construct CLI.
* Construct CLI Kernel.
*/
function __construct($dir)
{
$this->app = new Application($this->banner);

$this->dir = $dir;

$this->bootstrap();
}

/**
* Boodstraps CLI.
*
* @return void
*/
protected function bootstrap()
{
$this->addCommands($this->commands);

$this->app->run();
}

/**
* Registers commands within console application.
*
* @param array $commands
*/
protected function addCommands(array $commands)
{
foreach ($commands as $name) {
$command = new $name;

$command->addOption(
'directory',
'dir',
InputOption::VALUE_REQUIRED,
'Root directory path of theme.',
$this->dir
);

$this->app->add($command);
}
return (new Kernel($this->banner, $dir))->boot();
}
}
Loading

0 comments on commit 98f88a8

Please sign in to comment.