@@ -2,11 +2,9 @@ package MetaCPAN::Role::Script;
22
33use Moose::Role;
44
5- use ElasticSearchX::Model::Document::Types qw( :all) ;
65use FindBin;
76use Git::Helpers qw( checkout_root ) ;
87use Log::Contextual qw( :log :dlog ) ;
9- use MetaCPAN::Model;
108use MetaCPAN::Types qw( :all) ;
119use Mojo::Server;
1210use Term::ANSIColor qw( colored ) ;
@@ -16,8 +14,10 @@ use File::Path ();
1614
1715use Carp ();
1816
19- with( ' MetaCPAN::Role::HasConfig' , ' MetaCPAN::Role::Fastly' ,
20- ' MetaCPAN::Role::Logger' );
17+ with(
18+ ' MetaCPAN::Role::HasConfig' , ' MetaCPAN::Role::Fastly' ,
19+ ' MetaCPAN::Role::Logger' , ' MetaCPAN::Role::ES'
20+ );
2121
2222has cpan => (
2323 is => ' ro' ,
@@ -48,21 +48,6 @@ has proxy => (
4848 default => ' ' ,
4949);
5050
51- has es => (
52- is => ' ro' ,
53- isa => ES,
54- required => 1,
55- coerce => 1,
56- documentation => ' Elasticsearch http connection string' ,
57- );
58-
59- has model => (
60- is => ' ro' ,
61- lazy => 1,
62- builder => ' _build_model' ,
63- traits => [' NoGetopt' ],
64- );
65-
6651has index => (
6752 reader => ' _index' ,
6853 is => ' ro' ,
@@ -119,7 +104,6 @@ sub BUILDARGS {
119104 unless $ENV {' ES_SCRIPT_INDEX' }
120105 and $args {' index' } eq $ENV {' ES_SCRIPT_INDEX' };
121106 }
122-
123107 return \%args ;
124108}
125109
@@ -133,18 +117,6 @@ sub handle_error {
133117 Carp::croak $error if $self -> die_on_error;
134118}
135119
136- sub index {
137- my $self = shift ;
138- return $self -> model-> index ( $self -> _index );
139- }
140-
141- sub _build_model {
142- my $self = shift ;
143-
144- # es provided by ElasticSearchX::Model::Role
145- return MetaCPAN::Model-> new( es => $self -> es );
146- }
147-
148120sub _build_ua {
149121 my $self = shift ;
150122 my $ua = LWP::UserAgent-> new;
0 commit comments