r75259 - in /branches/upstream/perlbrew/current: ./ lib/App/ t/ t/mock_perlbrew_root/

ghedo-guest at users.alioth.debian.org ghedo-guest at users.alioth.debian.org
Wed Jun 8 10:29:22 UTC 2011


Author: ghedo-guest
Date: Wed Jun  8 10:28:50 2011
New Revision: 75259

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=75259
Log:
[svn-upgrade] new version perlbrew (0.24)

Added:
    branches/upstream/perlbrew/current/t/08.error_available.t
    branches/upstream/perlbrew/current/t/08.error_install.t
    branches/upstream/perlbrew/current/t/08.error_install_blead.t
    branches/upstream/perlbrew/current/t/08.error_install_cpanm.t
    branches/upstream/perlbrew/current/t/08.error_mirror.t
    branches/upstream/perlbrew/current/t/installation2.t
Removed:
    branches/upstream/perlbrew/current/t/mock_perlbrew_root/
Modified:
    branches/upstream/perlbrew/current/Changes
    branches/upstream/perlbrew/current/MANIFEST
    branches/upstream/perlbrew/current/META.yml
    branches/upstream/perlbrew/current/Makefile.PL
    branches/upstream/perlbrew/current/lib/App/perlbrew.pm

Modified: branches/upstream/perlbrew/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/perlbrew/current/Changes?rev=75259&op=diff
==============================================================================
--- branches/upstream/perlbrew/current/Changes (original)
+++ branches/upstream/perlbrew/current/Changes Wed Jun  8 10:28:50 2011
@@ -1,3 +1,8 @@
+0.24:
+- Done GH #92 -- Show error messages on network errors.
+- Fix GH #82 -- deduplicate items in PATH for the `list` command.
+- Tests for various commands and methods.
+
 0.23:
 - dependency fixes
 - Fix auto-detection of curl

Modified: branches/upstream/perlbrew/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/perlbrew/current/MANIFEST?rev=75259&op=diff
==============================================================================
--- branches/upstream/perlbrew/current/MANIFEST (original)
+++ branches/upstream/perlbrew/current/MANIFEST Wed Jun  8 10:28:50 2011
@@ -27,6 +27,10 @@
 t/05.get_current_perl.t
 t/06.installed_perls.t
 t/07.argv.t
+t/08.error_available.t
+t/08.error_install.t
+t/08.error_install_blead.t
+t/08.error_install_cpanm.t
+t/08.error_mirror.t
 t/installation.t
-t/mock_perlbrew_root/perls/perl-5.14.0/bin/perl
-t/mock_perlbrew_root/perls/the-dude/bin/perl
+t/installation2.t

Modified: branches/upstream/perlbrew/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/perlbrew/current/META.yml?rev=75259&op=diff
==============================================================================
--- branches/upstream/perlbrew/current/META.yml (original)
+++ branches/upstream/perlbrew/current/META.yml Wed Jun  8 10:28:50 2011
@@ -10,6 +10,7 @@
   Test::More: 0
   Test::Output: 0
   Test::Simple: 0
+  Test::Spec: 0
 configure_requires:
   ExtUtils::MakeMaker: 6.42
 distribution_type: module
@@ -31,4 +32,4 @@
 resources:
   license: http://opensource.org/licenses/mit-license.php
   repository: git://github.com/gugod/App-perlbrew.git
-version: 0.23
+version: 0.24

Modified: branches/upstream/perlbrew/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/perlbrew/current/Makefile.PL?rev=75259&op=diff
==============================================================================
--- branches/upstream/perlbrew/current/Makefile.PL (original)
+++ branches/upstream/perlbrew/current/Makefile.PL Wed Jun  8 10:28:50 2011
@@ -55,6 +55,7 @@
 test_requires 'Test::More';
 test_requires 'Test::Output';
 test_requires 'Test::Exception';
+test_requires 'Test::Spec';
 test_requires 'Path::Class';
 test_requires 'IO::All';
 

Modified: branches/upstream/perlbrew/current/lib/App/perlbrew.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/perlbrew/current/lib/App/perlbrew.pm?rev=75259&op=diff
==============================================================================
--- branches/upstream/perlbrew/current/lib/App/perlbrew.pm (original)
+++ branches/upstream/perlbrew/current/lib/App/perlbrew.pm Wed Jun  8 10:28:50 2011
@@ -5,7 +5,7 @@
 use Getopt::Long ();
 use File::Spec::Functions qw( catfile );
 
-our $VERSION = "0.23";
+our $VERSION = "0.24";
 our $CONF;
 
 my $ROOT         = $ENV{PERLBREW_ROOT} || "$ENV{HOME}/perl5/perlbrew";
@@ -386,6 +386,10 @@
     my $url = "http://www.cpan.org/src/README.html";
     my $html = http_get( $url, undef, undef );
 
