This is an automated email from the git hooks/post-receive script. kanashiro-guest pushed a commit to branch master in repository carton.
commit 4f2c96349830511e2f5dcf99e24ff7da0a4e6177 Author: Tatsuhiko Miyagawa <[email protected]> Date: Wed Jun 5 14:44:59 2013 +0900 use Path::Tiny. Also saves temp index in ./local not .carton --- cpanfile | 1 + lib/Carton/Builder.pm | 13 +++++-------- lib/Carton/CLI.pm | 28 +++++++++++----------------- xt/CLI.pm | 29 +++++++++-------------------- 4 files changed, 26 insertions(+), 45 deletions(-) diff --git a/cpanfile b/cpanfile index b2627ea..670dcb1 100644 --- a/cpanfile +++ b/cpanfile @@ -14,6 +14,7 @@ requires 'local::lib', 1.008; requires 'Exception::Class', 1.32; requires 'Getopt::Long', 2.39; requires 'Moo', '1.002'; +requires 'Path::Tiny', '0.022'; # MYMETA support requires 'App::cpanminus', 1.6915; diff --git a/lib/Carton/Builder.pm b/lib/Carton/Builder.pm index 1edaf29..0157da1 100644 --- a/lib/Carton/Builder.pm +++ b/lib/Carton/Builder.pm @@ -1,8 +1,5 @@ package Carton::Builder; use strict; -use File::Path (); -use File::Basename (); -use File::Copy (); use Moo; has mirror => (is => 'rw'); @@ -31,13 +28,13 @@ sub bundle { my($self, $path, $cache_path, $lock) = @_; for my $dist ($lock->distributions) { - my $source = "$path/cache/authors/id/" . $dist->pathname; - my $target = "$cache_path/authors/id/" . $dist->pathname; + my $source = $path->child("cache/authors/id/" . $dist->pathname); + my $target = $cache_path->child("authors/id/" . $dist->pathname); - if (-f $source) { + if ($source->exists) { warn "Copying ", $dist->pathname, "\n"; - File::Path::mkpath([ File::Basename::dirname($target) ], 0, 0777); - File::Copy::copy($source, $target) or warn "$target: $!"; + $target->parent->mkpath; + $source->copy($target) or warn "$target: $!"; } else { warn "Couldn't find @{[ $dist->pathname ]}\n"; } diff --git a/lib/Carton/CLI.pm b/lib/Carton/CLI.pm index 3205597..3d84fe8 100644 --- a/lib/Carton/CLI.pm +++ b/lib/Carton/CLI.pm @@ -13,6 +13,7 @@ use Carton::Lock; use Carton::Util; use Carton::Error; use Carton::Requirements; +use Path::Tiny; use Try::Tiny; use Moo; @@ -24,34 +25,32 @@ our $UseSystem = 0; # 1 for unit testing has verbose => (is => 'rw'); has carton => (is => 'lazy'); -has workdir => (is => 'lazy'); has mirror => (is => 'rw', builder => 1, coerce => sub { Carton::Mirror->new($_[0]) }); -sub _build_workdir { - my $self = shift; - $ENV{PERL_CARTON_HOME} || (Cwd::cwd() . "/.carton"); -} - sub _build_mirror { my $self = shift; $ENV{PERL_CARTON_MIRROR} || $Carton::Mirror::DefaultMirror; } sub install_path { - $ENV{PERL_CARTON_PATH} || File::Spec->rel2abs('local'); + Path::Tiny->new($ENV{PERL_CARTON_PATH} || 'local')->absolute; +} + +sub work_file { + my($self, $file) = @_; + my $wf = $self->install_path->child($file); + $wf->parent->mkpath; + $wf; } sub vendor_cache { - File::Spec->rel2abs("vendor/cache"); + Path::Tiny->new("vendor/cache")->absolute; } sub run { my($self, @args) = @_; - my $dir = $self->workdir; - mkdir $dir, 0777 unless -e $dir; - my @commands; my $p = Getopt::Long::Parser->new( config => [ "no_ignore_case", "pass_through" ], @@ -343,14 +342,9 @@ sub lock_file { return 'carton.lock'; } -sub work_file { - my($self, $file) = @_; - return join "/", $self->workdir, $file; -} - sub index_file { my $self = shift; - $self->work_file("02packages.details.txt"); + $self->work_file("cache/modules/02packages.details.txt"); } 1; diff --git a/xt/CLI.pm b/xt/CLI.pm index 62ab801..ad64001 100644 --- a/xt/CLI.pm +++ b/xt/CLI.pm @@ -6,32 +6,21 @@ our @EXPORT = qw(run cli); use Test::Requires qw( Directory::Scratch Capture::Tiny File::pushd ); sub cli { - my $dir = Directory::Scratch->new(CLEANUP => !$ENV{NO_CLEANUP}); - Carton::CLI::Tested->new(dir => $dir); + my $cli = Carton::CLI::Tested->new; + $cli->dir( Directory::Scratch->new(CLEANUP => !$ENV{NO_CLEANUP}) ); + $cli; } package Carton::CLI::Tested; -use parent qw(Carton::CLI); - -$Carton::CLI::UseSystem = 1; - use Capture::Tiny qw(capture); use File::pushd (); -use File::Path (); - -sub new { - my($class, %args) = @_; - - my $self = $class->SUPER::new; - $self->{dir} = $args{dir}; +use Path::Tiny; +use Moo; - return $self; -} +extends 'Carton::CLI'; +$Carton::CLI::UseSystem = 1; -sub dir { - my $self = shift; - $self->{dir}; -} +has dir => (is => 'rw'); sub print { my $self = shift; @@ -64,7 +53,7 @@ sub system_error { sub clean_local { my $self = shift; - File::Path::rmtree("$self->{dir}/local", 1); + Path::Tiny->new("$self->{dir}/local")->remove_tree({ safe => 0 }); } 1; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/carton.git _______________________________________________ Pkg-perl-cvs-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits
