Skip to content

Commit

Permalink
Merge pull request #17 from metacpan/mickey/fix_scripts
Browse files Browse the repository at this point in the history
load MetaCPAN::Util in example scripts
  • Loading branch information
oalders committed Dec 12, 2016
2 parents 99ad835 + 391927b commit baf6fe7
Show file tree
Hide file tree
Showing 27 changed files with 38 additions and 22 deletions.
10 changes: 3 additions & 7 deletions scripts/author/1-fetch-single-author-es.pl
Expand Up @@ -4,15 +4,11 @@
use warnings;

use Data::Printer;
use Search::Elasticsearch;

my $es = Search::Elasticsearch->new(
cxn_pool => 'Static::NoPing',
nodes => 'fastapi.metacpan.org',
trace_to => 'Stdout',
);
use lib './lib';
use MetaCPAN::Util qw( es );

my $author = $es->get(
my $author = es->get(
index => 'cpan',
type => 'author',
id => 'MSTROUT',
Expand Down
1 change: 1 addition & 0 deletions scripts/author/1b-scroll-all-authors-es.pl
Expand Up @@ -4,6 +4,7 @@
use warnings;

use Data::Printer;
use lib './lib';
use MetaCPAN::Util qw( es );

my $scroller = es()->scroll_helper(
Expand Down
1 change: 1 addition & 0 deletions scripts/author/1c-scroll-all-authors-with-twitter-es.pl
Expand Up @@ -4,6 +4,7 @@
use warnings;

use Data::Printer;
use lib './lib';
use MetaCPAN::Util qw( es );

my $scroller = es()->scroll_helper(
Expand Down
1 change: 1 addition & 0 deletions scripts/author/2-twitter-or-github-es.pl
Expand Up @@ -4,6 +4,7 @@
use warnings;
use feature qw( say );

use lib './lib';
use MetaCPAN::Util qw( es );

my $scroller = es()->scroll_helper(
Expand Down
1 change: 1 addition & 0 deletions scripts/distribution/1-bugs-for-dist-es.pl
Expand Up @@ -4,6 +4,7 @@
use warnings;

use Data::Printer;
use lib './lib';
use MetaCPAN::Util qw( es );

my $dist = es()->get(
Expand Down
1 change: 1 addition & 0 deletions scripts/favorite/1-last-50-favorited-dists-es.pl
Expand Up @@ -4,6 +4,7 @@
use warnings;

use Data::Printer;
use lib './lib';
use MetaCPAN::Util qw( es );

my $faves = es()->search(
Expand Down
1 change: 1 addition & 0 deletions scripts/favorite/1a-last-100-favorited-dists-by-user-es.pl
Expand Up @@ -4,6 +4,7 @@
use warnings;

use Data::Printer;
use lib './lib';
use MetaCPAN::Util qw( es );

my $id = shift @ARGV;
Expand Down
1 change: 1 addition & 0 deletions scripts/favorite/2-favorites-previous-month-es.pl
Expand Up @@ -5,6 +5,7 @@

use Data::Printer;
use DateTime;
use lib './lib';
use MetaCPAN::Util qw( es );

my $now = DateTime->now;
Expand Down
1 change: 1 addition & 0 deletions scripts/favorite/3-leaderboard-es.pl
Expand Up @@ -4,6 +4,7 @@
use warnings;

use Data::Printer;
use lib './lib';
use MetaCPAN::Util qw( es );

my $faves = es()->search(
Expand Down
1 change: 1 addition & 0 deletions scripts/favorite/4-leaderboard-previous-month-es.pl
Expand Up @@ -5,6 +5,7 @@

use Data::Printer;
use DateTime;
use lib './lib';
use MetaCPAN::Util qw( es );

my $now = DateTime->now;
Expand Down
1 change: 1 addition & 0 deletions scripts/favorite/5-plus-plus-your-favorites-es.pl
Expand Up @@ -6,6 +6,7 @@
use Data::Printer;
use HTTP::Tiny ();
use JSON::MaybeXS qw( encode_json );
use lib './lib';
use MetaCPAN::Util qw( es );

my $token = shift @ARGV;
Expand Down
1 change: 1 addition & 0 deletions scripts/favorite/6-list-plussers-by-module.pl
Expand Up @@ -5,6 +5,7 @@
use feature qw( say );

use MetaCPAN::Client;
use lib './lib';
use MetaCPAN::Util qw( es );

binmode( STDOUT, ":utf8" );
Expand Down
1 change: 1 addition & 0 deletions scripts/file/1-get-files-in-dist-es.pl
Expand Up @@ -5,6 +5,7 @@
use feature qw( say );

use Data::Printer;
use lib './lib';
use MetaCPAN::Util qw( es );

my $files = es()->search(
Expand Down
1 change: 1 addition & 0 deletions scripts/file/2-get-dists-with-cpanfile.pl
Expand Up @@ -5,6 +5,7 @@
use feature qw( say );

use Data::Printer;
use lib './lib';
use MetaCPAN::Util qw( es );

my $files = es()->search(
Expand Down
1 change: 1 addition & 0 deletions scripts/file/3-find-files-in-top-level-by-name.pl
Expand Up @@ -5,6 +5,7 @@
use feature qw( say );

use Data::Printer;
use lib './lib';
use MetaCPAN::Util qw( es );

my $files = es()->search(
Expand Down
1 change: 1 addition & 0 deletions scripts/file/4-main-search.pl
Expand Up @@ -5,6 +5,7 @@

use Data::Printer;
use JSON::MaybeXS qw( decode_json );
use lib './lib';
use MetaCPAN::Util qw( es );

my $search_term = shift @ARGV || 'HTML-Re';
Expand Down
1 change: 1 addition & 0 deletions scripts/module/1-fetch-single-module-es.pl
Expand Up @@ -4,6 +4,7 @@
use warnings;

use Data::Printer;
use lib './lib';
use MetaCPAN::Util qw( es );

my $module = es()->get(
Expand Down
11 changes: 3 additions & 8 deletions scripts/release/1-pkg2url-es.pl
Expand Up @@ -4,15 +4,10 @@
use warnings;
use feature qw( say );

use Search::Elasticsearch;
use lib './lib';
use MetaCPAN::Util qw( es );

my $es = Search::Elasticsearch->new(
cxn_pool => 'Static::NoPing',
nodes => 'https://fastapi.metacpan.org',
trace_to => 'Stdout',
);

my $release = $es->search(
my $release = es->search(
index => 'cpan',
type => 'release',
body => {
Expand Down
11 changes: 4 additions & 7 deletions scripts/release/1a-module2url-es.pl
Expand Up @@ -6,13 +6,10 @@

use Search::Elasticsearch;

my $es = Search::Elasticsearch->new(
cxn_pool => 'Static::NoPing',
nodes => 'https://fastapi.metacpan.org',
trace_to => 'Stdout',
);
use lib './lib';
use MetaCPAN::Util qw( es );

my $module = $es->search(
my $module = es->search(
index => 'cpan',
type => 'file',
body => {
Expand All @@ -29,7 +26,7 @@

my $release_name = $module->{hits}{hits}[0]{_source}{release};

my $release = $es->search(
my $release = es->search(
index => 'cpan',
type => 'release',
body => {
Expand Down
2 changes: 2 additions & 0 deletions scripts/release/2-author-upload-leaderboard-es.pl
Expand Up @@ -4,6 +4,8 @@
use warnings;

use Data::Printer;

use lib './lib';
use MetaCPAN::Util qw( es );

my $uploads = es()->search(
Expand Down
1 change: 1 addition & 0 deletions scripts/release/3-author-uploads-one-author-es.pl
Expand Up @@ -4,6 +4,7 @@
use warnings;
use feature qw( say );

use lib './lib';
use MetaCPAN::Util qw( es );

my $uploads = es()->search(
Expand Down
2 changes: 2 additions & 0 deletions scripts/release/4-latest-release-versions-es.pl
Expand Up @@ -4,6 +4,8 @@
use warnings;

use Data::Printer;

use lib './lib';
use MetaCPAN::Util qw( es );

my $latest = es()->search(
Expand Down
Expand Up @@ -4,6 +4,7 @@
use warnings;

use Data::Printer;
use lib './lib';
use MetaCPAN::Util qw( es );

my $latest = es()->search(
Expand Down
2 changes: 2 additions & 0 deletions scripts/release/5-latest-releases-by-author-es.pl
Expand Up @@ -4,6 +4,8 @@
use warnings;

use Data::Printer;

use lib './lib';
use MetaCPAN::Util qw( es );

my $author = shift @ARGV;
Expand Down
1 change: 1 addition & 0 deletions scripts/release/6-latest-releases-with-git-repo-es.pl
Expand Up @@ -5,6 +5,7 @@
use feature qw( say );

use Data::Printer;
use lib './lib';
use MetaCPAN::Util qw( es );

my @must = (
Expand Down
2 changes: 2 additions & 0 deletions scripts/release/7-all-releases-es.pl
Expand Up @@ -5,6 +5,8 @@
use feature qw( say );

use Data::Printer;

use lib './lib';
use MetaCPAN::Util qw( es );

my $scroller = es()->scroll_helper(
Expand Down
1 change: 1 addition & 0 deletions scripts/release/8-all-releases-by-author-es.pl
Expand Up @@ -4,6 +4,7 @@
use warnings;
use feature qw( say );

use lib './lib';
use MetaCPAN::Util qw( es );

my $uploads = es()->search(
Expand Down

0 comments on commit baf6fe7

Please sign in to comment.