Permalink
Browse files

Merge branch 'release/0.42'

  • Loading branch information...
2 parents 2af1e3e + c827d59 commit 13f760afd72762bbf253bf3070efee12b9a33cef @gugod committed Mar 7, 2012
Showing with 64 additions and 15 deletions.
  1. +6 −0 .travis.yml
  2. +4 −0 Changes
  3. +2 −0 MANIFEST.SKIP
  4. +17 −7 lib/App/perlbrew.pm
  5. +6 −3 perlbrew
  6. +3 −2 t/09.exit_status.t
  7. +2 −2 t/13.perl_release.t
  8. 0 t/command-env.t
  9. +3 −1 t/command-help.t
  10. +21 −0 t/do_system.t
View
@@ -0,0 +1,6 @@
+language: perl
+perl:
+ - "5.14"
+ - "5.12"
+ - "5.10"
+before_install: cpanm --notest Module::Install
View
@@ -1,3 +1,7 @@
+0.42:
+- Improvement: die when running perlbrew (use|switch) with unknown installation name.
+- clean 'build.log' on install. ref: RT #69168.
+
0.41:
- Fix installation issue when the specified version is not listed in CPAN::Perl::Releases
- Fix sub-shell invocation for 'switch' and 'use' command. This is particularly for csh users, but it should also work for bash users.
View
@@ -34,3 +34,5 @@
^MYMETA.yml$
^t/mock_perlbrew_root/
^.prove$
+^.travis.yml$
+
View
@@ -9,7 +9,7 @@ use File::Path::Tiny;
use FindBin;
use CPAN::Perl::Releases;
-our $VERSION = "0.41";
+our $VERSION = "0.42";
our $CONFIG;
our $PERLBREW_ROOT = $ENV{PERLBREW_ROOT} || catdir($ENV{HOME}, "perl5", "perlbrew");
@@ -122,8 +122,7 @@ perlbrew () {
if [[ -z "$2" ]] ; then
command perlbrew switch
else
- perlbrew use $2
- __perlbrew_reinit $2
+ perlbrew use $2 && __perlbrew_reinit $2
fi
;;
@@ -618,7 +617,7 @@ sub perl_release {
if ($x) {
my $dist_tarball = (split("/", $x))[-1];
- my $dist_tarball_url = "http://search.cpan.org//CPAN/authors/id/$x";
+ my $dist_tarball_url = "http://search.cpan.org/CPAN/authors/id/$x";
return ($dist_tarball, $dist_tarball_url);
}
@@ -634,7 +633,7 @@ sub perl_release {
$html =~ m[<a href="(/CPAN/authors/id/.+/(perl-${version}.tar.(gz|bz2)))">Download</a>];
die "ERROR: Cannot find the tarball for perl-$version\n"
if !$dist_path and !$dist_tarball;
- my $dist_tarball_url = "http://search.cpan.org/CPAN/authors/id/${dist_path}";
+ my $dist_tarball_url = "http://search.cpan.org${dist_path}";
return ($dist_tarball, $dist_tarball_url);
}
@@ -1026,6 +1025,9 @@ INSTALL
$make,
@install
);
+
+ unlink($self->{log_file});
+
if($self->{verbose}) {
$cmd = "($cmd) 2>&1 | tee $self->{log_file}";
print "$cmd\n" if $self->{verbose};
@@ -1062,6 +1064,10 @@ SUCCESS
else {
die <<FAIL;
Installing $dist_extracted_dir failed. See $self->{log_file} to see why.
+You might want to try upgrading patchperl before trying again:
+
+ perlbrew install-patchperl
+
If you want to force install the distribution, try:
perlbrew --force install $self->{dist_name}
@@ -1072,8 +1078,8 @@ FAIL
}
sub do_system {
- my ($self, $cmd) = @_;
- return ! system($cmd);
+ my ($self, @cmd) = @_;
+ return ! system(@cmd);
}
sub do_capture {
@@ -1158,6 +1164,10 @@ sub perlbrew_env {
if ($name) {
my ($perl_name, $lib_name) = $self->resolve_installation_name($name);
+ unless ($perl_name) {
+ die "\nERROR: The installation \"$name\" is unknown.\n\n";
+ }
+
if(-d "@{[ $self->root ]}/perls/$perl_name/bin") {
$env{PERLBREW_PERL} = $perl_name;
$env{PERLBREW_PATH} .= ":" . catdir($self->root, "perls", $perl_name, "bin");
View
Oops, something went wrong.
View
@@ -21,10 +21,11 @@ throws_ok(
qr[unknown-command]
);
-system("perl -Ilib ${bin_perlbrew} unknown-command 2>&1");
+my $perl = $^X;
+system("$perl -Ilib ${bin_perlbrew} unknown-command 2>&1");
ok($? != 0);
-system("perl -Ilib ${bin_perlbrew} version 2>&1");
+system("$perl -Ilib ${bin_perlbrew} version 2>&1");
ok($? == 0);
done_testing;
View
@@ -36,8 +36,8 @@ describe "App::perlbrew#perl_release method" => sub {
my $app = App::perlbrew->new;
my ($ball, $url) = $app->perl_release($version);
- like $ball, qr/perl-?${version}.tar.(bz2|gz)/, $ball;
- like $url, qr#authors/id/.+/${ball}$#, $url;
+ like $ball, qr/^perl-?${version}.tar.(bz2|gz)$/, $ball;
+ like $url, qr#^https?://search\.cpan\.org/CPAN/authors/id/SOMEONE/${ball}$#, $url;
*CPAN::Perl::Releases::perl_tarballs = $orig_sub;
};
View
0 t/command-env.t 100755 → 100644
No changes.
View
@@ -15,7 +15,9 @@ my $bin_perlbrew = file(__FILE__)->dir->parent->subdir("bin")->file("perlbrew");
describe "help" => sub {
it "should instruct user to read help for individual commands." => sub {
- my $out = `perl -Ilib $bin_perlbrew help`;
+ my $perl = $^X;
+
+ my $out = `$perl -Ilib $bin_perlbrew help`;
like $out, qr/perlbrew help <command>/si;
};
};
View
@@ -0,0 +1,21 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 2;
+
+# test that 'do_system' wraps 'system' correctly
+
+our @system;
+BEGIN {
+ *CORE::GLOBAL::system = sub { @system = @_; };
+}
+use App::perlbrew;
+
+# don't actually run() it, we just want to call do_system
+my $app = App::perlbrew->new('list');
+
+$app->do_system(qw(perl -E), 'say 42');
+is_deeply \@system, [qw(perl -E), 'say 42'], 'passed all arguments to system()';
+
+$app->do_system("perl -e 'say 42'");
+is_deeply \@system, ["perl -e 'say 42'"], 'passed single string to system()';

0 comments on commit 13f760a

Please sign in to comment.