Skip to content

Commit

Permalink
Merge branch 'master' into mickey/use_versions_ep
Browse files Browse the repository at this point in the history
  • Loading branch information
mickeyn committed Jun 22, 2017
2 parents e6dbf34 + 8663dad commit 17a430c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 100 deletions.
11 changes: 2 additions & 9 deletions lib/MetaCPAN/Web/Controller/Release.pm
Expand Up @@ -2,9 +2,6 @@ package MetaCPAN::Web::Controller::Release;

use Moose;

use Importer 'MetaCPAN::Web::Elasticsearch::Adapter' =>
qw/ single_valued_arrayref_to_scalar /;

use namespace::autoclean;

BEGIN { extends 'MetaCPAN::Web::Controller' }
Expand Down Expand Up @@ -90,19 +87,15 @@ sub view : Private {

my @root_files = (
sort { $a->{name} cmp $b->{name} }
grep { $_->{path} !~ m{/} }
map { single_valued_arrayref_to_scalar($_) }
map { $_->{fields} } @{ $files->{hits}->{hits} }
grep { $_->{path} !~ m{/} } @{ $files->{files} }
);

my @examples = (
sort { $a->{path} cmp $b->{path} }
grep {
$_->{path} =~ m{\b(?:eg|ex|examples?|samples?)\b}i
and not $_->{path} =~ m{^x?t/}
}
map { single_valued_arrayref_to_scalar($_) }
map { $_->{fields} } @{ $files->{hits}->{hits} }
} @{ $files->{files} }
);

$c->res->last_modified( $out->{date} );
Expand Down
92 changes: 1 addition & 91 deletions lib/MetaCPAN/Web/Model/API/Release.pm
Expand Up @@ -213,97 +213,7 @@ sub reverse_dependencies {

sub interesting_files {
my ( $self, $author, $release ) = @_;
$self->request(
'/file/_search',
{
query => {
bool => {
must => [
{ term => { release => $release } },
{ term => { author => $author } },
{ term => { directory => \0 } },
{ not => { prefix => { 'path' => 'xt/' } } },
{ not => { prefix => { 'path' => 't/' } } },
{
bool => {
should => [
{
bool => {
must => [
{ term => { level => 0 } },
{
terms => {
name => [
qw(
AUTHORS
Build.PL
CHANGELOG
CHANGES
CONTRIBUTING
CONTRIBUTING.md
COPYRIGHT
CREDITS
ChangeLog
Changelog
Changes
Copying
FAQ
INSTALL
INSTALL.md
LICENCE
LICENSE
MANIFEST
META.json
META.yml
Makefile.PL
NEWS
README
README.markdown
README.md
README.mdown
README.mkdn
THANKS
TODO
ToDo
Todo
cpanfile
dist.ini
minil.toml
)
]
}
}
]
}
},
map {
{ prefix => { 'name' => $_ } },
{ prefix => { 'path' => $_ } },

# With "prefix" we don't need the plural "s".
} qw(
ex eg
example Example
sample
)
]
}
}
]
}
},

# NOTE: We could inject author/release/distribution into each result
# in the controller if asking ES for less data would be better.
fields => [
qw(
name documentation path pod_lines
author release distribution status
)
],
size => 250,
}
);
$self->request("/release/interesting_files/$author/$release");
}

sub versions {
Expand Down

0 comments on commit 17a430c

Please sign in to comment.