From 871336c030209b46ae6b124a702677363487f9a8 Mon Sep 17 00:00:00 2001 From: franck cuny Date: Mon, 13 Jun 2011 16:33:23 +0200 Subject: import github::collector Signed-off-by: franck cuny --- lib/GitHub/Collector/Command/repository.pm | 44 ++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 lib/GitHub/Collector/Command/repository.pm (limited to 'lib/GitHub/Collector/Command/repository.pm') diff --git a/lib/GitHub/Collector/Command/repository.pm b/lib/GitHub/Collector/Command/repository.pm new file mode 100644 index 0000000..3e7fd57 --- /dev/null +++ b/lib/GitHub/Collector/Command/repository.pm @@ -0,0 +1,44 @@ +package GitHub::Collector::Command::repository; + +use Moose; +use boolean; + +extends qw(MooseX::App::Cmd::Command); + +with qw( + GitHub::Collector::Role::Context + GitHub::Collector::Role::Logger + GitHub::Collector::Role::SPORE + GitHub::Collector::Role::MongoDB + GitHub::Collector::Role::Repository +); + +sub execute { + my $self = shift; + + $self->log("start to crawl repositories"); + $self->_crawl(); + $self->log("crawl completed"); +} + +sub get_repositories { + my ($self, $profile) = @_; + + my $login = $profile->{login}; + + $self->log("fetch repositories for $login"); + $self->fetch_repositories($profile); + $self->log("finished to work on $login"); +} + +sub _crawl { + my $self = shift; + + my $profiles = $self->db_profiles->find( { repositories_done => false } ); + + while ( my $profile = $profiles->next ) { + $self->get_repositories($profile); + } +} + +1; -- cgit v1.2.3