chore: Update dependencies

This commit is contained in:
jubianchi 2018-01-20 10:41:27 +01:00
parent 27758c0f0a
commit f6f67be46c
No known key found for this signature in database
GPG key ID: 5D9C896D2AA9E390
7 changed files with 660 additions and 172 deletions

1
.gitignore vendored
View file

@ -4,3 +4,4 @@ bin/
!bin/dcv
!bin/entrypoint.sh
.cache/
.php_cs.cache

13
.php_cs
View file

@ -1,12 +1,15 @@
<?php
$finder = Symfony\CS\Finder\DefaultFinder::create()
->exclude('somedir')
use PhpCsFixer as CS;
$finder = CS\Finder::create()
->in(__DIR__.DIRECTORY_SEPARATOR.'src')
->in(__DIR__.DIRECTORY_SEPARATOR.'spec')
;
return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
->finder($finder)
return CS\Config::create()
->setRules([
'@Symfony' => true,
])
->setFinder($finder)
;

View file

@ -8,12 +8,14 @@ services:
php:
- 7.0
- 7.1
- 7.2
- nightly
env:
matrix:
- COMPOSERFLAGS=
- COMPOSERFLAGS=--prefer-lowest
- COMPOSERFLAGS=--prefer-stable
global:
# DOCKER_EMAIL
@ -29,6 +31,8 @@ matrix:
env: COMPOSERFLAGS=
- php: 7.1
env: COMPOSERFLAGS=--prefer-lowest
- php: 7.2
env: COMPOSERFLAGS=--prefer-lowest
- php: nightly
env: COMPOSERFLAGS=--prefer-lowest
allow_failures:

View file

