Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: wolfsage/cpan-api
...
head fork: wolfsage/cpan-api
  • 13 commits
  • 6 files changed
  • 0 commit comments
  • 4 contributors
Commits on Mar 30, 2012
@wolfsage Update fakecpan.t to bail out if Elastic Search is not running.
Also, minor clean up of favorite.t
9ea9597
@mpeters mpeters ignore metacpan_server_local.conf file 43988ac
@wolfsage Merge pull request #180 from mpeters/master
Ignore metacpan_server_local.conf
5662c11
Commits on Mar 31, 2012
Chris Nehren Add a program to automate JSON file creation for testing the fakecpan…
… system. It

takes a directory on the commandline which is the root of an extracted
distribution and generates a CPAN::Faker-compatible JSON document on STDOUT.
c685784
Chris Nehren Update the dist.ini for the previously committed program 76faaae
@mpeters mpeters ignore vi droppings 295a27a
@mpeters mpeters Merge branch 'master' of https://github.com/CPAN-API/cpan-api 847ed6a
@mpeters mpeters Fixing issue #508
POD is being lost for modules that only have perl libs in the top level
directory when they should be in a nested lib/ structure. So don't drop
the path if the file isn't in a directory if it's a .pm file.

Not 100% sure this is the best way to tackle this, but it fixes it very
early on (when the release is indexed) and works for all the modules
I tested.
73564fc
@mpeters mpeters ignore vim swap files 1a59fd2
@mpeters mpeters merging from master to simplify .gitignore rules 05da603
@mpeters mpeters This is a better fix for web issue #508 since it asks Archvive::Any
if the tarball extracted politely. That way we don't remove the path
from those things that need it.
e57707e
@oalders oalders Merge pull request #183 from mpeters/web_issue_508
Web issue 508
198699e
@oalders oalders Merge pull request #174 from wolfsage/minor-test-fixes-2
Update fakecpan.t to bail out if Elastic Search is not running.
339af1c
View
2  .gitignore
@@ -1,4 +1,5 @@
.DS_Store
+*.sw*
*.kpf
*.komodoproject
*.sqlite*
@@ -6,3 +7,4 @@
/var/log/metacpan.*
/t/var/tmp/
/etc/metacpan_local.pl
+metacpan_server_local.conf
View
89 bin/write_config_json
@@ -0,0 +1,89 @@
+#!/usr/bin/perl
+# takes the root directory of an extracted distribution and outputs a JSON file
+# suitable for CPAN::Faker to STDOUT
+use strictures 1;
+use JSON;
+use YAML;
+
+use IO::All;
+use Email::Address;
+use File::Find;
+use File::Spec;
+use Path::Class;
+
+my ($dir) = @ARGV;
+
+my $meta_data;
+if(-e "$dir/META.yml") {
+ $meta_data = YAML::LoadFile("$dir/META.yml");
+} elsif(-e "$dir/META.json") {
+ $meta_data = JSON::decode_json(io("$dir/META.json")->all);
+} else {
+ die "no meta file";
+}
+
+my $authors = $meta_data->{author};
+my @authors = map { my ($addr) = Email::Address->parse($_); $addr->name } @$authors;
+
+my $files;
+File::Find::find(
+ {
+ no_chdir => 1,
+ wanted => sub {
+ return unless -f;
+ push @$files, {
+ file => File::Spec->abs2rel($File::Find::name, dir($dir)),
+ content => io($_)->all,
+ }
+ },
+ },
+ $dir
+);
+
+my $output = {
+ name => $meta_data->{name},
+ version => $meta_data->{version},
+ abstract => $meta_data->{abstract},
+ X_Module_Faker => {
+ cpan_author => [ @authors ],
+ append => [
+ $files
+ ]
+ },
+};
+
+print JSON->new->pretty->encode($output);
+
+__DATA__
+{
+ "name": "MetaFile-Both",
+ "abstract": "A dist with META.yml and META.json",
+ "version": 1.1,
+ "X_Module_Faker": {
+ "cpan_author": "LOCAL",
+ "append": [ {
+ "file": "lib/MetaFile/Both.pm",
+ "content": "package MetaFile::Both;\n\n=head1 NAME\n\nMetaFile::Both - abstract"
+ },
+ {
+ "file": "META.json",
+ "content": "{\"meta-spec\":{\"version\":2,\"url\":\"http://search.cpan.org/perldoc?CPAN::Meta::Spec\"},\"generated_by\":\"hand\",\"version\":1.1,\"name\":\"MetaFile-Both\",\"dynamic_config\":0,\"author\":\"LOCAL\",\"license\":\"unknown\",\"abstract\":\"A dist with META.yml and META.json\",\"release_status\":\"stable\",\"x_meta_file\":\"json\"}"
+ },
+ {
+ "file": "t/foo.t",
+ "content": "use Test::More;"
+ } ]
+ }
+}
+
+---
+name: SignedModule
+version: 1.1
+abstract: A signed dist
+author:
+ - LOCAL <LOCAL@cpan.local>
+generated_by: Module::Faker version
+license: unknown
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.3.html
+ version: 1.3
View
8 dist.ini
@@ -51,3 +51,11 @@ CHI = 0
ElasticSearchX::Model = 0.1.0
CatalystX::InjectComponent = 0
Captcha::reCAPTCHA = 0.94
+
+strictures = 1
+IO::All = 0
+JSON = 2
+YAML = 0
+Email::Address = 0
+File::Find = 0
+Path::Class = 0
View
6 lib/MetaCPAN/Script/Release.pm
@@ -177,9 +177,9 @@ sub import_tarball {
my $at = Archive::Any->new($tarball);
my $tmpdir = dir( File::Temp::tempdir( CLEANUP => 0 ) );
+ log_error { "$tarball is being impolite" } if $at->is_impolite;
# TODO: add release to the index with status => 'broken' and move along
- log_error {"$tarball is being naughty"}
- if $at->is_naughty || $at->is_impolite;
+ log_error { "$tarball is being naughty" } if $at->is_naughty;
log_debug {"Extracting archive to filesystem"};
$at->extract($tmpdir);
@@ -248,7 +248,7 @@ sub import_tarball {
$child->is_dir
? $fname =~ s/^(.*\/)?(.+?)\/?$/$2/
: $fname =~ s/.*\///;
- $fpath = "" unless ( $relative =~ /\// );
+ $fpath = "" if $relative !~ /\// && !$at->is_impolite;
my $file = $file_set->new_document(
Dlog_trace {"adding file $_"} +{
name => $fname,
View
21 t/fakecpan.t
@@ -16,9 +16,24 @@ ok( my $es = ElasticSearch->new(
transport => 'httplite',
servers => '127.0.0.1:9900',
# trace_calls => 1,
- ),
- 'connect to es'
-);
+), 'got ElasticSearch object');
+
+eval {
+ $es->transport->refresh_servers;
+};
+
+ok(!$@, "Connected to the ElasticSearch test instance on 127.0.0.1:9900")
+ or do {
+ diag(<<EOF);
+Failed to connect to the ElasticSearch test instance on 127.0.0.1:9900.
+Did you start one up? See https://github.com/CPAN-API/cpan-api/wiki/Installation
+for more information.
+EOF
+
+ BAIL_OUT("Test environment not set up properly");
+};
+
+
my $config = MetaCPAN::Script::Runner->build_config;
$config->{es} = $es;
View
2  t/server/controller/user/favorite.t
@@ -50,7 +50,7 @@ test_psgi app, sub {
),
"POST favorite"
);
- ok( $json = decode_json( $res->content ), 'decode response' );
+ ok( decode_json( $res->content ), 'decode response' );
is( $res->code, 403, 'forbidden' );
};

No commit comments for this range

Something went wrong with that request. Please try again.