Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
only update bugs from github if the dist explicitly uses the github t…
…racker
  • Loading branch information
monken committed May 28, 2012
1 parent e2d6433 commit 7b45b0d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
14 changes: 7 additions & 7 deletions lib/MetaCPAN/Document/Release.pm
Expand Up @@ -191,13 +191,13 @@ sub predecessor {

sub find_github_based {
my $or = [
{ prefix => { "resources.homepage" => 'http://github.com/' } },
{ prefix => { "resources.homepage" => 'https://github.com/' } },
{ prefix => { "resources.repository.web" => 'http://github.com/' } },
{ prefix => { "resources.repository.web" => 'https://github.com/' } },
{ prefix => { "resources.repository.url" => 'http://github.com/' } },
{ prefix => { "resources.repository.url" => 'https://github.com/' } },
{ prefix => { "resources.repository.url" => 'git://github.com/' } },
# { prefix => { "resources.homepage" => 'http://github.com/' } },
# { prefix => { "resources.homepage" => 'https://github.com/' } },
# { prefix => { "resources.repository.web" => 'http://github.com/' } },
# { prefix => { "resources.repository.web" => 'https://github.com/' } },
# { prefix => { "resources.repository.url" => 'http://github.com/' } },
# { prefix => { "resources.repository.url" => 'https://github.com/' } },
# { prefix => { "resources.repository.url" => 'git://github.com/' } },
{ prefix => { "resources.bugtracker.web" => 'http://github.com/' } },
{ prefix => { "resources.bugtracker.web" => 'https://github.com/' } },
];
Expand Down
12 changes: 8 additions & 4 deletions lib/MetaCPAN/Script/Tickets.pm
Expand Up @@ -47,9 +47,11 @@ sub run {
my $bugs = {};
foreach my $source ( @{ $self->source } ) {
if ( $source eq 'github' ) {
log_debug {"Fetching GitHub issues"};
$bugs = { %$bugs, %{$self->retrieve_github_bugs} };
}
elsif ( $source eq 'rt' ) {
log_debug {"Fetching RT bugs"};
$bugs = { %$bugs, %{$self->retrieve_rt_bugs} };
}
}
Expand Down Expand Up @@ -77,16 +79,18 @@ sub retrieve_github_bugs {
my $self = shift;
my $scroll
= $self->index->type('release')->find_github_based->scroll;
log_debug {sprintf("Found %s repos", $scroll->total)};
my $summary = {};
while ( my $release = $scroll->next ) {
my $resources = $release->resources;
my ( $user, $repo, $source )
= $self->github_user_repo_from_resources($resources);
next unless $user;
next unless $user;
log_debug { "Retrieving issues from $user/$repo" };
my $open = $self->pithub->issues->list( user => $user, repo => $repo, params => { state => 'open' } );
last unless($open->success);
next unless($open->success);
my $closed = $self->pithub->issues->list( user => $user, repo => $repo, params => { state => 'closed' } );
last unless($closed->success);
next unless($closed->success);
$summary->{$release->{distribution}} = { open => 0, closed => 0, source => $source, type => 'github' };
$summary->{$release->{distribution}}->{open}++ while($open->next);
$summary->{$release->{distribution}}->{closed}++ while($closed->next);
Expand All @@ -99,7 +103,7 @@ sub github_user_repo_from_resources {
my ( $user, $repo, $source );
while ( my ( $k, $v ) = each %$resources ) {
if ( !ref $v
&& $v =~ /^(https?|git):\/\/github\.com\/([^\/]+)\/([^\/]+)\/?/ )
&& $v =~ /^(https?|git):\/\/github\.com\/([^\/]+)\/([^\/]+?)(\.git)?\/?$/ )
{
return ( $2, $3, $v );
}
Expand Down

0 comments on commit 7b45b0d

Please sign in to comment.