mirror of
https://github.com/envoyr/nginx-configurator.git
synced 2026-04-28 04:06:18 +00:00
Some PSR2 code styling and test coverage enabled
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
# for php-coveralls
|
||||
src_dir: src
|
||||
coverage_clover: tests/coverage/clover.xml
|
||||
json_path: tests/coverage/coveralls-upload.json
|
||||
21
build.xml
Normal file
21
build.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="nginx-configurator" default="test">
|
||||
<target name="test" depends="-lint,-phpspec,-phpunit,-phpcs">
|
||||
<exec command="bin/phpcov merge --clover tests/coverage/clover.xml tests/coverage/" checkreturn="true" passthru="true"/>
|
||||
<exec command="bin/coveralls" checkreturn="true" passthru="true"/>
|
||||
<exec command="bin/clover-dump --warning-percentage=70 --error-percentage=50 --fail-at=40 --ansi tests/coverage/clover.xml" checkreturn="true" passthru="true"/>
|
||||
<exec command="bin/phpcov merge --html=tests/coverage/raport tests/coverage/"/>
|
||||
</target>
|
||||
<target name="-lint" hidden="true">
|
||||
<exec command="bin/parallel-lint --exclude app --exclude vendor ." checkreturn="true" passthru="true"/>
|
||||
</target>
|
||||
<target name="-phpunit" hidden="true">
|
||||
<exec command="bin/phpunit --coverage-php tests/coverage/phpunit.cov tests" checkreturn="true" passthru="true"/>
|
||||
</target>
|
||||
<target name="-phpspec" hidden="true">
|
||||
<exec command="bin/phpspec run --format=pretty --no-code-generation" checkreturn="true" passthru="true"/>
|
||||
</target>
|
||||
<target name="-phpcs" hidden="true">
|
||||
<exec command="bin/phpcs --colors -wp src --report=summary --standard=PSR2,phpcs.xml" checkreturn="true" passthru="true"/>
|
||||
</target>
|
||||
</project>
|
||||
@@ -6,19 +6,20 @@
|
||||
"require": {
|
||||
"madkom/collection": "^1.0",
|
||||
"ferno/loco": "@dev",
|
||||
"madkom/uri": "^1.0"
|
||||
"madkom/uri": "^1.0",
|
||||
"henrikbjorn/phpspec-code-coverage": "1.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpspec/phpspec": "^2.5",
|
||||
"phpunit/phpunit": "~4",
|
||||
"knplabs/phpspec-welldone-extension": "dev-master",
|
||||
"henrikbjorn/phpspec-code-coverage": "1.0.*",
|
||||
"squizlabs/php_codesniffer": "^2.3",
|
||||
"phpunit/phpcov": "*",
|
||||
"jakub-onderka/php-parallel-lint": "0.*",
|
||||
"jakub-onderka/php-console-highlighter": "0.*",
|
||||
"satooshi/php-coveralls": "dev-master",
|
||||
"clover/dump": "dev-master"
|
||||
"clover/dump": "dev-master",
|
||||
"symfony/var-dumper": "^3.1"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
|
||||
10
phpspec.yml
10
phpspec.yml
@@ -1,5 +1,15 @@
|
||||
extensions:
|
||||
- PhpSpec\Extension\CodeCoverageExtension
|
||||
- Knp\PhpSpec\WellDone\Extension
|
||||
|
||||
suites:
|
||||
types:
|
||||
namespace: Madkom\NginxConfigurator
|
||||
psr4_prefix: Madkom\NginxConfigurator
|
||||
spec_path: tests
|
||||
|
||||
code_coverage:
|
||||
output: tests/coverage/phpspec.cov
|
||||
format: php
|
||||
|
||||
formatter.name: pretty
|
||||
@@ -5,15 +5,18 @@
|
||||
* Date: 10.06.16
|
||||
* Time: 14:25
|
||||
*/
|
||||
|
||||
namespace Madkom\NginxConfigurator\Command;
|
||||
|
||||
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* Class AddLocationCommand
|
||||
* @package Madkom\NginxConfigurator\Command
|
||||
* @author Michał Brzuchalski <m.brzuchalski@madkom.pl>
|
||||
*/
|
||||
class AddLocationCommand extends BaseCommand
|
||||
{
|
||||
protected function configure()
|
||||
@@ -23,11 +26,37 @@ class AddLocationCommand extends BaseCommand
|
||||
$this->setDescription("Adds location context and configuration");
|
||||
$this->addArgument('name', InputArgument::OPTIONAL, 'Server hostname:port', 'localhost:80');
|
||||
$this->addOption('internal', null, InputOption::VALUE_NONE, 'Adds internal directive');
|
||||
$this->addOption('proxy_pass', null, InputOption::VALUE_OPTIONAL, 'Adds proxy_pass url <comment>(eg. http://proxy/)</comment>');
|
||||
$this->addOption('proxy_bind', null, InputOption::VALUE_OPTIONAL, 'Adds proxy_bind directive url or variable <comment>(eg. $server_addr)</comment>');
|
||||
$this->addOption('proxy_redirect', null, InputOption::VALUE_OPTIONAL ^ InputOption::VALUE_IS_ARRAY, 'Adds proxy_redirect directive <comment>(eg. http://$host or https://$host)</comment>');
|
||||
$this->addOption('proxy_set_header', null, InputOption::VALUE_OPTIONAL ^ InputOption::VALUE_IS_ARRAY, 'Adds proxy_set_header directive <comment>(eg. "Content-Type: text/html"</comment>');
|
||||
$this->addOption('proxy_pass_request_body', null, InputOption::VALUE_OPTIONAL, 'Adds proxy_pass_requeest_body directive <comment>(on|off)</comment>', 'on');
|
||||
$this->addOption(
|
||||
'proxy_pass',
|
||||
null,
|
||||
InputOption::VALUE_OPTIONAL,
|
||||
'Adds proxy_pass url <comment>(eg. http://proxy/)</comment>'
|
||||
);
|
||||
$this->addOption(
|
||||
'proxy_bind',
|
||||
null,
|
||||
InputOption::VALUE_OPTIONAL,
|
||||
'Adds proxy_bind directive url or variable <comment>(eg. $server_addr)</comment>'
|
||||
);
|
||||
$this->addOption(
|
||||
'proxy_redirect',
|
||||
null,
|
||||
InputOption::VALUE_OPTIONAL ^ InputOption::VALUE_IS_ARRAY,
|
||||
'Adds proxy_redirect directive <comment>(eg. http://$host or https://$host)</comment>'
|
||||
);
|
||||
$this->addOption(
|
||||
'proxy_set_header',
|
||||
null,
|
||||
InputOption::VALUE_OPTIONAL ^ InputOption::VALUE_IS_ARRAY,
|
||||
'Adds proxy_set_header directive <comment>(eg. "Content-Type: text/html"</comment>'
|
||||
);
|
||||
$this->addOption(
|
||||
'proxy_pass_request_body',
|
||||
null,
|
||||
InputOption::VALUE_OPTIONAL,
|
||||
'Adds proxy_pass_requeest_body directive <comment>(on|off)</comment>',
|
||||
'on'
|
||||
);
|
||||
|
||||
// // new Directive('internal'),
|
||||
// new Directive('expires', [new Param('-1')]),
|
||||
|
||||
@@ -49,7 +49,7 @@ class AddServerCommand extends BaseCommand
|
||||
$config->append($server);
|
||||
|
||||
$builder = new Builder();
|
||||
$builder->appendServerNode($server);
|
||||
$builder->append($server);
|
||||
$builder->dumpFile($filename);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ class Parser extends Grammar
|
||||
* @throws GrammarException
|
||||
* @throws UnrecognizedContextException
|
||||
*/
|
||||
protected function parseSection($section, $space0 = null, $params, $open = null, $space1 = null, $directives) : Context
|
||||
protected function parseSection($section, $space0, $params, $open, $space1, $directives) : Context
|
||||
{
|
||||
switch ($section) {
|
||||
case 'server':
|
||||
|
||||
Reference in New Issue
Block a user