Created
January 11, 2024 12:13
-
-
Save CodeBySwati/69656286d4c80fdeba9c416c319d10f7 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