Skip to content

Commit

Permalink
Merge pull request #1316 from metacpan/haarg/misc-cleanups
Browse files Browse the repository at this point in the history
Miscellaneous cleanups
  • Loading branch information
haarg authored Nov 7, 2024
2 parents 2633bba + 7d091e7 commit d215987
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 33 deletions.
17 changes: 8 additions & 9 deletions lib/MetaCPAN/ESConfig.pm
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
use v5.20;
use warnings;
use experimental qw(signatures postderef);
use experimental qw( signatures postderef );

package MetaCPAN::ESConfig;

use Carp qw(croak);
use Const::Fast qw(const);
use Exporter qw(import);
use MetaCPAN::Util qw(root_dir);
use Module::Runtime qw(require_module $module_name_rx);
use Carp qw( croak );
use Const::Fast qw( const );
use Cpanel::JSON::XS ();
use Hash::Merge::Simple qw(merge);
use Exporter qw( import );
use Hash::Merge::Simple qw( merge );
use MetaCPAN::Server::Config ();
use MetaCPAN::Types::TypeTiny qw(HashRef Defined);
use Const::Fast qw(const);
use MetaCPAN::Types::TypeTiny qw( Defined HashRef );
use MetaCPAN::Util qw( root_dir );
use Module::Runtime qw( $module_name_rx require_module );

const my %config => merge(
{
Expand Down
24 changes: 7 additions & 17 deletions lib/MetaCPAN/Query/Release.pm
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ sub _activity_filters {
if ( $new_dists and $new_dists eq 'n' ) {
push @filters,
(
+{ term => { first => 1 } },
+{ term => { first => true } },
+{ terms => { status => [qw( cpan latest )] } },
);
}
Expand Down Expand Up @@ -824,29 +824,19 @@ sub recent {
my $query;
if ( $type eq 'n' ) {
$query = {
constant_score => {
filter => {
bool => {
must => [
{ term => { first => 1 } },
{ terms => { status => [qw< cpan latest >] } },
]
}
}
bool => {
must => [
{ term => { first => true } },
{ terms => { status => [qw< cpan latest >] } },
]
}
};
}
elsif ( $type eq 'a' ) {
$query = { match_all => {} };
}
else {
$query = {
constant_score => {
filter => {
terms => { status => [qw< cpan latest >] }
}
}
};
$query = { terms => { status => [qw< cpan latest >] } };
}

my $body = {
Expand Down
6 changes: 1 addition & 5 deletions lib/MetaCPAN/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,7 @@ sub fix_version {

sub author_dir {
my $pauseid = shift;
my $dir = 'id/'
. sprintf( "%s/%s/%s",
substr( $pauseid, 0, 1 ),
substr( $pauseid, 0, 2 ), $pauseid );
return $dir;
return sprintf( 'id/%1$.1s/%1$.2s/%1$s', $pauseid );
}

sub hit_total {
Expand Down
3 changes: 2 additions & 1 deletion t/release/documentation-not-readme.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ use warnings;
use lib 't/lib';

use MetaCPAN::TestHelpers qw( test_release );
use MetaCPAN::Util qw( true false );
use Test::More;

test_release(
'RWSTAUNER/Documentation-Not-Readme-0.01',
{
first => 1,
first => true,
extra_tests => \&test_modules,
main_module => 'Documentation::Not::Readme',
}
Expand Down
3 changes: 2 additions & 1 deletion t/release/pod-examples.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ use warnings;
use lib 't/lib';

use MetaCPAN::TestHelpers qw( test_release );
use MetaCPAN::Util qw( true false );
use Test::More;

test_release(
'RWSTAUNER/Pod-Examples-99',
{
first => 1,
first => true,
extra_tests => \&test_pod_examples,
main_module => 'Pod::Examples',
changes_file => 'Changes',
Expand Down

0 comments on commit d215987

Please sign in to comment.