Skip to content

Miscellaneous cleanups #1316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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