Permalink
Browse files

Update ecosystem JSON atomically

Fixes #345
  • Loading branch information...
zoffixznet committed Jun 10, 2017
1 parent af1861c commit ffe71f7583e5ec8ca8ee38f438d00ff78ade6444
Showing with 9 additions and 8 deletions.
  1. +9 −8 server/updatelist.pl
@@ -7,6 +7,7 @@
use autodie;
use File::Spec;
use FindBin;
use File::AtomicWrite;
use Data::Dumper;

$|++;
@@ -52,17 +53,17 @@
}
}
close $fh;
#unlink 'metalist';

for my $basename ('projects.json', 'list') {
open $fh, '>', File::Spec->catfile($OUTDIR, $basename);
print $fh encode_json \@modules;
close $fh;
File::AtomicWrite->write_file({
file => File::Spec->catfile($OUTDIR, $basename),
input => \encode_json(\@modules),
});
}

open $fh, '>', File::Spec->catfile($OUTDIR, 'errors.json');
print $fh JSON::XS->new->pretty(1)->encode(\@errors);
close $fh;
File::AtomicWrite->write_file({
file => File::Spec->catfile($OUTDIR, 'errors.json'),
input => \JSON::XS->new->pretty(1)->encode(\@errors),
});

sub _normalize_module {
my $module = shift;

0 comments on commit ffe71f7

Please sign in to comment.