check repository response parameters
authorKen-ichi Mito <mitty@mitty.jp>
Wed, 21 Aug 2013 02:02:55 +0000 (11:02 +0900)
committerKen-ichi Mito <mitty@mitty.jp>
Wed, 21 Aug 2013 02:02:55 +0000 (11:02 +0900)
Dev/github/GitHubBackup.pm

index 73cf1d4..c202d1a 100644 (file)
@@ -166,6 +166,22 @@ sub full_name {
     return (shift)->{repos}{full_name};
 }
 
+sub has_downloads {
+    return (shift)->{repos}{has_downloads};
+}
+
+sub forks_count {
+    return (shift)->{repos}{forks_count};
+}
+
+sub has_wiki {
+    return (shift)->{repos}{has_wiki};
+}
+
+sub has_issues {
+    return (shift)->{repos}{has_issues};
+}
+
 sub directory {
     my $self = shift;
     
@@ -294,10 +310,10 @@ sub save_issues {
 sub backup {
     my $self = shift;
     
-    $self->clone_git;
-    $self->set_forks;
-    $self->clone_wiki;
-    $self->save_issues;
+    $self->clone_git   if ($self->has_downloads eq 'true');
+    $self->set_forks   if ($self->forks_count > 0);
+    $self->clone_wiki  if ($self->has_wiki eq 'true');
+    $self->save_issues if ($self->has_issues eq 'true');
     
     return $self;
 }