@ -2,14 +2,15 @@
"name": "pmsipilot/docker-compose-viz",
"description": "Docker compose graph visualization",
"require": {
"symfony/yaml": "^3.1 || ^4@dev",
"php": "^7",
"symfony/yaml": "^3.1 || ^4",
"symfony/console": "^3.1",
"clue/graph": "^0.9",
"graphp/graphviz": "^0.2"
},
"require-dev": {
"crysalead/kahlan": "^2.5.4",
"friendsofphp/php-cs-fixer": "^1.11"
"friendsofphp/php-cs-fixer": "^2"
},
"license": "MIT",
"authors": [

731
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -26,7 +26,7 @@ $application->register('render')
->setCode(function (Console\Input\InputInterface $input, Console\Output\OutputInterface $output) {
$backgroundColor = $input->getOption('background');
if (preg_match('/^#[a-fA-F0-9]{6}|transparent$/', $backgroundColor) === 0) {
if (0 === preg_match('/^#[a-fA-F0-9]{6}|transparent$/', $backgroundColor)) {
throw new Console\Exception\InvalidArgumentException(sprintf('Invalid background color "%s". It must be a valid hex color or "transparent".', $backgroundColor));
}
@ -36,19 +36,19 @@ $application->register('render')
$overrideFile = dirname($inputFile).DIRECTORY_SEPARATOR.basename($inputFile, '.'.$inputFileExtension).'.'.$input->getOption('override').'.'.$inputFileExtension;
$outputFormat = $input->getOption('output-format');
$outputFile = $input->getOption('output-file') ?: getcwd().DIRECTORY_SEPARATOR.'docker-compose.'.($outputFormat === 'dot' ? $outputFormat : 'png');
$outputFile = $input->getOption('output-file') ?: getcwd().DIRECTORY_SEPARATOR.'docker-compose.'.('dot' === $outputFormat ? $outputFormat : 'png');
$onlyServices = $input->getOption('only');
if (in_array($outputFormat, ['dot', 'image', 'display']) === false) {
if (false === in_array($outputFormat, ['dot', 'image', 'display'])) {
throw new Console\Exception\InvalidArgumentException(sprintf('Invalid output format "%s". It must be one of "dot", "image" or "display".', $outputFormat));
}
if ($outputFormat === 'display') {
if ('display' === $outputFormat) {
if ($input->getOption('force') || $input->getOption('output-file')) {
$output->writeln('<comment>The following options are ignored with the "display" output format: "--force", "--output-file"</comment>');
}
} else {
if (file_exists($outputFile) === true && $input->getOption('force') === false) {
if (true === file_exists($outputFile) && false === $input->getOption('force')) {
throw new Console\Exception\InvalidArgumentException(sprintf('File "%s" already exists. Use the "--force" option to overwrite it.', $outputFile));
}
}
@ -103,19 +103,19 @@ $application->register('render')
}
$flags = 0;
if ($input->getOption('no-volumes') === true) {
if (true === $input->getOption('no-volumes')) {
$logger('<comment>Volumes</comment> will not be displayed');
$flags |= WITHOUT_VOLUMES;
}
if ($input->getOption('no-networks') === true) {
if (true === $input->getOption('no-networks')) {
$logger('<comment>Networks</comment> will not be displayed');
$flags |= WITHOUT_NETWORKS;
}
if ($input->getOption('no-ports') === true) {
if (true === $input->getOption('no-ports')) {
$logger('<comment>Ports</comment> will not be displayed');
$flags |= WITHOUT_PORTS;

View file

@ -36,7 +36,7 @@ function logger(OutputInterface $output) : callable
*/
function readConfiguration(string $path): array
{
if (file_exists($path) === false) {
if (false === file_exists($path)) {
throw new \InvalidArgumentException(sprintf('File "%s" does not exist', $path));
}
@ -56,7 +56,7 @@ function readConfiguration(string $path) : array
*/
function fetchServices(array $configuration): array
{
if (isset($configuration['version']) === false || (int) $configuration['version'] === 1) {
if (false === isset($configuration['version']) || 1 === (int) $configuration['version']) {
return $configuration;
}
@ -72,7 +72,7 @@ function fetchServices(array $configuration) : array
*/
function fetchVolumes(array $configuration): array
{
if (isset($configuration['version']) === false || (int) $configuration['version'] === 1) {
if (false === isset($configuration['version']) || 1 === (int) $configuration['version']) {
return [];
}
@ -88,7 +88,7 @@ function fetchVolumes(array $configuration) : array
*/
function fetchNetworks(array $configuration): array
{
if (isset($configuration['version']) === false || (int) $configuration['version'] === 1) {
if (false === isset($configuration['version']) || 1 === (int) $configuration['version']) {
return [];
}
@ -127,7 +127,7 @@ function applyGraphvizStyle(Graph $graph, bool $horizontal, string $background)
$graph->setAttribute('graphviz.graph.pad', '0.5');
$graph->setAttribute('graphviz.graph.ratio', 'fill');
if ($horizontal === true) {
if (true === $horizontal) {
$graph->setAttribute('graphviz.graph.rankdir', 'LR');
}
@ -158,7 +158,7 @@ function applyGraphvizStyle(Graph $graph, bool $horizontal, string $background)
case 'port':
$vertex->setAttribute('graphviz.shape', 'circle');
if (($proto = $vertex->getAttribute('docker_compose.proto')) === 'udp') {
if ('udp' === ($proto = $vertex->getAttribute('docker_compose.proto'))) {
$vertex->setAttribute('graphviz.style', 'dashed');
}
break;
@ -193,10 +193,10 @@ function applyGraphvizStyle(Graph $graph, bool $horizontal, string $background)
break;
}
if (($alias = $edge->getAttribute('docker_compose.alias')) !== null) {
if (null !== ($alias = $edge->getAttribute('docker_compose.alias'))) {
$edge->setAttribute('graphviz.label', $alias);
if ($edge->getAttribute('docker_compose.condition') !== null) {
if (null !== $edge->getAttribute('docker_compose.condition')) {
$edge->setAttribute('graphviz.fontsize', '10');
}
}
@ -222,17 +222,17 @@ function applyGraphvizStyle(Graph $graph, bool $horizontal, string $background)
*/
function makeVerticesAndEdges(Graph $graph, array $services, array $volumes, array $networks, string $path, int $flags): Graph
{
if (((bool) ($flags & WITHOUT_VOLUMES)) === false) {
if (false === ((bool) ($flags & WITHOUT_VOLUMES))) {
foreach (array_keys($volumes) as $volume) {
addVolume($graph, 'named: '.$volume);
}
}
if (((bool) ($flags & WITHOUT_NETWORKS)) === false) {
if (false === ((bool) ($flags & WITHOUT_NETWORKS))) {
foreach ($networks as $network => $definition) {
addNetwork(
$graph, 'net: '.$network,
isset($definition['external']) && $definition['external'] === true ? 'external_network' : 'network'
isset($definition['external']) && true === $definition['external'] ? 'external_network' : 'network'
);
}
}
@ -302,7 +302,7 @@ function makeVerticesAndEdges(Graph $graph, array $services, array $volumes, arr
);
}
if (((bool) ($flags & WITHOUT_VOLUMES)) === false) {
if (false === ((bool) ($flags & WITHOUT_VOLUMES))) {
$serviceVolumes = [];
foreach ($definition['volumes'] ?? [] as $volume) {
@ -314,7 +314,7 @@ function makeVerticesAndEdges(Graph $graph, array $services, array $volumes, arr
foreach ($serviceVolumes as $container => $volume) {
list($host, $attr) = $volume;
if ($host[0] !== '.' && $host[0] !== DIRECTORY_SEPARATOR) {
if ('.' !== $host[0] && DIRECTORY_SEPARATOR !== $host[0]) {
$host = 'named: '.$host;
}
@ -323,12 +323,12 @@ function makeVerticesAndEdges(Graph $graph, array $services, array $volumes, arr
$graph->getVertex($service),
'volumes',
$host !== $container ? $container : null,
$attr !== 'ro'
'ro' !== $attr
);
}
}
if (((bool) ($flags & WITHOUT_PORTS)) === false) {
if (false === ((bool) ($flags & WITHOUT_PORTS))) {
foreach ($definition['ports'] ?? [] as $port) {
list($host, $container, $proto) = explodeMapping($port);
@ -341,7 +341,7 @@ function makeVerticesAndEdges(Graph $graph, array $services, array $volumes, arr
}
}
if (((bool) ($flags & WITHOUT_NETWORKS)) === false) {
if (false === ((bool) ($flags & WITHOUT_NETWORKS))) {
foreach ($definition['networks'] ?? [] as $network => $config) {
$network = is_int($network) ? $config : $network;
$config = is_int($network) ? [] : $config;
@ -371,7 +371,7 @@ function makeVerticesAndEdges(Graph $graph, array $services, array $volumes, arr
*/
function addService(Graph $graph, string $service, string $type = null)
{
if ($graph->hasVertex($service) === true) {
if (true === $graph->hasVertex($service)) {
return $graph->getVertex($service);
}
@ -392,7 +392,7 @@ function addService(Graph $graph, string $service, string $type = null)
*/
function addPort(Graph $graph, int $port, string $proto = null)
{
if ($graph->hasVertex($port) === true) {
if (true === $graph->hasVertex($port)) {
return $graph->getVertex($port);
}
@ -413,7 +413,7 @@ function addPort(Graph $graph, int $port, string $proto = null)
*/
function addVolume(Graph $graph, string $path)
{
if ($graph->hasVertex($path) === true) {
if (true === $graph->hasVertex($path)) {
return $graph->getVertex($path);
}
@ -434,7 +434,7 @@ function addVolume(Graph $graph, string $path)
*/
function addNetwork(Graph $graph, string $name, string $type = null)
{
if ($graph->hasVertex($name) === true) {
if (true === $graph->hasVertex($name)) {
return $graph->getVertex($name);
}
@ -476,7 +476,7 @@ function addRelation(Vertex $from, Vertex $to, string $type, string $alias = nul
$edge->setAttribute('docker_compose.type', $type);
if ($alias !== null) {
if (null !== $alias) {
$edge->setAttribute('docker_compose.alias', $alias);
}