Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #1942 from metacpan/mickey/remove_single_valued_ar…
…rayref_to_scalar

Removed Elasticsearch::Adapter and its usage
  • Loading branch information
oalders committed Jul 5, 2017
2 parents 76d7e8e + 23becd0 commit 8ccb288
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 168 deletions.
89 changes: 0 additions & 89 deletions lib/MetaCPAN/Web/Elasticsearch/Adapter.pm

This file was deleted.

25 changes: 8 additions & 17 deletions lib/MetaCPAN/Web/Role/ReleaseInfo.pm
Expand Up @@ -3,9 +3,6 @@ package MetaCPAN::Web::Role::ReleaseInfo;
use Moose::Role;
use Future;

use Importer 'MetaCPAN::Web::Elasticsearch::Adapter' =>
qw/ single_valued_arrayref_to_scalar /;

# TODO: are there other controllers that do (or should) include this?

# TODO: should some of this be in a separate (instantiable) model
Expand Down Expand Up @@ -62,21 +59,15 @@ sub api_requests {
# organize the api results into simple variables for the template
sub stash_api_results {
my ( $self, $c, $reqs, $data ) = @_;

my %to_stash = (
author => $reqs->{author},
distribution => $reqs->{distribution},
rating => $reqs->{rating}{distributions}{ $data->{distribution} },
versions => $reqs->{versions}{releases},
$c->stash(
{
author => $reqs->{author},
distribution => $reqs->{distribution},
rating => $reqs->{rating}{distributions}{ $data->{distribution} },
versions => $reqs->{versions}{releases},
contributors => $reqs->{contributors},
}
);

my %stash
= map { $_ => single_valued_arrayref_to_scalar( $to_stash{$_} ) }
( 'rating', 'distribution', 'versions' );

$stash{contributors} = $reqs->{contributors};

$c->stash( \%stash );
}

1;
58 changes: 0 additions & 58 deletions t/elasticsearch_adapter.t

This file was deleted.

4 changes: 0 additions & 4 deletions t/model/release.t
Expand Up @@ -5,9 +5,6 @@ use Test::More;
use Cpanel::JSON::XS qw( decode_json );
use MetaCPAN::Web;

use Importer 'MetaCPAN::Web::Elasticsearch::Adapter' =>
qw/ single_valued_arrayref_to_scalar /;

my ( $true, $false ) = @{ decode_json('[true, false]') };

# Explicitly test that we get a boolean.
Expand All @@ -27,7 +24,6 @@ subtest modules => sub {
ok( scalar @files, 'found files with modules' );

foreach my $file (@files) {
single_valued_arrayref_to_scalar($file);

# this is a hack for the later sort check:
# 1. fix to both 'undefined value' warnings
Expand Down

0 comments on commit 8ccb288

Please sign in to comment.