Created
August 25, 2011 11:54
-
-
Save DamianZaremba/1170502 to your computer and use it in GitHub Desktop.
Gist update script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl5.12.4 | |
use JSON; | |
use LWP::Simple; | |
use Cwd; | |
my $data = get "http://gist.github.com/api/v1/json/gists/damianzaremba"; | |
my $json = decode_json($data); | |
my $gists = $json->{"gists"}; | |
for my $gist (@$gists) { | |
my $name = $gist->{'repo'} . ' - ' . $gist->{'description'}; | |
print "Getting: " . $name . "\n"; | |
if( -d $name ) { | |
chdir($name); | |
qx(git pull); | |
chdir("../"); | |
} else { | |
my $repo_url = 'ssh://[email protected]:22/' . $gist->{'repo'} . '.git'; | |
$name =~ s/"/\\"/g; | |
qx(git clone '$repo_url' "$name"); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment