From 1774a184943070ba9c892a30bc563d073209c97d Mon Sep 17 00:00:00 2001 From: franck cuny Date: Sat, 30 Jan 2010 16:35:44 +0100 Subject: start to gen. gexf --- lib/githubexplorer/Gexf.pm | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'lib/githubexplorer') diff --git a/lib/githubexplorer/Gexf.pm b/lib/githubexplorer/Gexf.pm index a82a741..0d814f0 100644 --- a/lib/githubexplorer/Gexf.pm +++ b/lib/githubexplorer/Gexf.pm @@ -3,6 +3,8 @@ package githubexplorer::Gexf; use Moose; use XML::Simple; +has schema => (is => 'ro', isa => 'Object', required => 1); + has graph => ( is => 'rw', isa => 'HashRef', @@ -16,7 +18,23 @@ has graph => ( attributes => { class => 'node', type => 'static', - attribute => [ { id => 0, type => 'string' } ] + attribute => [ + { + id => 0, + type => 'string', + title => 'totalrepo' + }, + { + id => 1, + type => 'string', + title => 'accountlogin' + }, + { + id => 2, + type => 'string', + title => 'forkedrepo' + }, + ] } } } @@ -24,4 +42,24 @@ has graph => ( } ); +sub profiles { + my $self = shift; + my $profiles = $self->schema->resultset('Profiles')->search(); + + while ( my $profile = $profiles->next ) { + my $node = { + id => $profile->name, + label => $profile->name, + attvalues => [ + { id => 0, value => 'total' }, + { id => 1, $profile->name }, + { id => 2, 'forked' } + ] + }; + push @{ $self->graph->{gexf}->{graph}->{nodes}->{node} }, $node; + } + use YAML::Syck; + warn Dump $self->graph; +} + 1; -- cgit v1.2.3