Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Pôle IS
Bundles Symfony 2
plantuml-bundle
Commits
c80e08d3
Commit
c80e08d3
authored
May 12, 2016
by
Guillaume Perréal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Améliore la sortie de la commande render.
parent
5eb72831
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
12 deletions
+23
-12
Command/RenderCommand.php
Command/RenderCommand.php
+23
-12
No files found.
Command/RenderCommand.php
View file @
c80e08d3
...
...
@@ -14,6 +14,7 @@ use Symfony\Component\Console\Input\InputArgument;
use
Symfony\Component\Console\Input\InputInterface
;
use
Symfony\Component\Console\Input\InputOption
;
use
Symfony\Component\Console\Output\OutputInterface
;
use
Symfony\Component\Console\Style\SymfonyStyle
;
use
Symfony\Component\Filesystem\Filesystem
;
use
Symfony\Component\Process\ProcessBuilder
;
use
Symfony\Component\Security\Core\Exception\InvalidArgumentException
;
...
...
@@ -48,35 +49,45 @@ class RenderCommand extends ContainerAwareCommand
$format
=
$input
->
getOption
(
'format'
)
?:
$this
->
getContainer
()
->
getParameter
(
'irstea_plant_uml.output.format'
);
$outputDir
=
$input
->
getOption
(
'output'
)
?:
$this
->
getContainer
()
->
getParameter
(
'irstea_plant_uml.output.directory'
);
$io
=
new
SymfonyStyle
(
$input
,
$output
);
foreach
(
$graphs
as
$name
)
{
$target
=
$outputDir
.
DIRECTORY_SEPARATOR
.
$name
.
"."
.
$format
;
$output
->
writeln
(
"Graphe:
$name
=>
$target
."
);
$io
->
section
(
"Graphe:
$name
"
);
$graph
=
$this
->
getContainer
()
->
get
(
"irstea_plant_uml.graph.
$name
"
);
$this
->
renderGraph
(
$graph
,
$target
,
$format
,
$output
);
$this
->
renderGraph
(
$graph
,
$target
,
$format
,
$io
);
}
}
protected
function
renderGraph
(
Graph
$graph
,
$target
,
$format
,
OutputInterface
$output
)
protected
function
renderGraph
(
Graph
$graph
,
$target
,
$format
,
SymfonyStyle
$io
)
{
$output
->
write
(
"Exploration des classes: "
);
$io
->
writeln
(
"Fichier de sortie: <comment>
$target
</comment>"
);
$io
->
write
(
"Exploration des classes: "
);
$graph
->
visitAll
();
$o
utput
->
writeln
(
"
Ok
."
);
$
i
o
->
writeln
(
"
<info>Ok</info>
."
);
$o
utput
->
write
(
"Démarrage de PlantUML: "
);
$
i
o
->
write
(
"Démarrage de PlantUML: "
);
list
(
$proc
,
$pipes
)
=
$this
->
startProcess
(
$target
,
$format
);
$o
utput
->
writeln
(
"
Ok
."
);
$
i
o
->
writeln
(
"
<info>Ok</info>
."
);
$o
utput
->
write
(
"Génération du graphe: "
);
$
i
o
->
write
(
"Génération du graphe: "
);
$writer
=
new
StreamWriter
(
$pipes
[
0
]);
$graph
->
writeTo
(
$writer
);
fclose
(
$pipes
[
0
]);
$o
utput
->
writeln
(
"
Ok
."
);
$
i
o
->
writeln
(
"
<info>Ok</info>
."
);
$o
utput
->
write
(
"Attente de PlantUML: "
);
$
i
o
->
write
(
"Attente de PlantUML: "
);
$res
=
proc_close
(
$proc
);
$output
->
writeln
(
"Ok."
);
dump
(
$res
);
if
(
$res
===
0
)
{
$io
->
writeln
(
"<info>Ok</info>."
);
}
else
{
$io
->
writeln
(
"<error>Nok</error>."
);
}
}
protected
function
startProcess
(
$target
,
$format
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment