- Timestamp:
- Aug 18, 2013 4:55:43 AM (11 years ago)
- Branches:
- master
- Children:
- 6f31bfb
- Parents:
- b8d7413
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/github/GitHubBackup.pm
rb8d7413 r19df400 33 33 __PACKAGE__->mk_accessors( qw( 34 34 directory 35 account36 repository37 35 )); 38 36 … … 48 46 49 47 return $class->SUPER::new($args); 48 } 49 50 sub account { 51 my $self = shift; 52 my $args = shift; 53 54 if (defined $args) { 55 $self->{repos} = undef; 56 $self->{account} = $args; 57 } 58 59 return $self->{account}; 60 } 61 62 sub repository { 63 my $self = shift; 64 my $args = shift; 65 66 if (defined $args) { 67 $self->{repos} = undef; 68 $self->{repository} = $args; 69 } 70 71 return $self->{repository}; 50 72 } 51 73 … … 92 114 } 93 115 116 sub backup { 117 my $self = shift; 118 119 foreach my $repos (@{$self->repos}) { 120 $repos->backup; 121 } 122 123 return $self; 124 } 125 94 126 95 127 package GitHubBackup::Repository; … … 128 160 if (-d "$dir") { 129 161 local $CWD = $dir; 130 print "fetch ", $ self->{full_name}, "\n";162 print "fetch ", $dir, "\n"; 131 163 Git::Repository->run(fetch => '--all'); 132 164 return $self; 133 165 } 134 166 135 print "clone ", $ self->{full_name}, "\n";167 print "clone ", $dir, "\n"; 136 168 Git::Repository->run(clone => '--mirror' => $self->{clone_url} => $dir); 137 169 return $self; … … 150 182 } 151 183 184 sub backup { 185 my $self = shift; 186 187 $self->clone_git; 188 $self->set_forks; 189 $self->clone_wiki; 190 $self->save_issues; 191 192 return $self; 193 } 152 194 153 195
Note: See TracChangeset
for help on using the changeset viewer.