return $path;
}
+sub message {
+ my $self = shift;
+ my $message = shift;
+
+ print $self->full_name, " $message\n";
+
+ return $self;
+}
+
sub sync {
my $self = shift;
my $url = shift;
if (-d "$dir") {
local $CWD = $dir;
- print "fetch $dir\n";
+ $self->message("++> $dir");
Git::Repository->run(fetch => '--all');
return $self;
}
- print "clone $dir\n";
+ $self->message("==> $dir");
mkpath $dir;
Git::Repository->run(clone => '--mirror' => $url => $dir);
my @fetch;
foreach my $fork (@{$self->forks}) {
if ($remotes =~ /$fork->{full_name}/) {
- print "skip ", $fork->{full_name}, "\n";
+ $self->message("--- ". $fork->{full_name});
next;
}
- print "add ", $fork->{full_name}, "\n";
+ $self->message("+++ ". $fork->{full_name});
Git::Repository->run(remote => add => $fork->{full_name} => $fork->{clone_url});
push @fetch, $fork->{full_name};
}
foreach my $fork (@fetch) {
- print "fetch $fork\n";
+ $self->message("--> $fork");
Git::Repository->run(fetch => $fork);
}
'https://github.com/' . $self->full_name . '/wiki'
);
if ($res->code != 200) {
- print "$dir does not exist\n";
+ $self->message("wiki does not exist");
return $self;
}
local $CWD = $dir;
foreach my $issue (@{$self->issues}) {
my $number = $issue->{number};
- print "save issue/$number\n";
+ $self->message("+++ issue/$number");
open my $fh, ">$number.json";
print $fh $json->encode($issue);