diff --git a/.coveralls.yml b/.coveralls.yml
index 35bf87e..585ab53 100644
--- a/.coveralls.yml
+++ b/.coveralls.yml
@@ -1,4 +1,3 @@
# for php-coveralls
-src_dir: src
coverage_clover: tests/coverage/clover.xml
json_path: tests/coverage/coveralls-upload.json
\ No newline at end of file
diff --git a/build.xml b/build.xml
new file mode 100644
index 0000000..f180712
--- /dev/null
+++ b/build.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/composer.json b/composer.json
index 05d8b1a..c79b942 100644
--- a/composer.json
+++ b/composer.json
@@ -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": [
{
diff --git a/phpspec.yml b/phpspec.yml
index 3db9e3b..b33a7fc 100644
--- a/phpspec.yml
+++ b/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
\ No newline at end of file
+ spec_path: tests
+
+code_coverage:
+ output: tests/coverage/phpspec.cov
+ format: php
+
+formatter.name: pretty
\ No newline at end of file
diff --git a/src/Command/AddLocationCommand.php b/src/Command/AddLocationCommand.php
index a70462c..76d1191 100644
--- a/src/Command/AddLocationCommand.php
+++ b/src/Command/AddLocationCommand.php
@@ -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
+ */
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 (eg. http://proxy/)');
- $this->addOption('proxy_bind', null, InputOption::VALUE_OPTIONAL, 'Adds proxy_bind directive url or variable (eg. $server_addr)');
- $this->addOption('proxy_redirect', null, InputOption::VALUE_OPTIONAL ^ InputOption::VALUE_IS_ARRAY, 'Adds proxy_redirect directive (eg. http://$host or https://$host)');
- $this->addOption('proxy_set_header', null, InputOption::VALUE_OPTIONAL ^ InputOption::VALUE_IS_ARRAY, 'Adds proxy_set_header directive (eg. "Content-Type: text/html"');
- $this->addOption('proxy_pass_request_body', null, InputOption::VALUE_OPTIONAL, 'Adds proxy_pass_requeest_body directive (on|off)', 'on');
+ $this->addOption(
+ 'proxy_pass',
+ null,
+ InputOption::VALUE_OPTIONAL,
+ 'Adds proxy_pass url (eg. http://proxy/)'
+ );
+ $this->addOption(
+ 'proxy_bind',
+ null,
+ InputOption::VALUE_OPTIONAL,
+ 'Adds proxy_bind directive url or variable (eg. $server_addr)'
+ );
+ $this->addOption(
+ 'proxy_redirect',
+ null,
+ InputOption::VALUE_OPTIONAL ^ InputOption::VALUE_IS_ARRAY,
+ 'Adds proxy_redirect directive (eg. http://$host or https://$host)'
+ );
+ $this->addOption(
+ 'proxy_set_header',
+ null,
+ InputOption::VALUE_OPTIONAL ^ InputOption::VALUE_IS_ARRAY,
+ 'Adds proxy_set_header directive (eg. "Content-Type: text/html"'
+ );
+ $this->addOption(
+ 'proxy_pass_request_body',
+ null,
+ InputOption::VALUE_OPTIONAL,
+ 'Adds proxy_pass_requeest_body directive (on|off)',
+ 'on'
+ );
// // new Directive('internal'),
// new Directive('expires', [new Param('-1')]),
@@ -40,7 +69,7 @@ class AddLocationCommand extends BaseCommand
protected function execute(InputInterface $input, OutputInterface $output)
{
-
+
$proxy_pass = $input->getOption('proxy_pass');
}
diff --git a/src/Command/AddServerCommand.php b/src/Command/AddServerCommand.php
index b6d8da9..f715f90 100644
--- a/src/Command/AddServerCommand.php
+++ b/src/Command/AddServerCommand.php
@@ -49,7 +49,7 @@ class AddServerCommand extends BaseCommand
$config->append($server);
$builder = new Builder();
- $builder->appendServerNode($server);
+ $builder->append($server);
$builder->dumpFile($filename);
}
}
diff --git a/src/Command/AddUpstreamServerCommand.php b/src/Command/AddUpstreamServerCommand.php
index cf9eefa..bc68fab 100644
--- a/src/Command/AddUpstreamServerCommand.php
+++ b/src/Command/AddUpstreamServerCommand.php
@@ -20,4 +20,4 @@ class AddUpstreamServerCommand extends BaseCommand
$this->setName('upstream:server:add');
$this->setDescription("Adds server directive to upstream context and configuration");
}
-}
\ No newline at end of file
+}
diff --git a/src/Command/RemoveUpstreamServerCommand.php b/src/Command/RemoveUpstreamServerCommand.php
index 98aa560..9a74c24 100644
--- a/src/Command/RemoveUpstreamServerCommand.php
+++ b/src/Command/RemoveUpstreamServerCommand.php
@@ -20,4 +20,4 @@ class RemoveUpstreamServerCommand extends BaseCommand
$this->setName('upstream:server:remove');
$this->setDescription("Removes server directive from upstream context and configuration");
}
-}
\ No newline at end of file
+}
diff --git a/src/Parser.php b/src/Parser.php
index c8ced97..590c7e8 100644
--- a/src/Parser.php
+++ b/src/Parser.php
@@ -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':
diff --git a/test.conf b/test.conf
new file mode 100644
index 0000000..ee014e2
--- /dev/null
+++ b/test.conf
@@ -0,0 +1,11 @@
+server {
+ listen 90;
+ listen [::]:90 default ipv6only=on;
+ server_name test-ms;
+}
+
+server {
+ listen 90;
+ listen [::]:90 default ipv6only=on;
+ server_name test-ms;
+}