Changeset 49aca65 in lab.git for Dev/github/GitHubBackup.pm
- Timestamp:
- Aug 19, 2013 10:58:01 AM (11 years ago)
- Branches:
- master
- Children:
- d51047d
- Parents:
- 55d0513
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/github/GitHubBackup.pm
r55d0513 r49aca65 7 7 use LWP::UserAgent; 8 8 use JSON; 9 my $ua = LWP::UserAgent->new;10 my $json = JSON->new->utf8->indent;11 9 12 10 sub json_api { 13 11 my $url = shift; 12 13 my $ua = LWP::UserAgent->new; 14 my $json = JSON->new->utf8->indent; 14 15 15 16 my $res = $ua->get( … … 150 151 use File::Spec; 151 152 use File::Path qw(mkpath); 153 use LWP::UserAgent; 154 use JSON; 155 152 156 153 157 sub new { … … 266 270 my $self = shift; 267 271 268 $self->issues; 272 my $ua = LWP::UserAgent->new; 273 my $json = JSON->new->utf8->indent; 274 275 my $dir = $self->directory . '.issues'; 276 mkpath $dir unless (-d $dir); 277 local $CWD = $dir; 278 foreach my $issue (@{$self->issues}) { 279 my $number = $issue->{number}; 280 print "save issue/$number\n"; 281 282 open my $fh, ">$number.json"; 283 print $fh $json->encode($issue); 284 close $fh; 285 286 if (exists $issue->{pull_request}{patch_url}) { 287 $ua->mirror($issue->{pull_request}{patch_url} => "$number.patch"); 288 } 289 } 290 291 return $self; 269 292 } 270 293
Note: See TracChangeset
for help on using the changeset viewer.