Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #451 from CPAN-API/mickey/es2_no_lazy_build
mickey/es2 no lazy build
  • Loading branch information
oalders committed Apr 18, 2016
2 parents 8d17d46 + 9e491b8 commit 281b31f
Show file tree
Hide file tree
Showing 30 changed files with 217 additions and 221 deletions.
7 changes: 4 additions & 3 deletions lib/Catalyst/Authentication/Store/Proxy.pm
Expand Up @@ -3,16 +3,17 @@ package Catalyst::Authentication::Store::Proxy;
# ABSTRACT: Delegates authentication logic to the user object
use Moose;
use Catalyst::Utils;
use MetaCPAN::Types qw( HashRef Str );

has user_class => (
is => 'ro',
required => 1,
isa => 'Str',
isa => Str,
lazy => 1,
builder => '_build_user_class'
);
has handles => ( is => 'ro', isa => 'HashRef' );
has config => ( is => 'ro', isa => 'HashRef' );
has handles => ( is => 'ro', isa => HashRef );
has config => ( is => 'ro', isa => HashRef );
has app => ( is => 'ro', isa => 'ClassName' );
has realm => ( is => 'ro' );

Expand Down
22 changes: 6 additions & 16 deletions lib/MetaCPAN/Document/Author.pm
Expand Up @@ -42,16 +42,11 @@ has pauseid => (

has user => ( is => 'rw' );

has dir => (
is => 'ro',
required => 1,
lazy_build => 1,
);

has gravatar_url => (
is => 'ro',
lazy_build => 1,
isa => NonEmptySimpleStr,
is => 'ro',
isa => NonEmptySimpleStr,
lazy => 1,
builder => '_build_gravatar_url',
);

has profile => (
Expand Down Expand Up @@ -93,7 +88,7 @@ has location => ( is => 'ro', isa => Location, coerce => 1, required => 0 );

has extra => (
is => 'ro',
isa => 'HashRef',
isa => HashRef,
source_only => 1,
dynamic => 1,
required => 0,
Expand All @@ -105,11 +100,6 @@ has updated => (
required => 0,
);

sub _build_dir {
my $pauseid = ref $_[0] ? shift->pauseid : shift;
return MetaCPAN::Util::author_dir($pauseid);
}

sub _build_gravatar_url {
my $self = shift;

Expand All @@ -121,7 +111,7 @@ sub _build_gravatar_url {
# (by assigning an image to his author@cpan.org)
# and now by changing this URL from metacpa.org
return Gravatar::URL::gravatar_url(
email => $self->{pauseid} . '@cpan.org',
email => $self->pauseid . '@cpan.org',
size => 130,
https => 1,

Expand Down
5 changes: 3 additions & 2 deletions lib/MetaCPAN/Document/Author/Profile.pm
Expand Up @@ -9,16 +9,17 @@ use ElasticSearchX::Model::Document;
with 'ElasticSearchX::Model::Document::EmbeddedRole';

use MetaCPAN::Util;
use MetaCPAN::Types qw( Str );

has name => (
is => 'ro',
isa => 'Str',
isa => Str,
required => 1,
);

has id => (
is => 'ro',
isa => 'Str',
isa => Str,
analyzer => ['simple'],
);

Expand Down
12 changes: 1 addition & 11 deletions lib/MetaCPAN/Document/Dependency.pm
Expand Up @@ -9,19 +9,9 @@ use ElasticSearchX::Model::Document;
with 'ElasticSearchX::Model::Document::EmbeddedRole';

use MetaCPAN::Util;
use MetaCPAN::Types qw( Str );

has [qw(phase relationship module version)] => ( is => 'ro', required => 1 );

has version_numified => (
is => 'ro',
required => 1,
isa => 'Str',
lazy_build => 1,
);

sub _build_version_numified {
return MetaCPAN::Util::numify_version( shift->version ) . q{};
}

__PACKAGE__->meta->make_immutable;
1;
126 changes: 65 additions & 61 deletions lib/MetaCPAN/Document/File.pm
Expand Up @@ -34,10 +34,10 @@ C<NAME> section. It also sets L</documentation> if it succeeds.
=cut

has abstract => (
is => 'ro',
required => 1,
lazy_build => 1,
index => 'analyzed',
is => 'ro',
lazy => 1,
builder => '_build_abstract',
index => 'analyzed',
);

sub _build_abstract {
Expand Down Expand Up @@ -147,10 +147,10 @@ whitespaces and POD commands.
=cut

has description => (
is => 'ro',
required => 1,
lazy_build => 1,
index => 'analyzed',
is => 'ro',
lazy => 1,
builder => '_build_description',
index => 'analyzed',
);

sub _build_description {
Expand Down Expand Up @@ -209,7 +209,7 @@ File is binary or not.

has binary => (
is => 'ro',
isa => 'Bool',
isa => Bool,
required => 1,
default => 0,
);
Expand All @@ -223,7 +223,7 @@ See L</set_authorized>.
has authorized => (
required => 1,
is => 'rw',
isa => 'Bool',
isa => Bool,
default => 1,
);

Expand All @@ -249,7 +249,7 @@ Return true if this object represents a directory.
has directory => (
is => 'ro',
required => 1,
isa => 'Bool',
isa => Bool,
default => 0,
);

Expand All @@ -267,13 +267,13 @@ set to C<undef>.
=cut

has documentation => (
required => 1,
is => 'rw',
lazy_build => 1,
index => 'analyzed',
predicate => 'has_documentation',
analyzer => [qw(standard camelcase lowercase edge edge_camelcase)],
clearer => 'clear_documentation',
is => 'rw',
lazy => 1,
builder => '_build_documentation',
index => 'analyzed',
predicate => 'has_documentation',
analyzer => [qw(standard camelcase lowercase edge edge_camelcase)],
clearer => 'clear_documentation',
);

sub _build_documentation {
Expand Down Expand Up @@ -312,7 +312,7 @@ not. See L</set_indexed> for a more verbose explanation.
has indexed => (
required => 1,
is => 'rw',
isa => 'Bool',
isa => Bool,
lazy => 1,
default => sub {
my ($self) = @_;
Expand All @@ -330,10 +330,10 @@ has a level of C<0>).
=cut

has level => (
is => 'ro',
required => 1,
isa => 'Int',
lazy_build => 1,
is => 'ro',
isa => Int,
lazy => 1,
builder => '_build_level',
);

sub _build_level {
Expand All @@ -351,9 +351,9 @@ are removed to save space and for better snippet previews.

has pod => (
is => 'ro',
required => 1,
isa => 'ScalarRef',
lazy_build => 1,
isa => ScalarRef,
lazy => 1,
builder => '_build_pod',
index => 'analyzed',
not_analyzed => 0,
store => 'no',
Expand Down Expand Up @@ -427,19 +427,19 @@ ArrayRef of ArrayRefs of offset and length of pod blocks. Example:
=cut

has pod_lines => (
is => 'ro',
required => 1,
isa => 'ArrayRef',
type => 'integer',
lazy_build => 1,
index => 'no',
is => 'ro',
isa => ArrayRef,
type => 'integer',
lazy => 1,
builder => '_build_pod_lines',
index => 'no',
);

sub _build_pod_lines {
my $self = shift;
return [] unless ( $self->is_perl_file );
my ( $lines, $slop ) = MetaCPAN::Util::pod_lines( ${ $self->content } );
$self->slop( $slop || 0 );
$self->_set_slop( $slop || 0 );
return $lines;
}

Expand All @@ -451,10 +451,10 @@ L</content> and returns the number of lines.
=cut

has sloc => (
is => 'ro',
required => 1,
isa => 'Int',
lazy_build => 1,
is => 'ro',
isa => Int,
lazy => 1,
builder => '_build_sloc',
);

# Metrics from Perl::Metrics2::Plugin::Core.
Expand Down Expand Up @@ -486,17 +486,20 @@ Source Lines of Pod. Returns the number of pod lines using L</pod_lines>.
=cut

has slop => (
is => 'ro',
required => 1,
isa => 'Int',
is => 'rw',
lazy_build => 1,
is => 'ro',
isa => Int,
lazy => 1,
default => '_build_slop',
writer => '_set_slop',
);

sub _build_slop {
my $self = shift;
return 0 unless ( $self->is_perl_file );
$self->_build_pod_lines;

# danger! infinite recursion if not set by `_build_pod_lines`
# we should probably find a better solution -- Mickey
return $self->slop;
}

Expand Down Expand Up @@ -527,24 +530,24 @@ has version => (

=head2 version_numified
B<Required>, B<Lazy Build>
B<Lazy Build>
Numeric representation of L</version>. Contains 0 if there is no version or the
version could not be parsed.
=cut

has version_numified => (
is => 'ro',
isa => 'Str',
lazy_build => 1,
required => 1,
is => 'ro',
isa => Num,
lazy => 1,
builder => '_build_version_numified',
);

sub _build_version_numified {
my $self = shift;
return 0 unless ( $self->version );
return MetaCPAN::Util::numify_version( $self->version ) . '';
return MetaCPAN::Util::numify_version( $self->version );
}

=head2 mime
Expand All @@ -554,9 +557,9 @@ MIME type of file. Derived using L<Plack::MIME> (for speed).
=cut

has mime => (
is => 'ro',
required => 1,
lazy_build => 1,
is => 'ro',
lazy => 1,
builder => '_build_mime',
);

sub _build_mime {
Expand All @@ -581,11 +584,11 @@ sub _build_path {
}

has dir => (
is => 'ro',
lazy_build => 1,
isa => 'Str',
required => 1,
index => 'not_analyzed'
is => 'ro',
isa => Str,
lazy => 1,
builder => '_build_dir',
index => 'not_analyzed'
);

sub _build_dir {
Expand Down Expand Up @@ -614,11 +617,12 @@ Built by calling L</content_cb>.
=cut

has content => (
is => 'ro',
isa => 'ScalarRef',
lazy_build => 1,
property => 0,
required => 0,
is => 'ro',
isa => ScalarRef,
lazy => 1,
builder => '_build_content',
property => 0,
required => 0,
);

sub _build_content {
Expand Down

0 comments on commit 281b31f

Please sign in to comment.