Skip to content

Commit 8fd475b

Browse files
committed
River script - support json through file
1 parent 2e6623f commit 8fd475b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

bin/river.pl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,23 @@
33
use v5.36;
44

55
use Cpanel::JSON::XS qw< decode_json >;
6+
use Getopt::Long;
7+
use Path::Tiny qw< path >;
68

79
use MetaCPAN::Logger qw< :log :dlog >;
810

911
use MetaCPAN::ES;
1012
use MetaCPAN::Ingest qw< read_url >;
1113

14+
# args
15+
my ( $json );
16+
GetOptions(
17+
"json=s" => \$json,
18+
);
19+
1220
# setup
1321
my $river_url //= 'https://neilb.org/river-of-cpan.json.gz';
14-
my $river_data = decode_json( read_url($river_url) );
22+
my $river_data = decode_json( $json ? path($json)->slurp : read_url($river_url) );
1523

1624
my $es = MetaCPAN::ES->new( index => "distribution" );
1725
my $bulk = $es->bulk();

0 commit comments

Comments
 (0)