diff --git a/README.markdown b/README.markdown index 42991cc..188d59f 100644 --- a/README.markdown +++ b/README.markdown @@ -5,7 +5,15 @@ By Chris Lockfort (devnull@csh.rit.edu) (Github username: Clockfort) GitHub-Backup makes a local backup copy of all of a github user's (or github organization's) repositories. -This is useful in many cases: +Usage +----- +"./github-backup.pl USERNAME BACKUP_DIRECTORY" + +Then, put it in a cron job somewhere and forget about it for eternity. + +Why This Software Exists +------------------------- +This software is useful in many cases: - GitHub suddenly explodes. @@ -18,10 +26,6 @@ This is useful in many cases: - You are paranoid tinfoil-hat wearer who needs to back up everything in triplicate on a variety of outdated tape media. -Usage ------ -"./github-backup.pl USERNAME BACKUP_DIRECTORY" - Questions, Improvements, Etc ----------------------------- diff --git a/github-backup.pl b/github-backup.pl index 11d8555..567035c 100755 --- a/github-backup.pl +++ b/github-backup.pl @@ -16,10 +16,6 @@ my @giturls = grep s/ :url: http/git/, @urls; @urls = @giturls; my @reponames = grep s/.*$username\///, @giturls; -foreach my $name (@reponames){ - print "NAME: $name\n"; -} - for(my $i = 0; $i < @urls; ++$i){ my $url = $urls[$i]; my $name = $reponames[$i]; @@ -27,11 +23,11 @@ for(my $i = 0; $i < @urls; ++$i){ system("mkdir $backupdir") and die "Couldn't make $backupdir.\n"; } unless(-e "$backupdir/$name"){ #We haven't backed this up before, let's clone it - print "CLONING $url\n"; + print "CLONING REPOSITORY: $url\n"; system("cd backups && git clone $url") and die "Encountered an error while git-cloning repository $name\n"; } else{ #We've backed it up before, just fetch the most recent copy - print "EXISTED, FETCHING $name\n"; + print "REPOSITORY EXISTED, FETCHING: $name\n"; system("cd $backupdir/$name && git fetch -q") and die "Encountered an error while git-fetching repository $name\n"; } }