| 1 | package CloudDeploy::CommandLine::Diagram { | ||
| 2 | use MooseX::App; | ||
| 3 | use CloudDeploy::Utils; | ||
| 4 | |||
| 5 | parameter deploy_class => (is => 'ro', isa => 'Str', required => 1); | ||
| 6 | |||
| 7 | sub run { | ||
| 8 | my ($self) = @_; | ||
| 9 | |||
| 10 | my $module = load_class($self->deploy_class); | ||
| 11 | my $obj = $module->{class}->new(params => $module->{params_class}->new_with_options(argv => $self->extra_argv)); | ||
| 12 | |||
| 13 | print "digraph diagrama {\n"; | ||
| 14 | foreach my $r_name ($obj->ResourceList) { | ||
| 15 | my $r = $obj->Resource($r_name); | ||
| 16 | foreach my $dep (@{ $r->dependencies }){ | ||
| 17 | print "$r_name -> $dep;\n"; | ||
| 18 | } | ||
| 19 | } | ||
| 20 | print "}\n"; | ||
| 21 | } | ||
| 22 | } | ||
| 23 | |||
| 24 | 1; |