This is an automated email from the git hooks/post-receive script.

kanashiro-guest pushed a commit to branch master
in repository carton.

commit f8eaf77bc4dd4e54a56ec51c89aac561319af065
Author: Tatsuhiko Miyagawa <miyag...@bulknews.net>
Date:   Thu May 30 17:14:11 2013 +0900

    Simplify the bundle logic
---
 lib/Carton.pm     | 18 ++++++++++++------
 lib/Carton/CLI.pm | 13 +++++++------
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/lib/Carton.pm b/lib/Carton.pm
index e0fd148..e7a4afa 100644
--- a/lib/Carton.pm
+++ b/lib/Carton.pm
@@ -32,9 +32,16 @@ sub configure {
     %{$self} = (%$self, %args);
 }
 
-sub lock { $_[0]->{lock} }
+sub use_local_mirror {
+    my $self = shift;
+    $self->{mirror} = $self->local_cache;
+}
+
+sub local_cache {
+    File::Spec->rel2abs("$_[0]->{path}/cache");
+}
 
-sub local_mirror { File::Spec->rel2abs("$_[0]->{path}/cache") }
+sub lock { $_[0]->{lock} }
 
 sub list_dependencies {
     my $self = shift;
@@ -52,9 +59,8 @@ sub list_dependencies {
     return map "$_~$hash->{$_}", grep { $_ ne 'perl' } keys %$hash;
 }
 
-
 sub download_from_cpanfile {
-    my($self, $cpanfile, $local_mirror) = @_;
+    my($self, $cpanfile) = @_;
 
     my @modules = $self->list_dependencies;
 
@@ -62,7 +68,7 @@ sub download_from_cpanfile {
     $self->build_mirror_file($index, $self->{mirror_file});
 
     my $mirror = $self->{mirror} || $DefaultMirror;
-
+    my $local_cache = $self->local_cache; # because $self->{path} is localized
     local $self->{path} = File::Temp::tempdir(CLEANUP => 1); # ignore installed
 
     $self->run_cpanm(
@@ -72,7 +78,7 @@ sub download_from_cpanfile {
         "--no-skip-satisfied",
         ( $mirror ne $DefaultMirror ? "--mirror-only" : () ),
         "--scandeps",
-        "--save-dists", $local_mirror,
+        "--save-dists", $local_cache,
         @modules,
     );
 }
diff --git a/lib/Carton/CLI.pm b/lib/Carton/CLI.pm
index 3950f51..2112f62 100644
--- a/lib/Carton/CLI.pm
+++ b/lib/Carton/CLI.pm
@@ -136,7 +136,6 @@ sub cmd_bundle {
     $self->parse_options(\@args, "p|path=s" => sub { $self->carton->{path} = 
$_[1] });
 
     my $lock = $self->find_lock;
-    my $local_mirror = $self->carton->local_mirror;
 
     $self->carton->configure(
         lock => $lock,
@@ -147,12 +146,12 @@ sub cmd_bundle {
 
     if ($lock) {
         $self->print("Bundling modules using $cpanfile\n");
-        $self->carton->download_from_cpanfile($cpanfile, $local_mirror);
+        $self->carton->download_from_cpanfile($cpanfile);
     } else {
         $self->error("Can't locate carton.lock file. Run carton install 
first\n");
     }
 
-    $self->printf("Complete! Modules were bundled into %s\n", $local_mirror, 
SUCCESS);
+    $self->printf("Complete! Modules were bundled into %s\n", 
$self->carton->local_cache, SUCCESS);
 }
 
 sub cmd_install {
@@ -166,14 +165,16 @@ sub cmd_install {
     );
 
     my $lock = $self->find_lock;
-    my $local_mirror = $self->carton->local_mirror;
 
     $self->carton->configure(
         lock => $lock,
-        mirror_file => $self->mirror_file, # $lock object?
-        ( $self->{use_local_mirror} && -d $local_mirror ? (mirror => 
$local_mirror) : () ),
+        mirror_file => $self->mirror_file,
     );
 
+    if ($self->{use_local_mirror}) {
+        $self->carton->use_local_mirror;
+    }
+
     my $cpanfile = $self->find_cpanfile;
 
     if ($self->{deployment}) {

-- 
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
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to