+    unless($html) {
+        die "\nERROR: Unable to retrieve the list of perls.\n\n";
+    }
+
     my @available_versions;
 
     for ( split "\n", $html ) {
@@ -579,9 +583,13 @@
     print "Fetching $dist_git_describe as $dist_tarball_path\n";
     http_get(
         "http://perl5.git.perl.org/perl.git/snapshot/$dist_tarball",
-        undef,
         sub {
             my ($body) = @_;
+
+            unless ($body) {
+                die "\nERROR: Failed to download perl-blead tarball.\n\n";
+            }
+
             open my $BALL, "> $dist_tarball_path" or die "Couldn't open $dist_tarball_path: $!";
             print $BALL $body;
             close $BALL;
@@ -616,6 +624,10 @@
     my $mirror = $self->conf->{mirror};
     my $header = $mirror ? { 'Cookie' => "cpan=$mirror->{url}" } : undef;
     my $html = http_get("http://search.cpan.org/dist/$dist", $header);
+
+    unless ($html) {
+        die "ERROR: Failed to download $dist tarball.";
+    }
 
     my ($dist_path, $dist_tarball) =
         $html =~ m[<a href="(/CPAN/authors/id/.+/(${dist}.tar.(gz|bz2)))">Download</a>];
@@ -826,7 +838,7 @@
     $current_perl_executable =~ s/\n$//;
 
     my $current_perl_executable_version;
-    for ( uniq grep { -f $_ && -x $_ } map { "$_/perl" } split(":", $self->env('PATH')) ) {
+    for ( grep { -f $_ && -x $_ } uniq map { s/\/+$//; "$_/perl" } split(":", $self->env('PATH')) ) {
         $current_perl_executable_version =
           $self->format_perl_version(`$_ -e 'print \$]'`);
         push @result, {
@@ -949,6 +961,11 @@
     my($self) = @_;
     print "Fetching mirror list\n";
     my $raw = http_get("http://search.cpan.org/mirror");
+
+    unless ($raw) {
+        die "\nERROR: Failed to retrive the mirror list.\n\n";
+    }
+
     my $found;
     my @mirrors;
     foreach my $line ( split m{\n}, $raw ) {
@@ -1039,6 +1056,10 @@
     my ($self, $perl) = @_;
     my $body = http_get('https://github.com/miyagawa/cpanminus/raw/master/cpanm');
 
+    unless ($body) {
+        die "\nERROR: Failed to retrive cpanm executable.\n\n";
+    }
+
     open my $CPANM, '>', "$ROOT/bin/cpanm" or die "cannot open file($ROOT/bin/cpanm): $!";
     print $CPANM $body;
     close $CPANM;

Added: branches/upstream/perlbrew/current/t/08.error_available.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/perlbrew/current/t/08.error_available.t?rev=75259&op=file
==============================================================================
--- branches/upstream/perlbrew/current/t/08.error_available.t (added)
+++ branches/upstream/perlbrew/current/t/08.error_available.t Wed Jun  8 10:28:50 2011
@@ -1,0 +1,20 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use lib qw(lib);
+use App::perlbrew;
+use Test::More;
+use Test::Exception;
+
+no warnings 'redefine';
+sub App::perlbrew::http_get { "" }
+
+throws_ok(
+    sub {
+        my $app = App::perlbrew->new("available");
+        $app->run;
+    },
+    qr[ERROR: Unable to retrieve the list of perls.]
+);
+
+done_testing;

Added: branches/upstream/perlbrew/current/t/08.error_install.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/perlbrew/current/t/08.error_install.t?rev=75259&op=file
==============================================================================
--- branches/upstream/perlbrew/current/t/08.error_install.t (added)
+++ branches/upstream/perlbrew/current/t/08.error_install.t Wed Jun  8 10:28:50 2011
@@ -1,0 +1,30 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use lib qw(lib);
+use Test::More;
+use Test::Exception;
+use Path::Class;
+
+BEGIN {
+    $ENV{PERLBREW_ROOT} = file(__FILE__)->dir->subdir("mock_perlbrew_root");
+}
+
+use App::perlbrew;
+
+App::perlbrew::rmpath( $ENV{PERLBREW_ROOT} );
+App::perlbrew::mkpath( dir($ENV{PERLBREW_ROOT})->subdir("perls") );
+App::perlbrew::mkpath( dir($ENV{PERLBREW_ROOT})->subdir("build") );
+
+no warnings 'redefine';
+sub App::perlbrew::http_get { "" }
+
+throws_ok(
+    sub {
+        my $app = App::perlbrew->new("install", "perl-5.12.3");
+        $app->run;
+    },
+    qr[ERROR: Failed to download perl-5.12.3 tarball.]
+);
+
+done_testing;

Added: branches/upstream/perlbrew/current/t/08.error_install_blead.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/perlbrew/current/t/08.error_install_blead.t?rev=75259&op=file
==============================================================================
--- branches/upstream/perlbrew/current/t/08.error_install_blead.t (added)
+++ branches/upstream/perlbrew/current/t/08.error_install_blead.t Wed Jun  8 10:28:50 2011
@@ -1,0 +1,42 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use lib qw(lib);
+use Test::More;
+use Test::Exception;
+use Path::Class;
+
+BEGIN {
+    $ENV{PERLBREW_ROOT} = file(__FILE__)->dir->subdir("mock_perlbrew_root");
+}
+
+use App::perlbrew;
+{
+    no warnings 'redefine';
+    sub App::perlbrew::http_get {
+        my ($url, $cb) = @_;
+        $cb->("");
+    }
+}
+
+App::perlbrew::rmpath( $ENV{PERLBREW_ROOT} );
+App::perlbrew::mkpath( dir($ENV{PERLBREW_ROOT})->subdir("perls") );
+App::perlbrew::mkpath( dir($ENV{PERLBREW_ROOT})->subdir("build") );
+
+throws_ok(
+    sub {
+        my $app = App::perlbrew->new("install", "perl-blead");
+        $app->run;
+    },
+    qr[ERROR: Failed to download perl-blead tarball.]
+);
+
+throws_ok(
+    sub {
+        my $app = App::perlbrew->new("install", "blead");
+        $app->run;
+    },
+    qr[ERROR: Failed to download perl-blead tarball.]
+);
+
+done_testing;

Added: branches/upstream/perlbrew/current/t/08.error_install_cpanm.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/perlbrew/current/t/08.error_install_cpanm.t?rev=75259&op=file
==============================================================================
--- branches/upstream/perlbrew/current/t/08.error_install_cpanm.t (added)
+++ branches/upstream/perlbrew/current/t/08.error_install_cpanm.t Wed Jun  8 10:28:50 2011
@@ -1,0 +1,20 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use lib qw(lib);
+use App::perlbrew;
+use Test::More;
+use Test::Exception;
+
+no warnings 'redefine';
+sub App::perlbrew::http_get { "" }
+
+throws_ok(
+    sub {
+        my $app = App::perlbrew->new("install-cpanm");
+        $app->run;
+    },
+    qr[ERROR: Failed to retrive cpanm executable.]
+);
+
+done_testing;

Added: branches/upstream/perlbrew/current/t/08.error_mirror.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/perlbrew/current/t/08.error_mirror.t?rev=75259&op=file
==============================================================================
--- branches/upstream/perlbrew/current/t/08.error_mirror.t (added)
+++ branches/upstream/perlbrew/current/t/08.error_mirror.t Wed Jun  8 10:28:50 2011
@@ -1,0 +1,20 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use lib qw(lib);
+use App::perlbrew;
+use Test::More;
+use Test::Exception;
+
+no warnings 'redefine';
+sub App::perlbrew::http_get { "" }
+
+throws_ok(
+    sub {
+        my $app = App::perlbrew->new("mirror");
+        $app->run;
+    },
+    qr"ERROR: Failed to retrive the mirror list."
+);
+
+done_testing;

Added: branches/upstream/perlbrew/current/t/installation2.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/perlbrew/current/t/installation2.t?rev=75259&op=file
==============================================================================
--- branches/upstream/perlbrew/current/t/installation2.t (added)
+++ branches/upstream/perlbrew/current/t/installation2.t Wed Jun  8 10:28:50 2011
@@ -1,0 +1,63 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+use Path::Class;
+BEGIN {
+    $ENV{PERLBREW_ROOT} = file(__FILE__)->dir->subdir("mock_perlbrew_root");
+}
+
+use Test::Spec;
+
+use App::perlbrew;
+
+## setup
+
+
+
+##
+
+note "PERLBREW_ROOT set to $ENV{PERLBREW_ROOT}";
+
+describe "App::perlbrew" => sub {
+    before each => sub {
+        App::perlbrew::rmpath( $ENV{PERLBREW_ROOT} );
+        App::perlbrew::mkpath( $ENV{PERLBREW_ROOT} );
+    };
+
+    describe "->do_install_url method" => sub {
+        it "should accept an URL to perl tarball, and download the tarball." => sub {
+            my $app = App::perlbrew->new;
+
+            my @expectations;
+            push @expectations, App::perlbrew->expects("http_get")->returns("Not going to GET it!");
+            push @expectations, $app->expects("do_extract_tarball")->returns("");
+            push @expectations, $app->expects("do_install_this")->returns("");
+
+            $app->do_install_url("http://example.com/perl-5.14.0.tar.gz");
+
+            for(@expectations) {
+                ok $_->verify;
+            }
+            pass;
+        }
+    };
+
+    describe "->do_install_archive method" => sub {
+        it "accepts a path to perl tarball and perform installation process." => sub {
+            my $app = App::perlbrew->new;
+
+            my $e1 = $app->expects("do_extract_tarball")->returns("/a/fake/path/to/perl-5.12.3");
+            my $e2 = $app->expects("do_install_this")->returns("");
+
+            $app->do_install_archive("/a/fake/path/to/perl-5.12.3.tar.gz");
+
+            ok $e1->verify, "do_extract_tarball is called";
+            ok $e2->verify, "do_install_this is called";
+            pass;
+        }
+    };
+
+};
+
+runtests unless caller;




More information about the Pkg-perl-cvs-commits mailing list