summaryrefslogtreecommitdiffstats
path: root/bin/git
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-03-19 21:00:24 -0400
committerJesse Luehrs <doy@tozt.net>2014-03-19 21:01:08 -0400
commit3fd98c365894218b0fb48b494b1835d299e43edb (patch)
tree64fbeb4c117e1afd567fef3b37421310e776dfdf /bin/git
parent0fc007f9ce16f6fdd7c19da6f9dd9f516da2f850 (diff)
downloadconf-3fd98c365894218b0fb48b494b1835d299e43edb.tar.gz
conf-3fd98c365894218b0fb48b494b1835d299e43edb.zip
this is broken, and ph includes this functionality these days
Diffstat (limited to 'bin/git')
-rwxr-xr-xbin/git/git-github-mirror57
1 files changed, 0 insertions, 57 deletions
diff --git a/bin/git/git-github-mirror b/bin/git/git-github-mirror
deleted file mode 100755
index b3d38a2..0000000
--- a/bin/git/git-github-mirror
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/env perl
-use strict;
-use warnings;
-use 5.010;
-
-use Getopt::Long;
-use HTTP::Request;
-use JSON;
-use LWP::UserAgent;
-use Pithub;
-use Term::ReadKey;
-
-GetOptions(
- "mirror" => \(my $mirror),
- "all" => \(my $all),
-);
-
-sub git {
- my ($cmd) = @_;
- `git $cmd`;
- return $? == 0;
-}
-
-my ($user) = @ARGV;
-die "user required" unless defined $user;
-
-print "Password: ";
-Term::ReadKey::ReadMode(2);
-chomp(my $pass = <STDIN>);
-Term::ReadKey::ReadMode(0);
-print "\n";
-
-my $ua = LWP::UserAgent->new;
-my $req = HTTP::Request->new(
- POST => 'https://api.github.com/authorizations',
-);
-$req->content('{}');
-$req->authorization_basic($user, $pass);
-my $res = $ua->request($req);
-if (!$res->is_success) {
- require Data::Dumper; die Data::Dumper::Dumper($res);
-}
-my $token = JSON::decode_json($res->content)->{token};
-
-my $ph = Pithub->new(token => $token, ua => $ua, auto_pagination => 1);
-my $rows = $ph->repos->list(user => $user);
-while (my $row = $rows->next) {
- next unless $all || !$row->{fork};
- if (!-e $row->{name}) {
- print "Cloning $row->{name}\n";
- my $opts = $mirror ? "--mirror" : "";
- git "clone $opts $row->{ssh_url}";
- }
- else {
- print "Skipping $row->{name}\n";
- }
-}