diff --git a/lib/MetaCPAN/Document/Author.pm b/lib/MetaCPAN/Document/Author.pm index 3f4e18685..72b487174 100644 --- a/lib/MetaCPAN/Document/Author.pm +++ b/lib/MetaCPAN/Document/Author.pm @@ -8,19 +8,18 @@ use ElasticSearchX::Model::Document; # load order not important use Gravatar::URL (); -use MetaCPAN::Types qw( Profile ); +use MetaCPAN::Types qw( ESBool Profile ); use MetaCPAN::Types::TypeTiny qw( ArrayRef ArrayRefPromote Blog - Bool Dict HashRef NonEmptySimpleStr PerlMongers Str ); -use MetaCPAN::Util; +use MetaCPAN::Util qw(true false); has name => ( is => 'ro', @@ -105,9 +104,9 @@ has updated => ( has is_pause_custodial_account => ( is => 'ro', - isa => Bool, + isa => ESBool, coerce => 1, - default => 0, + default => sub {false}, ); sub _build_gravatar_url { diff --git a/lib/MetaCPAN/Document/Distribution.pm b/lib/MetaCPAN/Document/Distribution.pm index d5f97d0b5..c2a19f0e4 100644 --- a/lib/MetaCPAN/Document/Distribution.pm +++ b/lib/MetaCPAN/Document/Distribution.pm @@ -8,6 +8,7 @@ use Moose; use ElasticSearchX::Model::Document; use MetaCPAN::Types::TypeTiny qw( BugSummary RiverSummary ); +use MetaCPAN::Util qw(true false); has name => ( is => 'ro', @@ -49,11 +50,11 @@ sub set_first_release { my @releases = $self->releases->sort( ["date"] )->all; my $first = shift @releases; - $first->_set_first(1); + $first->_set_first(true); $first->put; for my $rel (@releases) { - $rel->_set_first(0); + $rel->_set_first(false); $rel->put; } diff --git a/lib/MetaCPAN/Document/File.pm b/lib/MetaCPAN/Document/File.pm index 93d563e2b..f5c3c9f6a 100644 --- a/lib/MetaCPAN/Document/File.pm +++ b/lib/MetaCPAN/Document/File.pm @@ -9,10 +9,9 @@ use ElasticSearchX::Model::Document; use List::Util qw( any ); use MetaCPAN::Document::Module (); -use MetaCPAN::Types qw( Module ); +use MetaCPAN::Types qw( ESBool Module ); use MetaCPAN::Types::TypeTiny qw( ArrayRef - Bool Int Maybe Num @@ -20,7 +19,7 @@ use MetaCPAN::Types::TypeTiny qw( Stat Str ); -use MetaCPAN::Util qw(numify_version); +use MetaCPAN::Util qw(numify_version true false); use Plack::MIME (); use Pod::Text (); use Try::Tiny qw( catch try ); @@ -50,8 +49,8 @@ it is also set if the entire release is marked deprecated (see L ( is => 'ro', - isa => Bool, - default => 0, + isa => ESBool, + default => sub {false}, writer => '_set_deprecated', ); @@ -260,9 +259,9 @@ File is binary or not. has binary => ( is => 'ro', - isa => Bool, + isa => ESBool, required => 1, - default => 0, + default => sub {false}, ); =head2 authorized @@ -274,8 +273,8 @@ See L. has authorized => ( required => 1, is => 'ro', - isa => Bool, - default => 1, + isa => ESBool, + default => sub {true}, writer => '_set_authorized', ); @@ -301,8 +300,8 @@ Return true if this object represents a directory. has directory => ( is => 'ro', required => 1, - isa => Bool, - default => 0, + isa => ESBool, + default => sub {false}, ); =head2 documentation @@ -433,13 +432,13 @@ not. See L for a more verbose explanation. has indexed => ( required => 1, is => 'ro', - isa => Bool, + isa => ESBool, lazy => 1, default => sub { my ($self) = @_; - return 0 if $self->is_in_other_files; - return 0 if !$self->metadata->should_index_file( $self->path ); - return 1; + return false if $self->is_in_other_files; + return false if !$self->metadata->should_index_file( $self->path ); + return true; }, writer => '_set_indexed', ); @@ -897,7 +896,7 @@ sub set_indexed { if ( exists $meta->provides->{ $mod->name } and $self->path eq $meta->provides->{ $mod->name }{file} ) { - $mod->_set_indexed(1); + $mod->_set_indexed(true); return; } } @@ -905,16 +904,16 @@ sub set_indexed { # files listed under 'other files' are not shown in a search if ( $self->is_in_other_files() ) { foreach my $mod ( @{ $self->module } ) { - $mod->_set_indexed(0); + $mod->_set_indexed(false); } - $self->_set_indexed(0); + $self->_set_indexed(false); return; } # files under no_index directories should not be indexed foreach my $dir ( @{ $meta->no_index->{directory} } ) { if ( $self->path eq $dir or $self->path =~ /^$dir\// ) { - $self->_set_indexed(0); + $self->_set_indexed(false); return; } } @@ -923,24 +922,26 @@ sub set_indexed { if ( $mod->name !~ /^[A-Za-z]/ or !$meta->should_index_package( $mod->name ) ) { - $mod->_set_indexed(0); + $mod->_set_indexed(false); next; } $mod->_set_indexed( $mod->hide_from_pause( ${ $self->content }, $self->name ) - ? 0 - : 1 + ? false + : true ); } $self->_set_indexed( + ( - # .pm file with no package declaration but pod should be indexed - !@{ $self->module } || + # .pm file with no package declaration but pod should be indexed + !@{ $self->module } || # don't index if the documentation doesn't match any of its modules - !!grep { $self->documentation eq $_->name } @{ $self->module } + !!grep { $self->documentation eq $_->name } @{ $self->module } + ) ? true : false ) if ( $self->documentation ); } @@ -974,18 +975,18 @@ sub set_authorized { if ( $self->distribution eq 'perl' ) { my $allowed = grep $_ eq $self->author, @{ $perms->{perl} }; foreach my $module ( @{ $self->module } ) { - $module->_set_authorized($allowed); + $module->_set_authorized( $allowed ? true : false ); } - $self->_set_authorized($allowed); + $self->_set_authorized( $allowed ? true : false ); } else { foreach my $module ( @{ $self->module } ) { - $module->_set_authorized(0) + $module->_set_authorized(false) if ( $perms->{ $module->name } && !grep { $_ eq $self->author } @{ $perms->{ $module->name } } ); } - $self->_set_authorized(0) + $self->_set_authorized(false) if ( $self->authorized && $self->documentation && $perms->{ $self->documentation } diff --git a/lib/MetaCPAN/Document/File/Set.pm b/lib/MetaCPAN/Document/File/Set.pm index 129416a9e..f4f4fe7b4 100644 --- a/lib/MetaCPAN/Document/File/Set.pm +++ b/lib/MetaCPAN/Document/File/Set.pm @@ -6,7 +6,7 @@ use List::Util qw( max ); use MetaCPAN::Query::Favorite (); use MetaCPAN::Query::File (); use MetaCPAN::Query::Release (); -use MetaCPAN::Util qw( single_valued_arrayref_to_scalar ); +use MetaCPAN::Util qw( single_valued_arrayref_to_scalar true false ); extends 'ElasticSearchX::Model::Document::Set'; @@ -78,8 +78,8 @@ sub find { my @candidates = $self->index->type('file')->query( { bool => { must => [ - { term => { indexed => 1 } }, - { term => { authorized => 1 } }, + { term => { indexed => true } }, + { term => { authorized => true } }, { term => { status => 'latest' } }, { bool => { @@ -100,8 +100,8 @@ sub find { [ { term => { "module.authorized" - => 1 } - }, + => true + } }, { exists => { field => 'module.associated_pod' @@ -175,7 +175,10 @@ sub documented_modules { exists => { field => 'module.name' } }, - { term => { 'module.indexed' => 1 } }, + { + term => + { 'module.indexed' => true } + }, ], } }, @@ -186,7 +189,7 @@ sub documented_modules { exists => { field => 'pod.analyzed' } }, - { term => { indexed => 1 } }, + { term => { indexed => true } }, ], } }, @@ -217,8 +220,8 @@ sub history { filter => { bool => { must => [ - { term => { "module.authorized" => 1 } }, - { term => { "module.indexed" => 1 } }, + { term => { "module.authorized" => true } }, + { term => { "module.indexed" => true } }, { term => { "module.name" => $module } }, ] } @@ -242,8 +245,8 @@ sub history { bool => { must => [ { match_phrase => { documentation => $module } }, - { term => { indexed => 1 } }, - { term => { authorized => 1 } }, + { term => { indexed => true } }, + { term => { authorized => true } }, ] } } ) @@ -252,8 +255,8 @@ sub history { : $self->query( bool => { must => [ - { term => { indexed => 1 } }, - { term => { authorized => 1 } }, + { term => { indexed => true } }, + { term => { authorized => true } }, ] } ); @@ -279,8 +282,8 @@ sub autocomplete { }, { exists => { field => 'documentation' } }, { term => { status => 'latest' } }, - { term => { indexed => 1 } }, - { term => { authorized => 1 } } + { term => { indexed => true } }, + { term => { authorized => true } } ], must_not => [ { terms => { distribution => \@ROGUE_DISTRIBUTIONS } }, ], @@ -340,8 +343,8 @@ sub autocomplete_suggester { query => { bool => { must => [ - { term => { indexed => 1 } }, - { term => { authorized => 1 } }, + { term => { indexed => true } }, + { term => { authorized => true } }, { term => { status => 'latest' } }, { terms => { documentation => [ keys %docs ] } }, ], @@ -390,7 +393,7 @@ sub autocomplete_suggester { sub find_changes_files { my ( $self, $author, $release ) = @_; my $result = $self->files_by_category( $author, $release, ['changelog'], - { fields => \1 } ); + { fields => true } ); my ($file) = @{ $result->{categories}{changelog} || [] }; return $file; } diff --git a/lib/MetaCPAN/Document/Module.pm b/lib/MetaCPAN/Document/Module.pm index 3bb286b66..bf866e88d 100644 --- a/lib/MetaCPAN/Document/Module.pm +++ b/lib/MetaCPAN/Document/Module.pm @@ -8,8 +8,9 @@ use ElasticSearchX::Model::Document; with 'ElasticSearchX::Model::Document::EmbeddedRole'; -use MetaCPAN::Types::TypeTiny qw( Bool Maybe Num Str ); -use MetaCPAN::Util; +use MetaCPAN::Types qw( ESBool ); +use MetaCPAN::Types::TypeTiny qw( Maybe Num Str ); +use MetaCPAN::Util qw(true false); =head1 SYNOPSIS @@ -73,16 +74,16 @@ has version => ( is => 'ro' ); has indexed => ( is => 'ro', required => 1, - isa => Bool, - default => 1, + isa => ESBool, + default => sub {true}, writer => '_set_indexed', ); has authorized => ( is => 'ro', required => 1, - isa => Bool, - default => 1, + isa => ESBool, + default => sub {true}, writer => '_set_authorized', ); diff --git a/lib/MetaCPAN/Document/Release.pm b/lib/MetaCPAN/Document/Release.pm index 0ec62788a..cdc5a0e1b 100644 --- a/lib/MetaCPAN/Document/Release.pm +++ b/lib/MetaCPAN/Document/Release.pm @@ -3,10 +3,9 @@ package MetaCPAN::Document::Release; use Moose; use ElasticSearchX::Model::Document; -use MetaCPAN::Types qw( Dependency ); +use MetaCPAN::Types qw( ESBool Dependency ); use MetaCPAN::Types::TypeTiny qw( ArrayRef - Bool HashRefCPANMeta Num Resources @@ -14,7 +13,7 @@ use MetaCPAN::Types::TypeTiny qw( Str Tests ); -use MetaCPAN::Util qw( numify_version ); +use MetaCPAN::Util qw( numify_version true false ); =head1 PROPERTIES @@ -228,16 +227,16 @@ has tests => ( has authorized => ( is => 'ro', required => 1, - isa => Bool, - default => 1, + isa => ESBool, + default => sub {true}, writer => '_set_authorized', ); has first => ( is => 'ro', required => 1, - isa => Bool, - default => 0, + isa => ESBool, + default => sub {false}, writer => '_set_first', ); @@ -263,8 +262,8 @@ has changes_file => ( has deprecated => ( is => 'ro', - isa => Bool, - default => sub {0}, + isa => ESBool, + default => sub {false}, writer => '_set_deprecated', ); @@ -294,7 +293,7 @@ sub set_first { # { term => { first => 1 } }, # currently, the "first" property is not computed on all releases # since this feature has not been around when last reindexed - } )->count ? 0 : 1; + } )->count ? false : true; $self->_set_first($is_first); } diff --git a/lib/MetaCPAN/Model/Release.pm b/lib/MetaCPAN/Model/Release.pm index c224e6928..e2ce4cfe7 100644 --- a/lib/MetaCPAN/Model/Release.pm +++ b/lib/MetaCPAN/Model/Release.pm @@ -12,7 +12,7 @@ use File::Spec (); use Log::Contextual qw( :log :dlog ); use MetaCPAN::Model::Archive (); use MetaCPAN::Types::TypeTiny qw( AbsPath ArrayRef Str ); -use MetaCPAN::Util qw( fix_version); +use MetaCPAN::Util qw( fix_version true false ); use Module::Metadata 1.000012 (); # Improved package detection. use MooseX::StrictConstructor; use Parse::PMFile (); @@ -355,14 +355,15 @@ sub _build_files { my $file = $file_set->new_document( Dlog_trace {"adding file $_"} +{ author => $self->author, - binary => -B $child, + binary => -B $child ? true : false, content => $child->is_dir ? \"" : \( scalar $child->slurp ), date => $self->date, - directory => $child->is_dir, + directory => $child->is_dir ? true : false, distribution => $self->distribution, - indexed => $self->metadata->should_index_file($fpath) ? 1 - : 0, + indexed => $self->metadata->should_index_file($fpath) + ? true + : false, local_path => $child, maturity => $self->maturity, metadata => $self->metadata, @@ -491,7 +492,7 @@ sub _modules_from_meta { $file->add_module( { name => $module, version => $data->{version}, - indexed => 1, + indexed => true, } ); push( @modules, $file ); } diff --git a/lib/MetaCPAN/Model/Search.pm b/lib/MetaCPAN/Model/Search.pm index d46a1d2b9..6bc2e5bd5 100644 --- a/lib/MetaCPAN/Model/Search.pm +++ b/lib/MetaCPAN/Model/Search.pm @@ -3,12 +3,11 @@ package MetaCPAN::Model::Search; use MetaCPAN::Moose; use Const::Fast qw( const ); -use Cpanel::JSON::XS (); use Hash::Merge qw( merge ); use List::Util qw( min uniq ); use Log::Contextual qw( :log :dlog ); use MetaCPAN::Types::TypeTiny qw( Object Str ); -use MetaCPAN::Util qw( single_valued_arrayref_to_scalar ); +use MetaCPAN::Util qw( single_valued_arrayref_to_scalar true false ); use MooseX::StrictConstructor; has es => ( @@ -128,7 +127,7 @@ sub _search_expanded { results => $results, total => $es_results->{hits}->{total}, took => $es_results->{took}, - collapsed => Cpanel::JSON::XS::false(), + collapsed => false, }; return $return; } @@ -188,7 +187,7 @@ sub _search_collapsed { results => [], total => $es_results->{aggregations}{total_dists}{value}, took => $es_results->{took}, - collapsed => Cpanel::JSON::XS::true(), + collapsed => true, }; my $last = min( $total_size - 1, @@ -216,8 +215,8 @@ sub build_query { bool => { filter => [ { term => { status => 'latest' } }, - { term => { authorized => 1 } }, - { term => { indexed => 1 } }, + { term => { authorized => true } }, + { term => { indexed => true } }, { bool => { should => [ @@ -228,7 +227,10 @@ sub build_query { exists => { field => 'module.name' } }, - { term => { 'module.indexed' => 1 } } + { + term => + { 'module.indexed' => true } + } ], } }, @@ -275,8 +277,9 @@ sub build_query { query => $clean, boost => 3, default_operator => 'AND', - allow_leading_wildcard => 0, - use_dis_max => 1, + allow_leading_wildcard => + false, + use_dis_max => true, } }, @@ -287,8 +290,9 @@ sub build_query { ], query => $clean, default_operator => 'AND', - allow_leading_wildcard => 0, - use_dis_max => 1, + allow_leading_wildcard => + false, + use_dis_max => true, }, }, ], @@ -322,7 +326,7 @@ sub build_query { { term => { 'mime' => 'text/x-script.perl' } }, - { term => { 'deprecated' => 1 } }, + { term => { 'deprecated' => true } }, ], }, }, diff --git a/lib/MetaCPAN/Model/User/Account.pm b/lib/MetaCPAN/Model/User/Account.pm index 930ca8eea..eb2013f79 100644 --- a/lib/MetaCPAN/Model/User/Account.pm +++ b/lib/MetaCPAN/Model/User/Account.pm @@ -6,9 +6,9 @@ use warnings; use Moose; use ElasticSearchX::Model::Document; -use MetaCPAN::Types qw( Identity ); -use MetaCPAN::Types::TypeTiny qw( ArrayRef Bool Dict Str ); -use MetaCPAN::Util; +use MetaCPAN::Types qw( ESBool Identity ); +use MetaCPAN::Types::TypeTiny qw( ArrayRef Dict Str ); +use MetaCPAN::Util qw(true false); =head1 PROPERTIES @@ -91,7 +91,7 @@ is true if the user is connected to a PAUSE account or he L. has looks_human => ( required => 1, is => 'ro', - isa => Bool, + isa => ESBool, lazy => 1, builder => '_build_looks_human', clearer => 'clear_looks_human', @@ -99,7 +99,11 @@ has looks_human => ( sub _build_looks_human { my $self = shift; - return $self->has_identity('pause') || ( $self->passed_captcha ? 1 : 0 ); + return ( + ( $self->has_identity('pause') || $self->passed_captcha ) + ? true + : false + ); } =head1 METHODS diff --git a/lib/MetaCPAN/Query/File.pm b/lib/MetaCPAN/Query/File.pm index 5de697de0..ae00db15c 100644 --- a/lib/MetaCPAN/Query/File.pm +++ b/lib/MetaCPAN/Query/File.pm @@ -2,7 +2,7 @@ package MetaCPAN::Query::File; use MetaCPAN::Moose; -use MetaCPAN::Util qw( single_valued_arrayref_to_scalar ); +use MetaCPAN::Util qw( single_valued_arrayref_to_scalar true false ); with 'MetaCPAN::Query::Role::Common'; @@ -276,7 +276,7 @@ sub interesting_files { must => [ { term => { release => $release } }, { term => { author => $author } }, - { term => { directory => \0 } }, + { term => { directory => false } }, { bool => { should => \@clauses } }, ], must_not => [ diff --git a/lib/MetaCPAN/Query/Release.pm b/lib/MetaCPAN/Query/Release.pm index 9d048a397..1c832116b 100644 --- a/lib/MetaCPAN/Query/Release.pm +++ b/lib/MetaCPAN/Query/Release.pm @@ -2,7 +2,7 @@ package MetaCPAN::Query::Release; use MetaCPAN::Moose; -use MetaCPAN::Util qw( single_valued_arrayref_to_scalar ); +use MetaCPAN::Util qw( single_valued_arrayref_to_scalar true false ); with 'MetaCPAN::Query::Role::Common'; @@ -712,7 +712,7 @@ sub _get_latest_release { must => [ { term => { distribution => $distribution } }, { term => { status => 'latest' } }, - { term => { authorized => 1 } }, + { term => { authorized => true } }, ] }, }, @@ -743,8 +743,8 @@ sub _get_provided_modules { must => [ { term => { 'release' => $release->{name} } }, { term => { 'author' => $release->{author} } }, - { term => { 'module.authorized' => 1 } }, - { term => { 'module.indexed' => 1 } }, + { term => { 'module.authorized' => true } }, + { term => { 'module.indexed' => true } }, ] } }, @@ -814,7 +814,7 @@ sub _get_depended_releases { must => [ $dependency_filter, { term => { status => 'latest' } }, - { term => { authorized => 1 } }, + { term => { authorized => true } }, ], }, }, @@ -909,7 +909,7 @@ sub modules { must => [ { term => { release => $release } }, { term => { author => $author } }, - { term => { directory => 0 } }, + { term => { directory => false } }, { bool => { should => [ @@ -922,8 +922,9 @@ sub modules { } }, { - term => - { 'module.indexed' => 1 } + term => { + 'module.indexed' => true + } } ] } @@ -942,7 +943,7 @@ sub modules { } }, { - term => { 'indexed' => 1 } + term => { 'indexed' => true } }, ] } @@ -1057,11 +1058,11 @@ sub find_download_url { my $entity_filter = { bool => { must => [ - { term => { $prefix . 'authorized' => 1 } }, + { term => { $prefix . 'authorized' => true } }, ( $module_filter ? ( - { term => { $prefix . 'indexed' => 1 } }, + { term => { $prefix . 'indexed' => true } }, { term => { $prefix . 'name' => $name } } ) : { term => { 'distribution' => $name } }, diff --git a/lib/MetaCPAN/Script/Author.pm b/lib/MetaCPAN/Script/Author.pm index d306983c8..f2708bd7e 100644 --- a/lib/MetaCPAN/Script/Author.pm +++ b/lib/MetaCPAN/Script/Author.pm @@ -13,7 +13,7 @@ use Encode (); use Log::Contextual qw( :log :dlog ); use MetaCPAN::Document::Author (); use MetaCPAN::Types::TypeTiny qw( Str ); -use MetaCPAN::Util qw(diff_struct); +use MetaCPAN::Util qw(diff_struct true false); use URI (); use XML::XPath (); @@ -189,7 +189,7 @@ sub author_data_from_cpan { %$author_config, is_pause_custodial_account => ( ( $whois_data->{fullname} // '' ) - =~ /\(PAUSE Custodial Account\)/ ? 1 : 0 + =~ /\(PAUSE Custodial Account\)/ ? true : false ), }; diff --git a/lib/MetaCPAN/Script/Check.pm b/lib/MetaCPAN/Script/Check.pm index b6aafd5c1..c1a660c01 100644 --- a/lib/MetaCPAN/Script/Check.pm +++ b/lib/MetaCPAN/Script/Check.pm @@ -7,6 +7,7 @@ use File::Spec::Functions qw( catfile ); use Log::Contextual qw( :log ); use Moose; use MetaCPAN::Types::TypeTiny qw( Bool Int Str ); +use MetaCPAN::Util qw( true false ); with 'MetaCPAN::Role::Script', 'MooseX::Getopt'; @@ -94,7 +95,7 @@ sub check_modules { bool => { must => [ { term => { 'module.name' => $pkg } }, - { term => { 'authorized' => 'true' } }, + { term => { 'authorized' => true } }, { term => { 'maturity' => 'released' } }, ], }, diff --git a/lib/MetaCPAN/Script/Latest.pm b/lib/MetaCPAN/Script/Latest.pm index 8e3515831..42f6e9e34 100644 --- a/lib/MetaCPAN/Script/Latest.pm +++ b/lib/MetaCPAN/Script/Latest.pm @@ -8,6 +8,7 @@ use Moose; use CPAN::DistnameInfo (); use DateTime::Format::ISO8601 (); use MetaCPAN::Types::TypeTiny qw( Bool Str ); +use MetaCPAN::Util qw( true false ); use Parse::CPAN::Packages::Fast (); with 'MetaCPAN::Role::Script', 'MooseX::Getopt'; @@ -99,7 +100,7 @@ sub run { push @module_filters, [ - { term => { 'module.indexed' => 1 } }, + { term => { 'module.indexed' => true } }, { terms => { "module.name" => \@modules } }, ]; } @@ -107,7 +108,7 @@ sub run { else { push @module_filters, [ - { term => { 'module.indexed' => 1 } }, + { term => { 'module.indexed' => true } }, { exists => { field => "module.name" } }, ]; } diff --git a/lib/MetaCPAN/Script/Release.pm b/lib/MetaCPAN/Script/Release.pm index d2cb39c1b..0c75dfcb3 100644 --- a/lib/MetaCPAN/Script/Release.pm +++ b/lib/MetaCPAN/Script/Release.pm @@ -11,7 +11,7 @@ use Log::Contextual qw( :log :dlog ); use MetaCPAN::Model::Release (); use MetaCPAN::Script::Runner (); use MetaCPAN::Types::TypeTiny qw( Bool HashRef Int Str ); -use MetaCPAN::Util; +use MetaCPAN::Util qw(true false); use Moose; use PerlIO::gzip; use Try::Tiny qw( catch try ); @@ -313,7 +313,7 @@ sub import_archive { $meta->{x_deprecated} or $document->has_abstract and $document->abstract =~ /DEPRECI?ATED/ - ) ? 1 : 0; + ) ? true : false; $document->_set_deprecated($deprecated); @@ -339,7 +339,7 @@ sub import_archive { } # check for DEPRECATED/DEPRECIATED in abstract of file - $file->_set_deprecated(1) + $file->_set_deprecated(true) if $deprecated or $file_x_deprecated or $file->abstract and $file->abstract =~ /DEPRECI?ATED/; @@ -370,7 +370,7 @@ sub import_archive { . " contains unauthorized modules: " . join( ",", map { $_->name } @release_unauthorized ); }; - $document->_set_authorized(0); + $document->_set_authorized(false); $document->put; } diff --git a/lib/MetaCPAN/Server/Controller/Rating.pm b/lib/MetaCPAN/Server/Controller/Rating.pm index 7f429272b..bc80b85f3 100644 --- a/lib/MetaCPAN/Server/Controller/Rating.pm +++ b/lib/MetaCPAN/Server/Controller/Rating.pm @@ -3,6 +3,7 @@ package MetaCPAN::Server::Controller::Rating; use strict; use warnings; +use MetaCPAN::Util qw( true false ); use Moose; BEGIN { extends 'MetaCPAN::Server::Controller' } @@ -64,7 +65,7 @@ sub find : Path('_search') : Args(0) : ActionClass('~Deserialize') { max_score => undef, total => scalar @hits, }, - timed_out => \0, + timed_out => false, took => 0, } ); } diff --git a/lib/MetaCPAN/Server/Controller/Scroll.pm b/lib/MetaCPAN/Server/Controller/Scroll.pm index fa191bd51..a2917680f 100644 --- a/lib/MetaCPAN/Server/Controller/Scroll.pm +++ b/lib/MetaCPAN/Server/Controller/Scroll.pm @@ -4,6 +4,7 @@ use strict; use warnings; use namespace::autoclean; +use MetaCPAN::Util qw(true false); use Moose; use Try::Tiny qw( catch try ); @@ -47,7 +48,7 @@ sub index : Path('/_search/scroll') : Args { max_score => undef, total => 0, }, - timed_out => \0, + timed_out => false, took => 0, } ); return; diff --git a/lib/MetaCPAN/Types/Internal.pm b/lib/MetaCPAN/Types/Internal.pm index 7d498d6fe..d48e4fd8b 100644 --- a/lib/MetaCPAN/Types/Internal.pm +++ b/lib/MetaCPAN/Types/Internal.pm @@ -3,11 +3,14 @@ package MetaCPAN::Types::Internal; use strict; use warnings; -use ElasticSearchX::Model::Document::Types qw( Type ); -use MooseX::Getopt::OptionTypeMap (); -use MooseX::Types::Moose qw( ArrayRef HashRef ); +use ElasticSearchX::Model::Document::Mapping (); +use ElasticSearchX::Model::Document::Types qw( Type ); +use MetaCPAN::Util qw( is_bool true false ); +use MooseX::Getopt::OptionTypeMap (); +use MooseX::Types::Moose qw( Item Any Bool ArrayRef HashRef ); use MooseX::Types -declare => [ qw( + ESBool Module Identity Dependency @@ -63,6 +66,14 @@ coerce Profile, from HashRef, MooseX::Getopt::OptionTypeMap->add_option_type_to_map( 'MooseX::Types::ElasticSearch::ES' => '=s' ); +subtype ESBool, as Item, where { is_bool($_) }; +coerce ESBool, from Bool, via { + $_ ? true : false +}; + +$ElasticSearchX::Model::Document::Mapping::MAPPING{ESBool} + = $ElasticSearchX::Model::Document::Mapping::MAPPING{ESBool}; + use MooseX::Attribute::Deflator; deflate 'ScalarRef', via {$$_}; inflate 'ScalarRef', via { \$_ }; diff --git a/lib/MetaCPAN/Util.pm b/lib/MetaCPAN/Util.pm index 46e4610ad..5cc0e76b5 100644 --- a/lib/MetaCPAN/Util.pm +++ b/lib/MetaCPAN/Util.pm @@ -16,6 +16,7 @@ use Ref::Util qw( is_plain_hashref is_ref ); +use Cpanel::JSON::XS (); use Sub::Exporter -setup => { exports => [ qw( checkout_root @@ -30,9 +31,16 @@ use Sub::Exporter -setup => { pod_lines strip_pod single_valued_arrayref_to_scalar + true + false + is_bool ) ] }; +*true = \&Cpanel::JSON::XS::true; +*false = \&Cpanel::JSON::XS::false; +*is_bool = \&Cpanel::JSON::XS::is_bool; + sub checkout_root { IPC::Run3::run3( [qw(git rev-parse --show-toplevel)], \undef, \my $stdout, \my $stderr ); diff --git a/t/document/file.t b/t/document/file.t index 51c822e85..6026b979f 100644 --- a/t/document/file.t +++ b/t/document/file.t @@ -4,6 +4,7 @@ use lib 't/lib'; use CPAN::Meta (); use MetaCPAN::Document::File (); +use MetaCPAN::Util qw(true false); use Test::More; sub cpan_meta { @@ -63,7 +64,7 @@ sub test_attributes { subtest 'helper' => sub { my $file = new_file_doc( module => { name => 'Foo::Bar' }, ); - is $file->module->[0]->indexed, 1, 'Regular package name indexed'; + is $file->module->[0]->indexed, true, 'Regular package name indexed'; }; subtest 'basic' => sub { @@ -248,7 +249,7 @@ END subtest 'Packages starting with underscore are not indexed' => sub { my $file = new_file_doc( module => { name => '_Package::Foo' } ); - is( $file->module->[0]->indexed, 0, 'Package is not indexed' ); + is( $file->module->[0]->indexed, false, 'Package is not indexed' ); }; subtest 'files listed under other files' => sub { @@ -267,7 +268,8 @@ END content => \$content, ); - is( $file->indexed, 0, 'File listed under other files is not indexed' ); + is( $file->indexed, false, + 'File listed under other files is not indexed' ); }; subtest 'pod name/package mismatch' => sub { diff --git a/t/model/search.t b/t/model/search.t index 6a01ba10e..9495c8977 100644 --- a/t/model/search.t +++ b/t/model/search.t @@ -2,9 +2,9 @@ use strict; use warnings; use lib 't/lib'; -use Cpanel::JSON::XS (); use MetaCPAN::Model::Search (); use MetaCPAN::TestServer (); +use MetaCPAN::Util qw(true false); use Test::Deep qw( cmp_deeply ignore ); use Test::More; @@ -25,7 +25,7 @@ ok( $search, 'search' ); results => [], total => 0, took => ignore(), - collapsed => Cpanel::JSON::XS::true(), + collapsed => true, }, 'no results on fake module' ); diff --git a/t/release/badpod.t b/t/release/badpod.t index 8887fce26..e16f90d92 100644 --- a/t/release/badpod.t +++ b/t/release/badpod.t @@ -2,23 +2,23 @@ use strict; use warnings; use lib 't/lib'; -use Cpanel::JSON::XS (); use MetaCPAN::TestHelpers qw( test_release ); +use MetaCPAN::Util qw(true false); use Test::More; test_release( { name => 'BadPod-0.01', author => 'MO', - authorized => 1, - first => 1, + authorized => true, + first => true, provides => [ 'BadPod', ], main_module => 'BadPod', modules => { 'lib/BadPod.pm' => [ { name => 'BadPod', - indexed => Cpanel::JSON::XS::true(), - authorized => Cpanel::JSON::XS::true(), + indexed => true, + authorized => true, version => '0.01', version_numified => 0.01, associated_pod => 'MO/BadPod-0.01/lib/BadPod.pm', diff --git a/t/release/binary-data.t b/t/release/binary-data.t index f8848f268..92dde3eed 100644 --- a/t/release/binary-data.t +++ b/t/release/binary-data.t @@ -2,23 +2,23 @@ use strict; use warnings; use lib 't/lib'; -use Cpanel::JSON::XS (); use MetaCPAN::TestHelpers qw( test_release ); +use MetaCPAN::Util qw(true false); use Test::More; test_release( { name => 'Binary-Data-0.01', author => 'BORISNAT', - authorized => 1, - first => 1, + authorized => true, + first => true, provides => [ 'Binary::Data', 'Binary::Data::WithPod', ], main_module => 'Binary::Data', modules => { 'lib/Binary/Data.pm' => [ { name => 'Binary::Data', - indexed => Cpanel::JSON::XS::true(), - authorized => Cpanel::JSON::XS::true(), + indexed => true, + authorized => true, version => '0.01', version_numified => 0.01, associated_pod => undef, @@ -27,8 +27,8 @@ test_release( { 'lib/Binary/Data/WithPod.pm' => [ { name => 'Binary::Data::WithPod', - indexed => Cpanel::JSON::XS::true(), - authorized => Cpanel::JSON::XS::true(), + indexed => true, + authorized => true, version => '0.02', version_numified => 0.02, associated_pod => diff --git a/t/release/common-files.t b/t/release/common-files.t index b6d440680..4013f4abf 100644 --- a/t/release/common-files.t +++ b/t/release/common-files.t @@ -2,22 +2,22 @@ use strict; use warnings; use lib 't/lib'; -use Cpanel::JSON::XS (); use MetaCPAN::TestHelpers qw( test_release ); +use MetaCPAN::Util qw(true false); use Test::More; test_release( { name => 'Common-Files-1.1', author => 'BORISNAT', - authorized => 1, - first => 1, + authorized => true, + first => true, provides => ['Common::Files'], modules => { 'lib/Common/Files.pm' => [ { name => 'Common::Files', - indexed => Cpanel::JSON::XS::true(), - authorized => Cpanel::JSON::XS::true(), + indexed => true, + authorized => true, version => '1.1', version_numified => 1.1, associated_pod => diff --git a/t/release/devel-gofaster-0.000.t b/t/release/devel-gofaster-0.000.t index 5d9d8316f..e8769f2ad 100644 --- a/t/release/devel-gofaster-0.000.t +++ b/t/release/devel-gofaster-0.000.t @@ -3,14 +3,15 @@ use warnings; use lib 't/lib'; use MetaCPAN::TestHelpers qw( test_release ); +use MetaCPAN::Util qw(true false); use Test::More; test_release( { name => 'Devel-GoFaster-0.000', distribution => 'Devel-GoFaster', author => 'LOCAL', - authorized => 1, - first => 1, + authorized => true, + first => true, version => '0.000', provides => [ 'Devel::GoFaster', ], diff --git a/t/release/file-duplicates.t b/t/release/file-duplicates.t index f9d2c72ad..e3873e492 100644 --- a/t/release/file-duplicates.t +++ b/t/release/file-duplicates.t @@ -2,38 +2,38 @@ use strict; use warnings; use lib 't/lib'; -use Cpanel::JSON::XS (); use MetaCPAN::TestHelpers qw( test_release ); +use MetaCPAN::Util qw( true false ); use Test::More; test_release( 'BORISNAT/File-Duplicates-1.000', { - first => 1, + first => true, main_module => 'File::Duplicates', modules => { 'lib/File/Duplicates.pm' => [ { name => 'File::Duplicates', version => '0.991', version_numified => '0.991', - authorized => Cpanel::JSON::XS::true(), - indexed => Cpanel::JSON::XS::true(), + authorized => true, + indexed => true, associated_pod => undef, } ], 'lib/File/lib/File/Duplicates.pm' => [ { name => 'File::lib::File::Duplicates', version => '0.992', version_numified => '0.992', - authorized => Cpanel::JSON::XS::true(), - indexed => Cpanel::JSON::XS::true(), + authorized => true, + indexed => true, associated_pod => undef, } ], 'lib/Dupe.pm' => [ { name => 'Dupe', version => '0.993', version_numified => '0.993', - authorized => Cpanel::JSON::XS::true(), - indexed => 0, + authorized => true, + indexed => false, associated_pod => undef, } ], 'DupeX/Dupe.pm' => [ @@ -41,16 +41,16 @@ test_release( name => 'DupeX::Dupe', version => '0.994', version_numified => '0.994', - authorized => Cpanel::JSON::XS::true(), - indexed => Cpanel::JSON::XS::true(), + authorized => true, + indexed => true, associated_pod => undef, }, { name => 'DupeX::Dupe::X', version => '0.995', version_numified => '0.995', - authorized => Cpanel::JSON::XS::true(), - indexed => Cpanel::JSON::XS::true(), + authorized => true, + indexed => true, associated_pod => undef, } ], diff --git a/t/release/ipsonar-0.29.t b/t/release/ipsonar-0.29.t index d1b6bcd78..0e314ad42 100644 --- a/t/release/ipsonar-0.29.t +++ b/t/release/ipsonar-0.29.t @@ -3,6 +3,7 @@ use warnings; use lib 't/lib'; use MetaCPAN::TestHelpers qw( test_release ); +use MetaCPAN::Util qw(true false); use Test::More; test_release( { @@ -10,8 +11,8 @@ test_release( { distribution => 'IPsonar', author => 'LOCAL', - authorized => 1, - first => 1, + authorized => true, + first => true, # META file says ''. version => '', diff --git a/t/release/local-lib.t b/t/release/local-lib.t index ece8b2898..190721f75 100644 --- a/t/release/local-lib.t +++ b/t/release/local-lib.t @@ -2,24 +2,24 @@ use strict; use warnings; use lib 't/lib'; -use Cpanel::JSON::XS (); use MetaCPAN::TestHelpers qw( test_release ); +use MetaCPAN::Util qw(true false); use Test::More; test_release( { name => 'local-lib-0.01', author => 'BORISNAT', abstract => 'Legitimate module', - authorized => 1, - first => 1, + authorized => true, + first => true, provides => ['local::lib'], main_module => 'local::lib', modules => { 'lib/local/lib.pm' => [ { name => 'local::lib', - indexed => Cpanel::JSON::XS::true(), - authorized => Cpanel::JSON::XS::true(), + indexed => true, + authorized => true, version => '0.01', version_numified => 0.01, associated_pod => 'BORISNAT/local-lib-0.01/lib/local/lib.pm', diff --git a/t/release/meta-provides.t b/t/release/meta-provides.t index 6f54fdf66..ae73bd13b 100644 --- a/t/release/meta-provides.t +++ b/t/release/meta-provides.t @@ -3,6 +3,7 @@ use warnings; use lib 't/lib'; use MetaCPAN::TestHelpers qw( test_release ); +use MetaCPAN::Util qw(true false); use Test::More; test_release( @@ -10,8 +11,8 @@ test_release( name => 'Meta-Provides-1.01', author => 'RWSTAUNER', abstract => 'has provides key in meta', - authorized => 1, - first => 1, + authorized => true, + first => true, provides => [ 'Meta::Provides', ], status => 'latest', main_module => 'Meta::Provides', @@ -25,7 +26,7 @@ test_release( must => [ { term => { 'author' => $release->author } }, { term => { 'release' => $release->name } }, - { term => { 'directory' => \0 } }, + { term => { 'directory' => false } }, { prefix => { 'path' => 'lib/' } }, ], }, @@ -45,7 +46,7 @@ test_release( foreach my $test ( [ 'Provides.pm', 'Meta::Provides', - [ { name => 'Meta::Provides', indexed => 1 }, ] + [ { name => 'Meta::Provides', indexed => true }, ] ], ) { diff --git a/t/release/multiple-modules.t b/t/release/multiple-modules.t index 4f39e95ab..9d795ea6b 100644 --- a/t/release/multiple-modules.t +++ b/t/release/multiple-modules.t @@ -3,6 +3,7 @@ use warnings; use lib 't/lib'; use MetaCPAN::Server::Test qw( model ); +use MetaCPAN::Util qw(true false); use Test::More; my $model = model(); @@ -52,24 +53,24 @@ ok( !$release->first, 'Release is not first' ); 'A.pm', 'Multiple::Modules::A', [ - { name => 'Multiple::Modules::A', indexed => 1 }, - { name => 'Multiple::Modules::A2', indexed => 1 }, + { name => 'Multiple::Modules::A', indexed => true }, + { name => 'Multiple::Modules::A2', indexed => true }, ] ], [ 'B.pm', 'Multiple::Modules::B', [ - { name => 'Multiple::Modules::B', indexed => 1 }, + { name => 'Multiple::Modules::B', indexed => true }, - #{name => 'Multiple::Modules::_B2', indexed => 0}, # hidden - { name => 'Multiple::Modules::B::Secret', indexed => 0 }, + #{name => 'Multiple::Modules::_B2', indexed => false }, # hidden + { name => 'Multiple::Modules::B::Secret', indexed => false }, ] ], [ 'Modules.pm', 'Multiple::Modules', - [ { name => 'Multiple::Modules', indexed => 1 }, ] + [ { name => 'Multiple::Modules', indexed => true }, ] ], ) { diff --git a/t/release/no-modules.t b/t/release/no-modules.t index 42162bce8..3825465c6 100644 --- a/t/release/no-modules.t +++ b/t/release/no-modules.t @@ -3,14 +3,15 @@ use warnings; use lib 't/lib'; use MetaCPAN::TestHelpers qw( test_release ); +use MetaCPAN::Util qw(true false); use Test::More; # Some uploads contain no usable modules. test_release( { name => 'No-Modules-1.1', author => 'BORISNAT', - authorized => 1, - first => 1, + authorized => true, + first => true, # Without modules it won't get marked as latest. status => 'cpan', diff --git a/t/release/no-packages.t b/t/release/no-packages.t index 5f523b7b8..58808d472 100644 --- a/t/release/no-packages.t +++ b/t/release/no-packages.t @@ -3,14 +3,15 @@ use warnings; use lib 't/lib'; use MetaCPAN::TestHelpers qw( test_release ); +use MetaCPAN::Util qw(true false); use Test::More; # Some uploads contain no usable modules. test_release( { name => 'No-Packages-1.1', author => 'BORISNAT', - authorized => 1, - first => 1, + authorized => true, + first => true, # Without modules it won't get marked as latest. status => 'cpan', diff --git a/t/release/oops-locallib.t b/t/release/oops-locallib.t index 82109bc1f..fea1a81fd 100644 --- a/t/release/oops-locallib.t +++ b/t/release/oops-locallib.t @@ -2,23 +2,23 @@ use strict; use warnings; use lib 't/lib'; -use Cpanel::JSON::XS (); use MetaCPAN::TestHelpers qw( test_release ); +use MetaCPAN::Util qw(true false); use Test::More; test_release( { name => 'Oops-LocalLib-0.01', author => 'BORISNAT', - authorized => 1, - first => 1, + authorized => true, + first => true, provides => [ 'Fruits', 'Oops::LocalLib', ], main_module => 'Oops::LocalLib', modules => { 'lib/Oops/LocalLib.pm' => [ { name => 'Oops::LocalLib', - indexed => Cpanel::JSON::XS::true(), - authorized => Cpanel::JSON::XS::true(), + indexed => true, + authorized => true, version => '0.01', version_numified => 0.01, associated_pod => @@ -28,8 +28,8 @@ test_release( { 'foreign/Fruits.pm' => [ { name => 'Fruits', - indexed => Cpanel::JSON::XS::true(), - authorized => Cpanel::JSON::XS::true(), + indexed => true, + authorized => true, version => '1', version_numified => 1, associated_pod => diff --git a/t/release/p-1.0.20.t b/t/release/p-1.0.20.t index 4ce416ce3..ddd84197f 100644 --- a/t/release/p-1.0.20.t +++ b/t/release/p-1.0.20.t @@ -3,6 +3,7 @@ use warnings; use lib 't/lib'; use MetaCPAN::TestHelpers qw( test_release ); +use MetaCPAN::Util qw(true false); use Ref::Util qw( is_hashref ); use Test::More; @@ -15,8 +16,8 @@ test_release( { name => 'P-1.0.20', distribution => 'P', author => 'LOCAL', - authorized => 1, - first => 1, + authorized => true, + first => true, version => 'v1.0.20', provides => [ 'P', ], diff --git a/t/release/packages-unclaimable.t b/t/release/packages-unclaimable.t index 245a1fec4..2a01755b6 100644 --- a/t/release/packages-unclaimable.t +++ b/t/release/packages-unclaimable.t @@ -2,9 +2,9 @@ use strict; use warnings; use lib 't/lib'; -use Cpanel::JSON::XS (); use List::Util qw( uniq ); use MetaCPAN::TestHelpers qw( test_release ); +use MetaCPAN::Util qw( true false ); use Module::Metadata (); use Test::More; @@ -14,8 +14,8 @@ test_release( author => 'RWSTAUNER', abstract => 'Dist that appears to declare packages that are not allowed', - authorized => 1, - first => 1, + authorized => true, + first => true, provides => [ 'Packages::Unclaimable', ], status => 'latest', main_module => 'Packages::Unclaimable', @@ -23,8 +23,8 @@ test_release( 'lib/Packages/Unclaimable.pm' => [ { name => 'Packages::Unclaimable', - indexed => Cpanel::JSON::XS::true(), - authorized => Cpanel::JSON::XS::true(), + indexed => true, + authorized => true, version => 2, version_numified => 2, associated_pod => diff --git a/t/release/packages.t b/t/release/packages.t index 0f2935aab..41b0b6219 100644 --- a/t/release/packages.t +++ b/t/release/packages.t @@ -2,8 +2,8 @@ use strict; use warnings; use lib 't/lib'; -use Cpanel::JSON::XS (); use MetaCPAN::TestHelpers qw( test_release ); +use MetaCPAN::Util qw(true false); use Test::More; test_release( @@ -11,8 +11,8 @@ test_release( name => 'Packages-1.103', author => 'RWSTAUNER', abstract => 'Package examples', - authorized => 1, - first => 1, + authorized => true, + first => true, provides => [ 'Packages', 'Packages::BOM', ], status => 'latest', main_module => 'Packages', @@ -20,8 +20,8 @@ test_release( 'lib/Packages.pm' => [ { name => 'Packages', - indexed => Cpanel::JSON::XS::true(), - authorized => Cpanel::JSON::XS::true(), + indexed => true, + authorized => true, version => '1.103', version_numified => 1.103, associated_pod => @@ -31,8 +31,8 @@ test_release( 'lib/Packages/BOM.pm' => [ { name => 'Packages::BOM', - indexed => Cpanel::JSON::XS::true(), - authorized => Cpanel::JSON::XS::true(), + indexed => true, + authorized => true, version => 0.04, version_numified => 0.04, associated_pod => diff --git a/t/release/pod-with-data-token.t b/t/release/pod-with-data-token.t index b2ed5da5b..eebdcdb58 100644 --- a/t/release/pod-with-data-token.t +++ b/t/release/pod-with-data-token.t @@ -4,21 +4,22 @@ use lib 't/lib'; use Cpanel::JSON::XS (); use MetaCPAN::TestHelpers qw( test_release ); +use MetaCPAN::Util qw( true false ); use Test::More; test_release( { name => 'Pod-With-Data-Token-0.01', author => 'BORISNAT', - authorized => 1, - first => 1, + authorized => true, + first => true, provides => [ 'Pod::With::Data::Token', ], main_module => 'Pod::With::Data::Token', modules => { 'lib/Pod/With/Data/Token.pm' => [ { name => 'Pod::With::Data::Token', - indexed => Cpanel::JSON::XS::true(), - authorized => Cpanel::JSON::XS::true(), + indexed => true, + authorized => true, version => '0.01', version_numified => 0.01, associated_pod => diff --git a/t/release/pod-with-generator.t b/t/release/pod-with-generator.t index e1294d525..99951804c 100644 --- a/t/release/pod-with-generator.t +++ b/t/release/pod-with-generator.t @@ -4,21 +4,22 @@ use lib 't/lib'; use Cpanel::JSON::XS (); use MetaCPAN::TestHelpers qw( test_release ); +use MetaCPAN::Util qw(true false); use Test::More; test_release( { name => 'Pod-With-Generator-1', author => 'BORISNAT', - authorized => 1, - first => 1, + authorized => true, + first => true, provides => [ 'Pod::With::Generator', ], main_module => 'Pod::With::Generator', modules => { 'lib/Pod/With/Generator.pm' => [ { name => 'Pod::With::Generator', - indexed => Cpanel::JSON::XS::true(), - authorized => Cpanel::JSON::XS::true(), + indexed => true, + authorized => true, version => '1', version_numified => 1, associated_pod => diff --git a/t/release/prefer-meta-json.t b/t/release/prefer-meta-json.t index 11bc7080b..d6e13cddb 100644 --- a/t/release/prefer-meta-json.t +++ b/t/release/prefer-meta-json.t @@ -3,6 +3,7 @@ use warnings; use lib 't/lib'; use MetaCPAN::Server::Test qw( model ); +use MetaCPAN::Util qw(true false); use Test::More; my $model = model(); @@ -41,10 +42,10 @@ is( $release->metadata->{'meta-spec'}{version}, 2, 'meta_spec version is 2' ); is( scalar @modules, 2, 'file contains two modules' ); is( $modules[0]->name, 'Prefer::Meta::JSON', 'module name ok' ); - is( $modules[0]->indexed, 1, 'main module indexed' ); + is( $modules[0]->indexed, true, 'main module indexed' ); is( $modules[1]->name, 'Prefer::Meta::JSON::Gremlin', 'module name ok' ); - is( $modules[1]->indexed, 0, 'module not indexed' ); + is( $modules[1]->indexed, false, 'module not indexed' ); } done_testing; diff --git a/t/release/scripts.t b/t/release/scripts.t index 880c2cc13..a3acc8f26 100644 --- a/t/release/scripts.t +++ b/t/release/scripts.t @@ -3,6 +3,7 @@ use warnings; use lib 't/lib'; use MetaCPAN::Server::Test qw( model ); +use MetaCPAN::Util qw(true false); use Test::More skip_all => 'Scripting is disabled'; my $model = model(); @@ -44,12 +45,12 @@ is( $release->main_module, 'Scripts', 'main_module ok' ); [ { documentation => 'catalyst', - indexed => 1, + indexed => true, mime => 'text/x-script.perl' }, { documentation => 'starman', - indexed => 1, + indexed => true, mime => 'text/x-script.perl' } ], diff --git a/t/release/text-tabs-wrap.t b/t/release/text-tabs-wrap.t index b8f8e8dfd..aa8326ea6 100644 --- a/t/release/text-tabs-wrap.t +++ b/t/release/text-tabs-wrap.t @@ -3,6 +3,7 @@ use warnings; use lib 't/lib'; use MetaCPAN::TestHelpers qw( test_distribution test_release ); +use MetaCPAN::Util qw(true false); use Test::More; test_distribution( @@ -32,8 +33,8 @@ test_release( { distribution => 'Text-Tabs+Wrap', author => 'LOCAL', - authorized => 1, - first => 1, + authorized => true, + first => true, version => '2013.0523', # No modules. diff --git a/t/release/weblint++-1.15.t b/t/release/weblint++-1.15.t index 5d296edcd..bfec5bab7 100644 --- a/t/release/weblint++-1.15.t +++ b/t/release/weblint++-1.15.t @@ -3,6 +3,7 @@ use warnings; use lib 't/lib'; use MetaCPAN::TestHelpers qw( test_release ); +use MetaCPAN::Util qw(true false); use Test::More; test_release( { @@ -12,8 +13,8 @@ test_release( { distribution => 'weblint', author => 'LOCAL', - authorized => 1, - first => 1, + authorized => true, + first => true, version => '1.15', # No modules. diff --git a/t/release/www-tumblr-0.t b/t/release/www-tumblr-0.t index afa782cba..bd650048e 100644 --- a/t/release/www-tumblr-0.t +++ b/t/release/www-tumblr-0.t @@ -3,14 +3,15 @@ use warnings; use lib 't/lib'; use MetaCPAN::TestHelpers qw( test_release ); +use MetaCPAN::Util qw(true false); use Test::More; test_release( { name => 'WWW-Tumblr-0', distribution => 'WWW-Tumblr', author => 'LOCAL', - authorized => 1, - first => 1, + authorized => true, + first => true, version => '0', provides => [ 'WWW::Tumblr', ],