Permalink
Browse files

Merge branch 'master' of git@github.com:bricas/cpanhq

  • Loading branch information...
shlomif committed Jul 20, 2009
2 parents 2b8c93a + 77d4835 commit c5f87d96ac246c374402c996ac40403748893e36
Showing with 17 additions and 13 deletions.
  1. +3 −0 cpanhq.conf
  2. +13 −7 lib/CPANHQ/Controller/Distribution.pm
  3. +1 −6 root/dist/show.tt
View
@@ -3,3 +3,6 @@ name CPANHQ
connect_info dbi:SQLite:dbname=__HOME__/cpanhq.db
connect_info undef
</Model::DB>
+<Controller::Distribution>
+ graph_path __HOME__/root/dist/graph/
+</Controller::Distribution>
@@ -50,23 +50,29 @@ sub show : Chained(instance) : PathPart('') : Args(0) {
my $latest = $dist->latest_release;
$latest->_process_meta_yml();
- my $graph = Graph::Easy->new();
+ my $graph = Graph::Easy->new();
+ my $graph_output = File::Spec->catfile(
+ $c->config->{'Controller::Distribution'}->{graph_path},
+ $dist->name . '-' . $latest->version . '.png'
+ );
my $uses = $dist->uses;
my $dist_uses;
while ( my $use = $uses->next ) {
my $name = $use->dist_to->name;
push @$dist_uses, $name;
- $graph->add_edge(
- $latest->distribution->name,
- $name,
- );
+ $graph->add_edge( $latest->distribution->name, $name, );
+ }
+
+ if ( !-f $graph_output ) {
+ if ( open( my $png, '|-', 'dot -Tpng -o ' . $graph_output ) ) {
+ print $png $graph->as_graphviz;
+ close($png);
+ }
}
- my $graph_output = $graph->as_ascii();
$c->stash(
release => $latest,
title => $latest->name,
- graph => $graph_output,
uses => $dist_uses,
);
}
View
@@ -31,13 +31,8 @@
[% author = release.author %]
<p>By <a href="[% c.uri_for( '/author', author.cpanid ) %]">[% author.name %]</a>, released on [% release.release_date.ymd %]</p>
-[% IF graph %]
<h3 id="graph">Graph</h3>
-<pre>
-[% graph %]
-</pre>
-
-[% END %]
+<img src="/dist/graph/[% dist.name %]-[% release.version %].png" />
<h3 id="packages">Packages</h3>
<ul>

0 comments on commit c5f87d9

Please sign in to comment.