Extracted NginxConfigrator library with feature plan for CLI manipulation

This commit is contained in:
Michał Brzuchalski
2016-06-13 15:03:18 +02:00
parent dcdce081ad
commit b8bd71e265
14 changed files with 379 additions and 38 deletions

35
bin/ngxconf Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env php
<?php
namespace Madkom\NginxConfigurator;
if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
// Called from local git clone.
require __DIR__ . '/../vendor/autoload.php';
} elseif (file_exists(__DIR__ . '/../../../autoload.php')) {
// Called from your project's vendor dir.
require __DIR__ . '/../../../autoload.php';
} else {
die(
'You need to set up the project dependencies using the following commands:' . PHP_EOL .
'curl -s http://getcomposer.org/installer | php' . PHP_EOL .
'php composer.phar install' . PHP_EOL
);
}
use Madkom\NginxConfigurator\Command\AddLocationCommand;
use Madkom\NginxConfigurator\Command\AddServerCommand;
use Madkom\NginxConfigurator\Command\AddUpstreamServerCommand;
use Madkom\NginxConfigurator\Command\RemoveLocationCommand;
use Madkom\NginxConfigurator\Command\RemoveServerCommand;
use Madkom\NginxConfigurator\Command\RemoveUpstreamServerCommand;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
$app = new Application('ngxconf', '1.0.0');
$app->add(new AddServerCommand());
$app->add(new RemoveServerCommand());
$app->add(new AddLocationCommand());
$app->add(new RemoveLocationCommand());
$app->add(new AddUpstreamServerCommand());
$app->add(new RemoveUpstreamServerCommand());
$app->run();