Skip to content

Commit

Permalink
Fix interop with new ES5.0 Clients
Browse files Browse the repository at this point in the history
Closes #1
  • Loading branch information
kentfredric committed Nov 8, 2016
1 parent 100f9a9 commit 4349a15
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 5 deletions.
8 changes: 7 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
Release history for CPAN-Distribution-ReleaseHistory

{{$NEXT}}
[Bugfix / #1]
- Fix interoperability with new ES 5.0 Client libraries.
- Closes https://github.com/kentnl/CPAN-Distribution-ReleaseHistory/issues/1
- Thanks to Slaven Rezić for report

[Dependencies::Stats]
- Dependencies changed since 0.002003, see misc/*.deps* for details
- configure: (recommends: ↓1)
- develop: +9 ↑3 -2 (recommends: ↓1, suggests: ↑2)
- develop: +10 ↑3 -2 (recommends: ↓1, suggests: ↑2)
- runtime: -1
- test: (recommends: ↓2)

0.002003 2014-11-12T16:48:51Z 1c14e8a
Expand Down
2 changes: 0 additions & 2 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ my %WriteMakefileArgs = (
"CPAN::DistnameInfo" => 0,
"Moo" => "1.000008",
"Search::Elasticsearch" => 0,
"Search::Elasticsearch::Scroll" => 0,
"strict" => 0,
"warnings" => 0
},
Expand All @@ -44,7 +43,6 @@ my %FallbackPrereqs = (
"File::Spec" => 0,
"Moo" => "1.000008",
"Search::Elasticsearch" => 0,
"Search::Elasticsearch::Scroll" => 0,
"Test::Fatal" => 0,
"Test::More" => "0.89",
"Test::RequiresInternet" => 0,
Expand Down
4 changes: 4 additions & 0 deletions dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,7 @@ Dist::Zilla::Plugin::Twitter = 0
Dist::Zilla::Plugin::UploadToCPAN = 0

[Prereqs]

[RemovePrereqs]
remove = Search::Elasticsearch::Client::5_0::Scroll
remove = Search::Elasticsearch::Scroll
5 changes: 5 additions & 0 deletions dist.ini.meta
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ srcreadme = mkdn
; auto_prereqs_skip = File::Find

[Prereqs]

[RemovePrereqs]
remove = Search::Elasticsearch::Client::5_0::Scroll
remove = Search::Elasticsearch::Scroll

13 changes: 11 additions & 2 deletions lib/CPAN/Distribution/ReleaseHistory.pm
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,22 @@ sub _mk_fields {
return [qw(name version date status maturity stat download_url )];
}

sub _es_version {
my ( $self, $wanted_version ) = @_;
local $@ = undef;
return eval { $self->es->VERSION($wanted_version); 1 }; ## no critic (RequireCheckingReturnValueOfEval)
}

sub _mk_scroll_args {
my ($self) = @_;

my %scrollargs = (
scroll => '5m',
index => 'v0',
type => 'release',
size => $self->scroll_size,
body => $self->_mk_body,
fields => $self->_mk_fields,
( $self->_es_version(5) ? 'stored_fields' : 'fields' ) => $self->_mk_fields,
);

if ( not $self->sort ) {
Expand All @@ -192,7 +199,9 @@ sub _mk_query_distribution {

my %scrollargs = %{ $self->_mk_scroll_args };

require Search::Elasticsearch::Scroll;
( $self->_es_version(5) )
? ( require Search::Elasticsearch::Client::5_0::Scroll )
: ( require Search::Elasticsearch::Scroll );

return $self->es->scroll_helper(%scrollargs);
}
Expand Down
2 changes: 2 additions & 0 deletions misc/Changes.deps
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
This file contains changes in REQUIRED dependencies for standard CPAN phases (configure/build/runtime/test)

0.002004
[Removed / runtime requires]
- Search::Elasticsearch::Scroll

0.002003 2014-11-12T16:48:51Z
[Added / test requires]
Expand Down
4 changes: 4 additions & 0 deletions misc/Changes.deps.all
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This file contains ALL changes in dependencies in both REQUIRED / OPTIONAL depen
- Dist::Zilla::Plugin::MetaYAML::Minimal
- Dist::Zilla::Plugin::Prereqs::Upgrade
- Dist::Zilla::Plugin::Readme::Brief
- Dist::Zilla::Plugin::RemovePrereqs
- Dist::Zilla::Plugin::RemovePrereqs::Provided
- English
- Software::License::Perl_5
Expand Down Expand Up @@ -35,6 +36,9 @@ This file contains ALL changes in dependencies in both REQUIRED / OPTIONAL depen
- Dist::Zilla::Plugin::MetaYAML
- Dist::Zilla::Plugin::ReadmeFromPod

[Removed / runtime requires]
- Search::Elasticsearch::Scroll

0.002003 2014-11-12T16:48:51Z
[Added / test requires]
- Test::Fatal
Expand Down
1 change: 1 addition & 0 deletions misc/Changes.deps.dev
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This file contains changes to DEVELOPMENT dependencies only ( both REQUIRED and
- Dist::Zilla::Plugin::MetaYAML::Minimal
- Dist::Zilla::Plugin::Prereqs::Upgrade
- Dist::Zilla::Plugin::Readme::Brief
- Dist::Zilla::Plugin::RemovePrereqs
- Dist::Zilla::Plugin::RemovePrereqs::Provided
- English
- Software::License::Perl_5
Expand Down

0 comments on commit 4349a15

Please sign in to comment.